Skip to content

Commit

Permalink
Fix: materialType not being set for structural objects sent from Revit (
Browse files Browse the repository at this point in the history
#1553)

* Fix: materialType not being set for structural objects sent from Revit 

Co-authored-by: Connor Ivy <[email protected]>
  • Loading branch information
connorivy and Connor Ivy authored Aug 29, 2022
1 parent 8c10c5c commit 7666a03
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick)
var concreteMaterial = new Concrete
{
name = stickFamily.Document.GetElement(stickFamily.StructuralMaterialId).Name,
//type = Structural.MaterialType.Concrete,
materialType = Structural.MaterialType.Concrete,
grade = null,
designCode = null,
codeYear = null,
Expand All @@ -311,7 +311,7 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick)
var steelMaterial = new Steel
{
name = stickFamily.Document.GetElement(stickFamily.StructuralMaterialId).Name,
//type = Structural.MaterialType.Steel,
materialType = Structural.MaterialType.Steel,
grade = materialAsset.Name,
designCode = null,
codeYear = null,
Expand All @@ -331,7 +331,7 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick)
var timberMaterial = new Timber
{
name = structMat.Document.GetElement(structMat.StructuralAssetId).Name,
//type = Structural.MaterialType.Timber,
materialType = Structural.MaterialType.Timber,
grade = materialAsset.WoodGrade,
designCode = null,
codeYear = null,
Expand Down Expand Up @@ -587,8 +587,8 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalMember revitStick)
case StructuralMaterialType.Concrete:
var concreteMaterial = new Concrete
{
name = stickFamily.Document.GetElement(revitStick.MaterialId).Name,
//type = Structural.MaterialType.Concrete,
name = stickFamily.Document.GetElement(revitStick.MaterialId).Name,
materialType = Structural.MaterialType.Concrete,
grade = null,
designCode = null,
codeYear = null,
Expand All @@ -612,7 +612,7 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalMember revitStick)
var steelMaterial = new Steel
{
name = stickFamily.Document.GetElement(revitStick.MaterialId).Name,
//type = Structural.MaterialType.Steel,
materialType = Structural.MaterialType.Steel,
grade = materialAsset.Name,
designCode = null,
codeYear = null,
Expand All @@ -632,7 +632,7 @@ private Element1D AnalyticalStickToSpeckle(AnalyticalMember revitStick)
var timberMaterial = new Timber
{
name = structMat.Document.GetElement(structMat.StructuralAssetId).Name,
//type = Structural.MaterialType.Timber,
materialType = Structural.MaterialType.Timber,
grade = materialAsset.WoodGrade,
designCode = null,
codeYear = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface
var concreteMaterial = new Concrete
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Concrete,
materialType = Structural.MaterialType.Concrete,
grade = null,
designCode = null,
codeYear = null,
Expand All @@ -192,7 +192,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface
var steelMaterial = new Steel
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Steel,
materialType = Structural.MaterialType.Steel,
grade = materialAsset.Name,
designCode = null,
codeYear = null,
Expand All @@ -212,7 +212,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface
var timberMaterial = new Timber
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Timber,
materialType = Structural.MaterialType.Timber,
grade = materialAsset.WoodGrade,
designCode = null,
codeYear = null,
Expand Down Expand Up @@ -326,7 +326,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalPanel revitSurface)
var concreteMaterial = new Concrete
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Concrete,
materialType = Structural.MaterialType.Concrete,
grade = null,
designCode = null,
codeYear = null,
Expand All @@ -350,7 +350,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalPanel revitSurface)
var steelMaterial = new Steel
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Steel,
materialType = Structural.MaterialType.Steel,
grade = materialAsset.Name,
designCode = null,
codeYear = null,
Expand All @@ -370,7 +370,7 @@ private Element2D AnalyticalSurfaceToSpeckle(AnalyticalPanel revitSurface)
var timberMaterial = new Timber
{
name = structMaterial.Document.GetElement(structMaterial.StructuralAssetId).Name,
//type = Structural.MaterialType.Timber,
materialType = Structural.MaterialType.Timber,
grade = materialAsset.WoodGrade,
designCode = null,
codeYear = null,
Expand Down
64 changes: 32 additions & 32 deletions Objects/Objects/Structural/Material/Concrete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@

namespace Objects.Structural.Materials
{
public class Concrete : Material
{
public double compressiveStrength { get; set; } //forgo using "strength" property in Material class
public double tensileStrength { get; set; } //design calc impacts
public double flexuralStrength { get; set; } //design calc impacts
public double maxCompressiveStrain { get; set; } //failure strain
public double maxTensileStrain { get; set; }
public double maxAggregateSize { get; set; }
public bool lightweight { get; set; } //whether or not it's a lightweight concrete
public class Concrete : Material
{
public double compressiveStrength { get; set; } //forgo using "strength" property in Material class
public double tensileStrength { get; set; } //design calc impacts
public double flexuralStrength { get; set; } //design calc impacts
public double maxCompressiveStrain { get; set; } //failure strain
public double maxTensileStrain { get; set; }
public double maxAggregateSize { get; set; }
public bool lightweight { get; set; } //whether or not it's a lightweight concrete

public Concrete() { }
public Concrete() { }

[SchemaInfo("Concrete", "Creates a Speckle structural material for concrete (to be used in structural analysis models)", "Structural", "Materials")]
public Concrete(string name, string grade = null, string designCode = null, string codeYear = null, double elasticModulus = 0, double compressiveStrength = 0, double tensileStrength = 0, double flexuralStrength = 0, double maxCompressiveStrain = 0, double maxTensileStrain = 0, double maxAggregateSize = 0, bool lightweight = false, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double thermalExpansivity = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.materialType = MaterialType.Concrete;
this.designCode = designCode;
this.codeYear = codeYear;
this.elasticModulus = elasticModulus;
this.compressiveStrength = compressiveStrength;
this.tensileStrength = tensileStrength;
this.flexuralStrength = flexuralStrength;
this.maxCompressiveStrain = maxCompressiveStrain;
this.maxTensileStrain = maxTensileStrain;
this.maxAggregateSize = maxAggregateSize;
this.lightweight = lightweight;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
[SchemaInfo("Concrete", "Creates a Speckle structural material for concrete (to be used in structural analysis models)", "Structural", "Materials")]
public Concrete(string name, string grade = null, string designCode = null, string codeYear = null, double elasticModulus = 0, double compressiveStrength = 0, double tensileStrength = 0, double flexuralStrength = 0, double maxCompressiveStrain = 0, double maxTensileStrain = 0, double maxAggregateSize = 0, bool lightweight = false, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double thermalExpansivity = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.materialType = MaterialType.Concrete;
this.designCode = designCode;
this.codeYear = codeYear;
this.elasticModulus = elasticModulus;
this.compressiveStrength = compressiveStrength;
this.tensileStrength = tensileStrength;
this.flexuralStrength = flexuralStrength;
this.maxCompressiveStrain = maxCompressiveStrain;
this.maxTensileStrain = maxTensileStrain;
this.maxAggregateSize = maxAggregateSize;
this.lightweight = lightweight;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
}
}
50 changes: 25 additions & 25 deletions Objects/Objects/Structural/Material/Steel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@

namespace Objects.Structural.Materials
{
public class Steel : Material
{
public double yieldStrength { get; set; } //or yieldStress
public double ultimateStrength { get; set; } //ultimateStress
public double maxStrain { get; set; } //failureStrain
public double strainHardeningModulus { get; set; }
public Steel() { }
public class Steel : Material
{
public double yieldStrength { get; set; } //or yieldStress
public double ultimateStrength { get; set; } //ultimateStress
public double maxStrain { get; set; } //failureStrain
public double strainHardeningModulus { get; set; }
public Steel() { }

[SchemaInfo("Steel", "Creates a Speckle structural material for steel (to be used in structural analysis models)", "Structural", "Materials")]
public Steel(string name, string grade = null, string designCode = null, string codeYear = null, double elasticModulus = 0, double yieldStrength = 0, double ultimateStrength = 0, double maxStrain = 0, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double alpha = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.materialType = MaterialType.Steel;
this.designCode = designCode;
this.codeYear = codeYear;
this.elasticModulus = elasticModulus;
this.yieldStrength = yieldStrength;
this.ultimateStrength = ultimateStrength;
this.maxStrain = maxStrain;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
[SchemaInfo("Steel", "Creates a Speckle structural material for steel (to be used in structural analysis models)", "Structural", "Materials")]
public Steel(string name, string grade = null, string designCode = null, string codeYear = null, double elasticModulus = 0, double yieldStrength = 0, double ultimateStrength = 0, double maxStrain = 0, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double alpha = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.materialType = MaterialType.Steel;
this.designCode = designCode;
this.codeYear = codeYear;
this.elasticModulus = elasticModulus;
this.yieldStrength = yieldStrength;
this.ultimateStrength = ultimateStrength;
this.maxStrain = maxStrain;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
}
}
44 changes: 22 additions & 22 deletions Objects/Objects/Structural/Material/Timber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,28 @@

namespace Objects.Structural.Materials
{
public class Timber : Material
{
//missing timber-specific properties? parallel to grain, perpendicular to grain
public string species { get; set; }
public Timber() { }
public class Timber : Material
{
//missing timber-specific properties? parallel to grain, perpendicular to grain
public string species { get; set; }
public Timber() { }

[SchemaInfo("Timber", "Creates a Speckle structural material for timber (to be used in structural analysis models)", "Structural", "Materials")]
public Timber(string name, string species = null, string grade = null, string designCode = null, string codeYear = null, double strength = 0, double elasticModulus = 0, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double thermalExpansivity = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.species = species;
this.materialType = MaterialType.Timber;
this.designCode = designCode;
this.codeYear = codeYear;
this.strength = strength;
this.elasticModulus = elasticModulus;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
[SchemaInfo("Timber", "Creates a Speckle structural material for timber (to be used in structural analysis models)", "Structural", "Materials")]
public Timber(string name, string species = null, string grade = null, string designCode = null, string codeYear = null, double strength = 0, double elasticModulus = 0, double poissonsRatio = 0, double shearModulus = 0, double density = 0, double thermalExpansivity = 0, double dampingRatio = 0)
{
this.name = name;
this.grade = grade;
this.species = species;
this.materialType = MaterialType.Timber;
this.designCode = designCode;
this.codeYear = codeYear;
this.strength = strength;
this.elasticModulus = elasticModulus;
this.poissonsRatio = poissonsRatio;
this.shearModulus = shearModulus;
this.density = density;
this.thermalExpansivity = thermalExpansivity;
this.dampingRatio = dampingRatio;
}
}
}

0 comments on commit 7666a03

Please sign in to comment.