public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: _name = value.StringVal; return; case 1: _description = value.StringVal; return; case 2: _material = (IfcMaterial)(value.EntityVal); return; case 3: _profile = (IfcProfileDef)(value.EntityVal); return; case 4: _priority = value.IntegerVal; return; case 5: _category = value.StringVal; return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: base.Parse(propIndex, value, nestedIndex); return; case 2: _parentProfile = (IfcProfileDef)(value.EntityVal); return; case 3: _operator = (IfcCartesianTransformationOperator2D)(value.EntityVal); return; case 4: _label = value.StringVal; return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
internal static bool IfcTaperedSweptAreaProfiles(IfcProfileDef StartArea, IfcProfileDef EndArea) { // local variables bool Result = false; if (StartArea is IfcParameterizedProfileDef) { if (EndArea is IfcDerivedProfileDef) { var end = EndArea as IfcDerivedProfileDef; Result = end != null && StartArea == end.ParentProfile; } else { Result = StartArea.GetType() == EndArea.GetType(); } } else { if (EndArea is IfcDerivedProfileDef) { var end = EndArea as IfcDerivedProfileDef; Result = end != null && StartArea == end.ParentProfile; } else { Result = false; } } return(Result); }
// private static IfcOpeningElement ToIfcOpeningElement(this Opening opening, IfcRepresentationContext context, Document doc, IfcObjectPlacement parent) // { // // var sweptArea = opening.Profile.Perimeter.ToIfcArbitraryClosedProfileDef(doc); // // We use the Z extrude direction because the direction is // // relative to the local placement, which is a transform at the // // beam's end with the Z axis pointing along the direction. // // var extrudeDirection = opening.ExtrudeDirection.ToIfcDirection(); // // var position = new Transform().ToIfcAxis2Placement3D(doc); // // var solid = new IfcExtrudedAreaSolid(sweptArea, position, // // extrudeDirection, new IfcPositiveLengthMeasure(opening.ExtrudeDepth)); // var extrude= (Extrude)opening.Geometry.SolidOperations[0]; // var solid = extrude.ToIfcExtrudedAreaSolid(new Transform(), doc); // var localPlacement = new Transform().ToIfcLocalPlacement(doc, parent); // var shape = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List<IfcRepresentationItem>{solid}); // var productRep = new IfcProductDefinitionShape(new List<IfcRepresentation>{shape}); // var ifcOpening = new IfcOpeningElement(IfcGuid.ToIfcGuid(opening.Id), null, null, null, null, localPlacement, productRep, null); // // doc.AddEntity(sweptArea); // // doc.AddEntity(extrudeDirection); // // doc.AddEntity(position); // // doc.AddEntity(repItem); // doc.AddEntity(solid); // doc.AddEntity(localPlacement); // doc.AddEntity(shape); // doc.AddEntity(productRep); // return ifcOpening; // } private static ICurve ToCurve(this IfcProfileDef profile) { if (profile is IfcCircleProfileDef) { var cpd = (IfcCircleProfileDef)profile; // TODO: Remove this conversion to a polygon when downstream // functions support arcs and circles. return(new Circle((IfcLengthMeasure)cpd.Radius).ToPolygon(10)); } else if (profile is IfcParameterizedProfileDef) { var ipd = (IfcParameterizedProfileDef)profile; return(ipd.ToCurve()); } else if (profile is IfcArbitraryOpenProfileDef) { var aopd = (IfcArbitraryOpenProfileDef)profile; return(aopd.ToCurve()); } else if (profile is IfcArbitraryClosedProfileDef) { var acpd = (IfcArbitraryClosedProfileDef)profile; return(acpd.ToCurve()); } else if (profile is IfcCompositeProfileDef) { throw new Exception("IfcCompositeProfileDef is not supported yet."); } else if (profile is IfcDerivedProfileDef) { throw new Exception("IfcDerivedProfileDef is not supported yet."); } return(null); }
private static void Extrude(Stack operandStack) { double extrudeHeight = Double.Parse((string)operandStack.Pop()); IfcProfileDef extrudeProfile = (IfcProfileDef)operandStack.Pop(); operandStack.Push(extrudeProfile.Extrude(extrudeHeight)); }
private static void Revolve(Stack operandStack) { double revolveAngle = Double.Parse((string)operandStack.Pop()); IfcProfileDef revolveProfile = (IfcProfileDef)operandStack.Pop(); operandStack.Push(revolveProfile.Revolve(revolveAngle)); }
public static IfcProductDefinitionShape CreateExtruded(IfcRepresentationContext representationContext, IfcProfileDef ifcProfileDef, IfcAxis2Placement3D placement3D, IfcDirection direction, double depth) { var extruded = new IfcExtrudedAreaSolid { SweptArea = ifcProfileDef, Position = placement3D, ExtrudedDirection = direction , Depth = depth, }; var shaperep = new IfcShapeRepresentation { ContextOfItems = representationContext, RepresentationIdentifier = "Body", RepresentationType = "SweptSolid", Items = new List<IfcRepresentationItem>(), }; shaperep.Items.Add(extruded); var ifcShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List<IfcRepresentation>(), }; ifcShape.Representations.Add(shaperep); return ifcShape; }
public override string WhereRule() { string err = ""; if (_crossSectionPositions.Count != _crossSections.Count) { err += "WR1 SectionedSpine : The set of cross sections and the set of cross section positions shall be of the same size.\n"; } IfcProfileDef firstProfile = _crossSections.FirstOrDefault(); if (firstProfile != null) { IfcProfileTypeEnum pType = firstProfile.ProfileType; foreach (IfcProfileDef prof in _crossSections) { if (prof.ProfileType != pType) { err += "WR2 SectionedSpine : The profile type (either AREA or CURVE) shall be consistent within the list of the profiles defining the cross sections.\n"; break; } } } if (_spineCurve != null && _spineCurve.Dim != 3) { err += "WR3 SectionedSpine : The curve entity which is the underlying spine curve shall have the dimensionality of 3.\n"; } return(err); }
// private static IfcOpeningElement ToIfcOpeningElement(this Opening opening, IfcRepresentationContext context, Document doc, IfcObjectPlacement parent) // { // // var sweptArea = opening.Profile.Perimeter.ToIfcArbitraryClosedProfileDef(doc); // // We use the Z extrude direction because the direction is // // relative to the local placement, which is a transform at the // // beam's end with the Z axis pointing along the direction. // // var extrudeDirection = opening.ExtrudeDirection.ToIfcDirection(); // // var position = new Transform().ToIfcAxis2Placement3D(doc); // // var solid = new IfcExtrudedAreaSolid(sweptArea, position, // // extrudeDirection, new IfcPositiveLengthMeasure(opening.ExtrudeDepth)); // var extrude= (Extrude)opening.Geometry.SolidOperations[0]; // var solid = extrude.ToIfcExtrudedAreaSolid(new Transform(), doc); // var localPlacement = new Transform().ToIfcLocalPlacement(doc, parent); // var shape = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List<IfcRepresentationItem>{solid}); // var productRep = new IfcProductDefinitionShape(new List<IfcRepresentation>{shape}); // var ifcOpening = new IfcOpeningElement(IfcGuid.ToIfcGuid(opening.Id), null, null, null, null, localPlacement, productRep, null); // // doc.AddEntity(sweptArea); // // doc.AddEntity(extrudeDirection); // // doc.AddEntity(position); // // doc.AddEntity(repItem); // doc.AddEntity(solid); // doc.AddEntity(localPlacement); // doc.AddEntity(shape); // doc.AddEntity(productRep); // return ifcOpening; // } private static ICurve ToCurve(this IfcProfileDef profile) { if (profile is IfcCircleProfileDef) { var cpd = (IfcCircleProfileDef)profile; return(Polygon.Circle((IfcLengthMeasure)cpd.Radius)); } else if (profile is IfcParameterizedProfileDef) { var ipd = (IfcParameterizedProfileDef)profile; return(ipd.ToCurve()); } else if (profile is IfcArbitraryOpenProfileDef) { var aopd = (IfcArbitraryOpenProfileDef)profile; return(aopd.ToCurve()); } else if (profile is IfcArbitraryClosedProfileDef) { var acpd = (IfcArbitraryClosedProfileDef)profile; return(acpd.ToCurve()); } else if (profile is IfcCompositeProfileDef) { throw new Exception("IfcCompositeProfileDef is not supported yet."); } else if (profile is IfcDerivedProfileDef) { throw new Exception("IfcDerivedProfileDef is not supported yet."); } return(null); }
internal static bool IfcTaperedSweptAreaProfiles(IfcProfileDef StartArea, IfcProfileDef EndArea) { // local variables bool Result = false; if (INTYPEOF(StartArea, "IFC4.IFCPARAMETERIZEDPROFILEDEF")) { if (INTYPEOF(EndArea, "IFC4.IFCDERIVEDPROFILEDEF")) { var end = EndArea as IIfcDerivedProfileDef; // todo: handle null case? Result = StartArea == end.ParentProfile; } else { Result = (StartArea.GetType() == EndArea.GetType()); } } else { if (INTYPEOF(EndArea, "IFC4.IFCDERIVEDPROFILEDEF")) { var end = EndArea as IIfcDerivedProfileDef; // todo: handle null case? Result = StartArea == end.ParentProfile; } else { Result = false; } } return(Result); }
public static IfcProductDefinitionShape CreateExtruded(IfcRepresentationContext representationContext, IfcProfileDef ifcProfileDef, IfcAxis2Placement3D placement3D, IfcDirection direction, double depth) { var extruded = new IfcExtrudedAreaSolid { SweptArea = ifcProfileDef, Position = placement3D, ExtrudedDirection = direction, Depth = depth, }; var shaperep = new IfcShapeRepresentation { ContextOfItems = representationContext, RepresentationIdentifier = "Body", RepresentationType = "SweptSolid", Items = new List <IfcRepresentationItem>(), }; shaperep.Items.Add(extruded); var ifcShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; ifcShape.Representations.Add(shaperep); return(ifcShape); }
public IfcSurfaceCurveSweptAreaSolid(IfcProfileDef __SweptArea, IfcAxis2Placement3D __Position, IfcCurve __Directrix, IfcParameterValue __StartParam, IfcParameterValue __EndParam, IfcSurface __ReferenceSurface) : base(__SweptArea, __Position) { this._Directrix = __Directrix; this._StartParam = __StartParam; this._EndParam = __EndParam; this._ReferenceSurface = __ReferenceSurface; }
public static IfcSurfaceOfRevolution MakeSurfaceOfRevolution(MemoryModel m, IfcProfileDef profile) { var surf = m.Instances.New <IfcSurfaceOfRevolution>(); surf.SweptCurve = profile; surf.AxisPosition = MakeAxis1Placement(m); return(surf); }
public IfcFixedReferenceSweptAreaSolid(IfcProfileDef __SweptArea, IfcAxis2Placement3D __Position, IfcCurve __Directrix, IfcParameterValue?__StartParam, IfcParameterValue?__EndParam, IfcDirection __FixedReference) : base(__SweptArea, __Position) { this.Directrix = __Directrix; this.StartParam = __StartParam; this.EndParam = __EndParam; this.FixedReference = __FixedReference; }
public IfcStructuralSteelProfileProperties(IfcLabel?__ProfileName, IfcProfileDef __ProfileDefinition, IfcMassPerLengthMeasure?__PhysicalWeight, IfcPositiveLengthMeasure?__Perimeter, IfcPositiveLengthMeasure?__MinimumPlateThickness, IfcPositiveLengthMeasure?__MaximumPlateThickness, IfcAreaMeasure?__CrossSectionArea, IfcMomentOfInertiaMeasure?__TorsionalConstantX, IfcMomentOfInertiaMeasure?__MomentOfInertiaYZ, IfcMomentOfInertiaMeasure?__MomentOfInertiaY, IfcMomentOfInertiaMeasure?__MomentOfInertiaZ, IfcWarpingConstantMeasure?__WarpingConstant, IfcLengthMeasure?__ShearCentreZ, IfcLengthMeasure?__ShearCentreY, IfcAreaMeasure?__ShearDeformationAreaZ, IfcAreaMeasure?__ShearDeformationAreaY, IfcSectionModulusMeasure?__MaximumSectionModulusY, IfcSectionModulusMeasure?__MinimumSectionModulusY, IfcSectionModulusMeasure?__MaximumSectionModulusZ, IfcSectionModulusMeasure?__MinimumSectionModulusZ, IfcSectionModulusMeasure?__TorsionalSectionModulus, IfcLengthMeasure?__CentreOfGravityInX, IfcLengthMeasure?__CentreOfGravityInY, IfcAreaMeasure?__ShearAreaZ, IfcAreaMeasure?__ShearAreaY, IfcPositiveRatioMeasure?__PlasticShapeFactorY, IfcPositiveRatioMeasure?__PlasticShapeFactorZ) : base(__ProfileName, __ProfileDefinition, __PhysicalWeight, __Perimeter, __MinimumPlateThickness, __MaximumPlateThickness, __CrossSectionArea, __TorsionalConstantX, __MomentOfInertiaYZ, __MomentOfInertiaY, __MomentOfInertiaZ, __WarpingConstant, __ShearCentreZ, __ShearCentreY, __ShearDeformationAreaZ, __ShearDeformationAreaY, __MaximumSectionModulusY, __MinimumSectionModulusY, __MaximumSectionModulusZ, __MinimumSectionModulusZ, __TorsionalSectionModulus, __CentreOfGravityInX, __CentreOfGravityInY) { this._ShearAreaZ = __ShearAreaZ; this._ShearAreaY = __ShearAreaY; this._PlasticShapeFactorY = __PlasticShapeFactorY; this._PlasticShapeFactorZ = __PlasticShapeFactorZ; }
public IfcMaterialProfile(IfcLabel?__Name, IfcText?__Description, IfcMaterial __Material, IfcProfileDef __Profile, IfcInteger?__Priority, IfcLabel?__Category) { this._Name = __Name; this._Description = __Description; this._Material = __Material; this._Profile = __Profile; this._Priority = __Priority; this._Category = __Category; }
public IfcRibPlateProfileProperties(IfcLabel?__ProfileName, IfcProfileDef __ProfileDefinition, IfcPositiveLengthMeasure?__Thickness, IfcPositiveLengthMeasure?__RibHeight, IfcPositiveLengthMeasure?__RibWidth, IfcPositiveLengthMeasure?__RibSpacing, IfcRibPlateDirectionEnum __Direction) : base(__ProfileName, __ProfileDefinition) { this._Thickness = __Thickness; this._RibHeight = __RibHeight; this._RibWidth = __RibWidth; this._RibSpacing = __RibSpacing; this._Direction = __Direction; }
public IfcGeneralProfileProperties(IfcLabel?__ProfileName, IfcProfileDef __ProfileDefinition, IfcMassPerLengthMeasure?__PhysicalWeight, IfcPositiveLengthMeasure?__Perimeter, IfcPositiveLengthMeasure?__MinimumPlateThickness, IfcPositiveLengthMeasure?__MaximumPlateThickness, IfcAreaMeasure?__CrossSectionArea) : base(__ProfileName, __ProfileDefinition) { this._PhysicalWeight = __PhysicalWeight; this._Perimeter = __Perimeter; this._MinimumPlateThickness = __MinimumPlateThickness; this._MaximumPlateThickness = __MaximumPlateThickness; this._CrossSectionArea = __CrossSectionArea; }
/// <summary> /// Compares two objects for geomtric equality /// </summary> /// <param name="a"></param> /// <param name="b">object to compare with</param> /// <returns></returns> public static bool GeometricEquals(this IfcDerivedProfileDef a, IfcProfileDef b) { IfcDerivedProfileDef p = b as IfcDerivedProfileDef; if (p == null) { return(false); //different types are not the same } return(a.Operator.GeometricEquals(p.Operator) && a.ParentProfile.GeometricEquals(p.ParentProfile)); }
public static IfcExtrudedAreaSolid MakeExtrudedAreaSolid(MemoryModel m, IfcProfileDef profile, double extrude) { var extrusion = m.Instances.New <IfcExtrudedAreaSolid>(); extrusion.Depth = extrude; extrusion.ExtrudedDirection = m.Instances.New <IfcDirection>(d => d.SetXYZ(0, 0, 1)); extrusion.Position = MakeAxis2Placement3D(m); extrusion.SweptArea = profile; return(extrusion); }
/// <summary> /// Compares two objects for geomtric equality /// </summary> /// <param name="a"></param> /// <param name="b">object to compare with</param> /// <returns></returns> public static bool GeometricEquals(this IfcRectangleProfileDef a, IfcProfileDef b) { IfcRectangleProfileDef p = b as IfcRectangleProfileDef; if (p == null) { return(false); //different types are not the same } return(a.XDim == p.XDim && a.YDim == p.YDim && a.Position.GeometricEquals(p.Position)); }
public static IfcExtrudedAreaSolid Extrude(this IfcProfileDef sweptArea, double height, IfcDirection?direction, IfcAxis2Placement3D?position) { return(new IfcExtrudedAreaSolid(sweptArea, position ?? IfcInit.CreateIfcAxis2Placement3D(), direction ?? new IfcDirection(0, 0, 1), new IfcPositiveLengthMeasure(height))); }
/// <summary> /// Compares two objects for geomtric equality /// </summary> /// <param name="a"></param> /// <param name="b">object to compare with</param> /// <returns></returns> public static bool GeometricEquals(this IfcArbitraryClosedProfileDef a, IfcProfileDef b) { IfcArbitraryClosedProfileDef p = b as IfcArbitraryClosedProfileDef; if (p == null) { return(false); //different types are not the same } return(a.ProfileType == b.ProfileType && a.OuterCurve.GeometricEquals(p.OuterCurve)); }
/// <summary> /// Compares two objects for geomtric equality /// </summary> /// <param name="a"></param> /// <param name="b">object to compare with</param> /// <returns></returns> public static bool GeometricEquals(this IfcCircleHollowProfileDef a, IfcProfileDef b) { IfcCircleHollowProfileDef p = b as IfcCircleHollowProfileDef; if (p == null) { return(false); //different types are not the same } return(a.Radius == p.Radius && a.WallThickness == p.WallThickness && a.Position.GeometricEquals(p.Position)); }
public static IfcExtrudedAreaSolid MakeExtrudedAreaSolid(IfcStore m, IfcProfileDef area, IfcAxis2Placement3D pos, IfcDirection dir, double depth) { return(m.Instances.New <IfcExtrudedAreaSolid>(exSolid => { exSolid.SweptArea = area; exSolid.Position = pos; exSolid.ExtrudedDirection = dir; exSolid.Depth = depth; })); }
public static IfcExtrudedAreaSolid MakeExtrudeAreaSolid(IfcStore m, IfcProfileDef profile, IfcAxis2Placement3D position, IfcDirection direction, IfcPositiveLengthMeasure depth) { return(m.Instances.New <IfcExtrudedAreaSolid>(s => { s.SweptArea = profile; s.Position = position; s.ExtrudedDirection = direction; s.Depth = depth; })); }
public static IfcRevolvedAreaSolid Revolve(this IfcProfileDef sweptArea, double rotation, IfcAxis1Placement?axis, IfcAxis2Placement3D?position) { return(new IfcRevolvedAreaSolid(sweptArea, position ?? IfcInit.CreateIfcAxis2Placement3D(), axis ?? new IfcAxis1Placement(new IfcCartesianPoint(0, 0, 0), new IfcDirection(0, 1, 0)), new IfcPlaneAngleMeasure(rotation))); }
public void CircleProfileDefTest() { using (var m = XbimModel.CreateTemporaryModel()) { using (var txn = m.BeginTransaction()) { IfcProfileDef prof = IfcModelBuilder.MakeCircleProfileDef(m, 20); var face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); } } }
internal static IfcColumn createColumn(IfcProduct host, IfcProfileDef profile, IfcCartesianPoint cartesianPoint, string globalId) { DatabaseIfc db = host.Database; IfcExtrudedAreaSolid extrudedAreaSolid = new IfcExtrudedAreaSolid(profile, 5000); IfcShapeRepresentation shapeRepresentation = new IfcShapeRepresentation(extrudedAreaSolid); IfcProductDefinitionShape productDefinitionShape = new IfcProductDefinitionShape(shapeRepresentation); IfcLocalPlacement localPlacement = createLocalPlacement(host, cartesianPoint, db.Factory.YAxis); IfcColumn column = new IfcColumn(host, localPlacement, productDefinitionShape); setGlobalId(column, globalId); return(column); }
public void CircleProfileDefTest() { using (var m = IfcStore.Create(new XbimEditorCredentials(), IfcSchemaVersion.Ifc4, XbimStoreType.InMemoryModel)) { using (var txn = m.BeginTransaction()) { IfcProfileDef prof = IfcModelBuilder.MakeCircleProfileDef(m, 20); var face = _xbimGeometryCreator.CreateFace(prof); Assert.IsTrue(face.Area > 0); txn.Commit(); } } }
/// <summary> /// Compares two objects for geomtric equality /// </summary> /// <param name="a"></param> /// <param name="b">object to compare with</param> /// <returns></returns> public static bool GeometricEquals(this IfcLShapeProfileDef a, IfcProfileDef b) { IfcLShapeProfileDef p = b as IfcLShapeProfileDef; if (p == null) { return(false); //different types are not the same } return(a.Depth == p.Depth && a.Thickness == p.Thickness && a.Width == p.Width && a.Position.GeometricEquals(p.Position)); }