public SemTextGeometry( string literal, SemPosition2D position2D ) { _ifcTextLiteral = new IfcTextLiteral { Literal = literal, Placement = new IfcAxis2Placement(), Path = IfcTextPath.RIGHT, }; _ifcTextLiteral.Placement.Value = position2D.IfcAxis2Placement2D; _ifcShapeRepresentation = new IfcShapeRepresentation { ContextOfItems = SemHeaderSetting.Setting3D.GeometricRepresentationContext, RepresentationIdentifier = "GeometricCurveSet", RepresentationType = "Annotation2D", Items = new List <IfcRepresentationItem>(), }; _ifcShapeRepresentation.Items.Add(_ifcTextLiteral); _ifcProductDefinitionShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation); }
/// <summary> /// Convert a wall to an IfcWallStandardCase /// </summary> /// <param name="wall"></param> /// <param name="context"></param> /// <param name="doc"></param> /// <returns></returns> private static IfcWallStandardCase ToIfcWallStandardCase(this Wall wall, IfcRepresentationContext context, Document doc) { var sweptArea = wall.CenterLine.Thicken(wall.Thickness()).ToIfcArbitraryClosedProfileDef(doc); var extrudeDirection = Vector3.ZAxis.ToIfcDirection(); // We don't use the Wall's transform for positioning, because // our walls have a transform that lays the wall "flat". Just // use a identity transform. var position = new Transform().ToIfcAxis2Placement3D(doc); var repItem = new IfcExtrudedAreaSolid(sweptArea, position, extrudeDirection, new IfcPositiveLengthMeasure(wall.Height)); var rep = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List <IfcRepresentationItem> { repItem }); var productRep = new IfcProductDefinitionShape(new List <IfcRepresentation> { rep }); var id = IfcGuid.ToIfcGuid(Guid.NewGuid()); var localPlacement = new Transform().ToIfcLocalPlacement(doc); var ifcWall = new IfcWallStandardCase(new IfcGloballyUniqueId(id), null, wall.Name, null, null, localPlacement, productRep, null); doc.AddEntity(sweptArea); doc.AddEntity(extrudeDirection); doc.AddEntity(position); doc.AddEntity(repItem); doc.AddEntity(rep); doc.AddEntity(localPlacement); doc.AddEntity(productRep); doc.AddEntity(ifcWall); return(ifcWall); }
public BbExtrudedGeometry( BbProfile profile, BbPosition3D position3D, BbDirection3D direction3D, double depth ) { _ifcExtrudedAreaSolid = new IfcExtrudedAreaSolid { SweptArea = profile.IfcProfileDef, Position = position3D.IfcAxis2Placement3D, ExtrudedDirection = direction3D.IfcDirection, Depth = depth, }; _ifcShapeRepresentation = new IfcShapeRepresentation { ContextOfItems = BbHeaderSetting.Setting3D.GeometricRepresentationContext, RepresentationIdentifier = "Body", RepresentationType = "SweptSolid", Items = new List <IfcRepresentationItem>(), }; _ifcShapeRepresentation.Items.Add(_ifcExtrudedAreaSolid); _ifcProductDefinitionShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation); }
public BbCurveGeometry( BbPolyline3D bbPolyline3D ) { _ifcPolyline = bbPolyline3D.IfcCurve as IfcPolyline; _ifcShapeRepresentation = new IfcShapeRepresentation { ContextOfItems = BbHeaderSetting.Setting3D.GeometricRepresentationContext, RepresentationIdentifier = "Body", RepresentationType = "GeometricCurveSet", Items = new List <IfcRepresentationItem>(), }; _ifcShapeRepresentation.Items.Add(_ifcPolyline); _ifcProductDefinitionShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation); }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(Console.In); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement(); List <IfcBuiltElement> elements = project.Extract <IfcBuiltElement>(); //IfcBuiltElement renamed from IfcBuildingElement List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuiltElement element in elements) { IfcProductDefinitionShape representation = element.Representation; if (representation != null) { foreach (IfcShapeModel rep in representation.Representations) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { foreach (IfcRepresentationItem item in sr.Items) { IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); } } } } } } }
/// <summary> /// Creates new body representation it as "Body", "Brep". /// </summary> /// <param name = "context">Geometry context</param> /// <returns>New empty set of representation items</returns> public static IfcShapeRepresentation GetNewSweptSolidShapeRepresentation(this IfcProduct prod, IfcRepresentationContext context) { IModel model = (prod as IPersistIfcEntity).ModelOf; if (model == null) { model = prod.ModelOf; } IfcProductDefinitionShape definitionShape = prod.Representation as IfcProductDefinitionShape; if (definitionShape == null) { definitionShape = model.Instances.New <IfcProductDefinitionShape>(); prod.Representation = definitionShape; } IfcShapeRepresentation shapeRepresentation = model.Instances.New <IfcShapeRepresentation>(); shapeRepresentation.ContextOfItems = context; // model.IfcProject.ModelContext(); shapeRepresentation.RepresentationIdentifier = "Body"; shapeRepresentation.RepresentationType = "SweptSolid"; definitionShape.Representations.Add(shapeRepresentation); return(shapeRepresentation); }
private static IfcPlate ToIfc(this Panel panel, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var plate = new IfcPlate(IfcGuid.ToIfcGuid(id), null, null, null, null, localPlacement, shape, null, IfcPlateTypeEnum.NOTDEFINED); return(plate); }
private static IfcSlab ToIfc(this Floor floor, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var slab = new IfcSlab(IfcGuid.ToIfcGuid(id), null, null, null, null, localPlacement, shape, null, IfcSlabTypeEnum.FLOOR); return(slab); }
private static IfcBeam ToIfc(this Beam beam, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcBeam = new IfcBeam(IfcGuid.ToIfcGuid(beam.Id), null, null, null, null, localPlacement, shape, null, IfcBeamTypeEnum.BEAM); return(ifcBeam); }
private static IfcColumn ToIfc(this Column column, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcColumn = new IfcColumn(IfcGuid.ToIfcGuid(id), null, null, null, null, localPlacement, shape, null, IfcColumnTypeEnum.COLUMN); return(ifcColumn); }
private static IfcMember ToIfc(this Brace column, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var member = new IfcMember(IfcGuid.ToIfcGuid(id), null, null, null, null, localPlacement, shape, null, IfcMemberTypeEnum.NOTDEFINED); return(member); }
private static IfcPlate ToIfc(this Panel panel, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var plate = new IfcPlate(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, shape, null); return(plate); }
private static IfcMember ToIfc(this Brace column, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var member = new IfcMember(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, shape, null); return(member); }
private static IfcColumn ToIfc(this Column column, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcColumn = new IfcColumn(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, shape, null); return(ifcColumn); }
private static IfcBeam ToIfc(this Beam beam, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcBeam = new IfcBeam(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, shape, null); return(ifcBeam); }
private static IfcWall ToIfc(this Wall wall, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcWall = new IfcWall(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, wall.Name, null, null, localPlacement, shape, null); return(ifcWall); }
// TODO: There is a lot of duplicate code used to create products. // Can we make a generic method like ToIfc<TProduct>()? There are // exceptions for which this won't work like IfcSpace. private static IfcSpace ToIfc(this Space space, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcSpace = new IfcSpace(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, shape, null, IfcElementCompositionEnum.ELEMENT, IfcInternalOrExternalEnum.NOTDEFINED, new IfcLengthMeasure(space.Transform.Origin.Z)); return(ifcSpace); }
private static IfcProductDefinitionShape ToIfcProductDefinitionShape(this List <IfcRepresentationItem> geoms, string shapeType, IfcRepresentationContext context, Document doc) { var rep = new IfcShapeRepresentation(context, "Body", shapeType, geoms); var shape = new IfcProductDefinitionShape(new List <IfcRepresentation> { rep }); doc.AddEntity(rep); return(shape); }
static void Main(string[] args) { var dbInitial = new DatabaseIfc(ModelView.Ifc4NotAssigned); dbInitial.Factory.Options.GenerateOwnerHistory = false; var site = new IfcSite(dbInitial, "site") { Guid = new Guid("aa4019f8-2584-44a1-a132-c17dfff69c41") }; var project = new IfcProject(dbInitial, "GeomRep") { Guid = new Guid("94d4ddac-9120-4fb9-bea0-7a414ee725d4") }; new IfcRelAggregates(project, new List <IfcObjectDefinition>() { site }) { Guid = new Guid("5e1fd0e5-b005-fe11-501e-5caff01dc1ad") }; IfcAxis2Placement3D placement1 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 2, 5, 1)); IfcLocalPlacement objectPlacement1 = new IfcLocalPlacement(site.ObjectPlacement, placement1); IfcAxis2Placement3D placement2 = new IfcAxis2Placement3D(new IfcCartesianPoint(dbInitial, 14, 5, 1)); IfcLocalPlacement objectPlacement2 = new IfcLocalPlacement(site.ObjectPlacement, placement2); var profile1 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 4, 6); IfcExtrudedAreaSolid extrudedAreaSolid1 = new IfcExtrudedAreaSolid(profile1, 1.35); IfcProductDefinitionShape shape1 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid1)); var profile2 = new IfcRectangleProfileDef(dbInitial, "rectangleProfileDef", 5, 8); IfcExtrudedAreaSolid extrudedAreaSolid2 = new IfcExtrudedAreaSolid(profile2, 4.1); IfcProductDefinitionShape shape2 = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrudedAreaSolid2)); var proxy1 = new IfcBuildingElementProxy(site, objectPlacement1, shape1) { Name = "Cuboid1", Guid = new Guid("fbc7f4b2-177d-4875-88bb-d3b44115bbaa") }; var proxy2 = new IfcBuildingElementProxy(site, objectPlacement2, shape2) { Name = "Cuboid2", Guid = new Guid("f8e196cb-c7d9-4d53-9885-0f687706727a") }; dbInitial.WriteFile("cube_double.ifc"); }
public ProductionDefinitionShape(IfcStore model, List <ShapeRepresentation> representations) { this.representations = representations; ifcProductionDefShape = model.Instances.New <IfcProductDefinitionShape>(s => { foreach (var rep in representations) { s.Representations.Add(rep.IfcShapeRepresenation); } } ); }
/// <summary> /// Returns first set of IFC representation items or null; /// </summary> public static IfcShapeRepresentation GetFirstShapeRepresentation(this IfcProduct prod) { IfcProductDefinitionShape definitionShape = prod.Representation as IfcProductDefinitionShape; if (definitionShape == null) { return(null); } IfcShapeRepresentation shapeRepresentation = definitionShape.Representations.FirstOrDefault() as IfcShapeRepresentation; return(shapeRepresentation); }
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); }
private IfcSlab CreateIfcLanding(IfcStore model, LinearPath landingPline, double landingThickness) { //begin a transaction using (var trans = model.BeginTransaction("Create Wall")) { IfcSlab landing = model.Instances.New <IfcSlab>(); IfcDirection extrusionDir = model.Instances.New <IfcDirection>(); extrusionDir.SetXYZ(0, 0, -1); //Create a Definition shape to hold the geometry of the Stair 3D body IfcShapeRepresentation shape = IFCHelper.ShapeRepresentationCreate(model, "SweptSolid", "Body"); IfcArbitraryClosedProfileDef stepProfile = IFCHelper.ArbitraryClosedProfileCreate(model, (landingPline.Vertices /*.Select(v => v * 1000)*/).ToList()); IfcExtrudedAreaSolid body = IFCHelper.ProfileSweptSolidCreate(model, landingThickness, stepProfile, extrusionDir); body.BodyPlacementSet(model, 0, 0, 0); shape.Items.Add(body); //Create a Product Definition and add the model geometry to the wall IfcProductDefinitionShape prDefShape = model.Instances.New <IfcProductDefinitionShape>(); prDefShape.Representations.Add(shape); landing.Representation = prDefShape; //Create Local axes system and assign it to the column IfcCartesianPoint location3D = model.Instances.New <IfcCartesianPoint>(); location3D.SetXYZ(0, 0, 0); //var uvColLongDir = MathHelper.UnitVectorPtFromPt1ToPt2(cadSlab.CenterPt, cadSlab.PtLengthDir); IfcDirection localXDir = model.Instances.New <IfcDirection>(); localXDir.SetXYZ(1, 0, 0); IfcDirection localZDir = model.Instances.New <IfcDirection>(); localZDir.SetXYZ(0, 0, 1); IfcAxis2Placement3D ax3D = IFCHelper.LocalAxesSystemCreate(model, location3D, localXDir, localZDir); //now place the slab into the model IfcLocalPlacement lp = IFCHelper.LocalPlacemetCreate(model, ax3D); landing.ObjectPlacement = lp; trans.Commit(); return(landing); } }
private static IfcProductDefinitionShape ToIfcProductDefinitionShape(this IfcGeometricRepresentationItem geom, IfcRepresentationContext context, Document doc) { var rep = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List <IfcRepresentationItem> { geom }); var shape = new IfcProductDefinitionShape(new List <IfcRepresentation> { rep }); doc.AddEntity(rep); return(shape); }
internal static IfcBeam createBeam(IfcProduct host, IfcProfileDef profile, IfcCartesianPoint cartesianPoint, string globalId) { DatabaseIfc db = host.Database; IfcAxis2Placement3D position = new IfcAxis2Placement3D(db.Factory.Origin, db.Factory.XAxis, db.Factory.YAxisNegative); IfcExtrudedAreaSolid extrudedAreaSolid = new IfcExtrudedAreaSolid(profile, position, 5000); IfcShapeRepresentation shapeRepresentation = new IfcShapeRepresentation(extrudedAreaSolid); IfcProductDefinitionShape productDefinitionShape = new IfcProductDefinitionShape(shapeRepresentation); IfcLocalPlacement localPlacement = createLocalPlacement(host, cartesianPoint, db.Factory.YAxis); IfcBeam beam = new IfcBeam(host, localPlacement, productDefinitionShape); setGlobalId(beam, globalId); return(beam); }
private static IfcWall ToIfc(this Wall wall, Guid id, IfcLocalPlacement localPlacement, IfcProductDefinitionShape shape) { var ifcWall = new IfcWall(IfcGuid.ToIfcGuid(id), null, wall.Name, null, null, localPlacement, shape, null, IfcWallTypeEnum.NOTDEFINED); return(ifcWall); }
static void Generate(TypeIFC type, ReleaseVersion release, string path) { DatabaseIfc db = new DatabaseIfc(true, release); IfcBuilding building = new IfcBuilding(db, "IfcBuilding") { }; IfcProject project = new IfcProject(building, "IfcProject", IfcUnitAssignment.Length.Millimetre) { }; IfcRectangleProfileDef rect = new IfcRectangleProfileDef(db, "Rect", 1000, 500); IfcExtrudedAreaSolid extrusion = new IfcExtrudedAreaSolid(rect, new IfcAxis2Placement3D(new IfcCartesianPoint(db, 0, 0, 0)), new IfcDirection(db, 0, 0, 1), 2000); IfcProductDefinitionShape rep = new IfcProductDefinitionShape(new IfcShapeRepresentation(extrusion)); if (type == TypeIFC.Chiller) { IfcChiller chiller = new IfcChiller(building, null, rep, null) { PredefinedType = IfcChillerTypeEnum.AIRCOOLED }; if (release == ReleaseVersion.IFC2x3) { chiller.RelatingType = new IfcChillerType(db, "MyChillerType", IfcChillerTypeEnum.AIRCOOLED); } } else if (type == TypeIFC.AirTerminal) { IfcAirTerminal terminal = new IfcAirTerminal(building, null, rep, null) { PredefinedType = IfcAirTerminalTypeEnum.DIFFUSER }; if (release == ReleaseVersion.IFC2x3) { terminal.RelatingType = new IfcAirTerminalType(db, "MyAirTerminalType", IfcAirTerminalTypeEnum.DIFFUSER); } } else { IfcElectricDistributionPoint point = new IfcElectricDistributionPoint(building, null, rep, null) { DistributionPointFunction = IfcElectricDistributionPointFunctionEnum.DISTRIBUTIONBOARD }; } db.WriteFile(Path.Combine(path, type.ToString() + " " + release.ToString() + ".ifc")); }
public BbSurfaceGeometry( BbPolyline2D outerCurve, IEnumerable <BbPolyline2D> innerCurves ) { ifcCurveBoundedPlane = new IfcCurveBoundedPlane { BasisSurface = new IfcPlane { Position = BbHeaderSetting.Setting3D.DefaultBbPosition3D.IfcAxis2Placement3D, }, OuterBoundary = outerCurve.IfcCurve, InnerBoundaries = new List <IfcCurve>() }; if (innerCurves != null) { foreach (var inn in innerCurves) { ifcCurveBoundedPlane.InnerBoundaries.Add(inn.IfcCurve); } } _ifcShapeRepresentation = new IfcShapeRepresentation { ContextOfItems = BbHeaderSetting.Setting3D.GeometricRepresentationContext, RepresentationIdentifier = "Surface", RepresentationType = "GeometricSet", Items = new List <IfcRepresentationItem>(), }; _ifcShapeRepresentation.Items.Add(ifcCurveBoundedPlane); _ifcProductDefinitionShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation); }
private static IfcBeam ToIfcBeam(this Beam beam, IfcRepresentationContext context, Document doc) { var sweptArea = beam.ElementType.Profile.Perimeter.ToIfcArbitraryClosedProfileDef(doc); var line = beam.Curve as Line; if (line == null) { throw new Exception("The beam could not be exported to IFC. Only linear beams are currently supported."); } // 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 = Vector3.ZAxis.ToIfcDirection(); var position = new Transform().ToIfcAxis2Placement3D(doc); var repItem = new IfcExtrudedAreaSolid(sweptArea, position, extrudeDirection, new IfcPositiveLengthMeasure(beam.Curve.Length())); var localPlacement = beam.Curve.TransformAt(0.0).ToIfcLocalPlacement(doc); var rep = new IfcShapeRepresentation(context, "Body", "SweptSolid", new List <IfcRepresentationItem> { repItem }); var productRep = new IfcProductDefinitionShape(new List <IfcRepresentation> { rep }); var ifcBeam = new IfcBeam(IfcGuid.ToIfcGuid(Guid.NewGuid()), null, null, null, null, localPlacement, productRep, null); doc.AddEntity(sweptArea); doc.AddEntity(extrudeDirection); doc.AddEntity(position); doc.AddEntity(repItem); doc.AddEntity(rep); doc.AddEntity(localPlacement); doc.AddEntity(productRep); doc.AddEntity(ifcBeam); return(ifcBeam); }
public BbBRepGeometry( IList <BbFace> faces ) { var _faces = new List <IfcFace> (); foreach (var item in faces) { _faces.Add(item.IfcFace); } ifcFacetedBrep = new IfcFacetedBrep { Outer = new IfcClosedShell { CfsFaces = _faces, }, // SweptArea = profile.IfcProfileDef, // Position = position3D.IfcAxis2Placement3D, // ExtrudedDirection = direction3D.IfcDirection, // Depth = depth, }; _ifcShapeRepresentation = new IfcShapeRepresentation { ContextOfItems = BbHeaderSetting.Setting3D.GeometricRepresentationContext, RepresentationIdentifier = "Body", RepresentationType = "Brep", Items = new List <IfcRepresentationItem>(), }; _ifcShapeRepresentation.Items.Add(ifcFacetedBrep); _ifcProductDefinitionShape = new IfcProductDefinitionShape { // Name= // Description = Representations = new List <IfcRepresentation>(), }; _ifcProductDefinitionShape.Representations.Add(_ifcShapeRepresentation); }