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); } } } } } } }
static void Main(string[] args) { DatabaseIfc db = new DatabaseIfc(Console.In); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement; List <IfcBuildingElement> elements = project.Extract <IfcBuildingElement>(); List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuildingElement element in elements) { List <IfcRepresentation> reps = element.Representation.Representations; foreach (IfcRepresentation rep in reps) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { List <IfcRepresentationItem> items = sr.Items; foreach (IfcRepresentationItem item in items) { IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); } } } } } }
private void openFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ifc|*.ifc"; ofd.ShowDialog(); DatabaseIfc db = new DatabaseIfc(ofd.FileName); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement; List <IfcBuildingElement> elements = project.Extract <IfcBuildingElement>(); List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuildingElement element in elements) { //outputLabel.Content += element.Name+ "\n"; IfcProductRepresentation representation = element.Representation; if (representation != null) { foreach (IfcRepresentation rep in representation.Representations) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { foreach (IfcRepresentationItem item in sr.Items) { Debug.WriteLine(item.GetType()); IfcFacetedBrep fb = item as IfcFacetedBrep; if (fb != null) { breps.Add(fb); outputLabel.Content += fb + "\n"; /// Each IfcFacetedBrep has one IfcClosedShell called "Outer". /// IfcClosedShell has several IfcFaces called CfsFaces //foreach (var face in fb.Outer.CfsFaces) //{ // /// IfcFace has several IfcFaceOuterBounds called bounds // foreach(var bound in face.Bounds) // { // /// Each IfcFaceOuterBound inherited from IfcFacetedBrep has IfcPolyLoop // var loop = bound.Bound as IfcPolyloop; // if(loop != null) // { // foreach(var point in loop.Polygon) // { // //point.Coordinates; // outputLabel.Content += point.Coordinates + "\n"; // } // } // } //} //outputLabel.Content += fb.ToString() + "\n"; } } } } } } }
public override void Parse(int propIndex, IPropertyValue value, int[] nestedIndex) { switch (propIndex) { case 0: case 1: case 2: case 3: base.Parse(propIndex, value, nestedIndex); return; case 4: _relatedElements.InternalAdd((IfcProduct)value.EntityVal); return; case 5: _relatingStructure = (IfcSpatialElement)(value.EntityVal); return; default: throw new XbimParserException(string.Format("Attribute index {0} is out of range for {1}", propIndex + 1, GetType().Name.ToUpper())); } }
private void openFileButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "ifc|*.ifc"; ofd.ShowDialog(); DatabaseIfc db = new DatabaseIfc(ofd.FileName); IfcProject project = db.Project; IfcSpatialElement rootElement = project.RootElement; List <IfcBuildingElement> elements = project.Extract <IfcBuildingElement>(); List <IfcFacetedBrep> breps = new List <IfcFacetedBrep>(); foreach (IfcBuildingElement element in elements) { //outputLabel.Content += element.Name+ "\n"; IfcProductRepresentation representation = element.Representation; if (representation != null) { foreach (IfcRepresentation rep in representation.Representations) { IfcShapeRepresentation sr = rep as IfcShapeRepresentation; if (sr != null) { foreach (IfcRepresentationItem item in sr.Items) { var ifcTopologicalRepItem = item as IfcTopologicalRepresentationItem; var ifcGeometricRepItem = item as IfcGeometricRepresentationItem; var ifcMappedItem = item as IfcMappedItem; var ifcStyledItem = item as IfcStyledItem; if (ifcTopologicalRepItem != null) { var ifcConnectedFaceSet = ifcTopologicalRepItem as IfcConnectedFaceSet; var ifcEdge = ifcTopologicalRepItem as IfcEdge; var ifcFace = ifcTopologicalRepItem as IfcFace; var ifcFaceBound = ifcTopologicalRepItem as IfcFaceBound; var ifcPath = ifcTopologicalRepItem as IfcPath; var ifcVertex = ifcTopologicalRepItem as IfcVertex; var ifcLoop = ifcTopologicalRepItem as IfcLoop; } else if (ifcGeometricRepItem != null) { var ifcCompositeCurveSegment = ifcGeometricRepItem as IfcCompositeCurveSegment; var ifcCurve = ifcGeometricRepItem as IfcCurve; var ifcDirection = ifcGeometricRepItem as IfcDirection; var ifcPlacement = ifcGeometricRepItem as IfcPlacement; var ifcPoint = ifcGeometricRepItem as IfcPoint; var ifcSurface = ifcGeometricRepItem as IfcSurface; var ifcVector = ifcGeometricRepItem as IfcVector; var ifcBooleanResult = ifcGeometricRepItem as IfcBooleanResult; var ifcSolidModel = ifcGeometricRepItem as IfcSolidModel; var ifcHalfSpaceSolid = ifcGeometricRepItem as IfcHalfSpaceSolid; var ifcBoundingBox = ifcGeometricRepItem as IfcBoundingBox; var ifcCartesianTransformationOperator = ifcGeometricRepItem as IfcCartesianTransformationOperator; var ifcSectionedSpine = ifcGeometricRepItem as IfcSectionedSpine; var ifcGeometricSet = ifcGeometricRepItem as IfcGeometricSet; var ifcFaceBasedSurfaceModel = ifcGeometricRepItem as IfcFaceBasedSurfaceModel; var ifcShellBasedSurfaceModel = ifcGeometricRepItem as IfcShellBasedSurfaceModel; } else if (ifcMappedItem != null) { var mapSource = ifcMappedItem.MappingSource; var mapTarget = ifcMappedItem.MappingTarget; foreach (var mappedItem in mapSource.MappedRepresentation.Items) { var itm = mappedItem as IfcExtrudedAreaSolid; Debug.WriteLine(itm.Depth); Debug.WriteLine(itm.SweptArea.ProfileName); } } else if (ifcStyledItem != null) { } } } } } } }
public static IfcRelContainedInSpatialStructure NewIfc4Contains(this IModel s, IfcSpatialElement spatialElement) { var relation = spatialElement.ContainsElements.FirstOrDefault(); if (null == relation) { relation = s.Instances.New <IfcRelContainedInSpatialStructure>(); } relation.RelatingStructure = spatialElement; return(relation); }