public static IFCTopologicalRepresentationItem ProcessIFCTopologicalRepresentationItem(IFCAnyHandle ifcTopologicalRepresentationItem) { if (IFCAnyHandleUtil.IsSubTypeOf(ifcTopologicalRepresentationItem, IFCEntityType.IfcConnectedFaceSet)) { return(IFCConnectedFaceSet.ProcessIFCConnectedFaceSet(ifcTopologicalRepresentationItem)); } if (IFCAnyHandleUtil.IsSubTypeOf(ifcTopologicalRepresentationItem, IFCEntityType.IfcEdge)) { return(IFCEdge.ProcessIFCEdge(ifcTopologicalRepresentationItem)); } if (IFCAnyHandleUtil.IsSubTypeOf(ifcTopologicalRepresentationItem, IFCEntityType.IfcFace)) { return(IFCFace.ProcessIFCFace(ifcTopologicalRepresentationItem)); } if (IFCAnyHandleUtil.IsSubTypeOf(ifcTopologicalRepresentationItem, IFCEntityType.IfcLoop)) { return(IFCLoop.ProcessIFCLoop(ifcTopologicalRepresentationItem)); } if (IFCAnyHandleUtil.IsSubTypeOf(ifcTopologicalRepresentationItem, IFCEntityType.IfcVertex)) { return(IFCVertex.ProcessIFCVertex(ifcTopologicalRepresentationItem)); } Importer.TheLog.LogUnhandledSubTypeError(ifcTopologicalRepresentationItem, IFCEntityType.IfcTopologicalRepresentationItem, true); return(null); }
/// <summary> /// Create an IFCEdge object from a handle of type IfcEdge /// </summary> /// <param name="ifcEdge">The IFC handle</param> /// <returns>The IfcEdge object</returns> public static IFCEdge ProcessIFCEdge(IFCAnyHandle ifcEdge) { if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcEdge)) { Importer.TheLog.LogNullError(IFCEntityType.IfcEdge); return(null); } if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcEdge, IFCEntityType.IfcOrientedEdge)) { return(IFCOrientedEdge.ProcessIFCOrientedEdge(ifcEdge)); } if (IFCAnyHandleUtil.IsValidSubTypeOf(ifcEdge, IFCEntityType.IfcEdgeCurve)) { return(IFCEdgeCurve.ProcessIFCEdgeCurve(ifcEdge)); } IFCEntity edge; if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcEdge.StepId, out edge)) { edge = new IFCEdge(ifcEdge); } return(edge as IFCEdge); }
override protected void Process(IFCAnyHandle ifcOrientedEdge) { base.Process(ifcOrientedEdge); IFCAnyHandle edgeElement = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcOrientedEdge, "EdgeElement", true); EdgeElement = IFCEdge.ProcessIFCEdge(edgeElement); bool found = false; bool orientation = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcOrientedEdge, "Orientation", out found); if (found) Orientation = orientation; else { Importer.TheLog.LogWarning(ifcOrientedEdge.StepId, "Cannot find Orientation attribute, defaulting to true", false); Orientation = true; } }
override protected void Process(IFCAnyHandle ifcOrientedEdge) { base.Process(ifcOrientedEdge); IFCAnyHandle edgeElement = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcOrientedEdge, "EdgeElement", true); EdgeElement = IFCEdge.ProcessIFCEdge(edgeElement); bool found = false; bool orientation = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcOrientedEdge, "Orientation", out found); if (found) { Orientation = orientation; } else { Importer.TheLog.LogWarning(ifcOrientedEdge.StepId, "Cannot find Orientation attribute, defaulting to true", false); Orientation = true; } }
override protected void Process(IFCAnyHandle ifcOrientedEdge) { base.Process(ifcOrientedEdge); IFCAnyHandle edgeElement = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcOrientedEdge, "EdgeElement", true); EdgeElement = IFCEdge.ProcessIFCEdge(edgeElement); bool found = false; bool orientation = IFCImportHandleUtil.GetRequiredBooleanAttribute(ifcOrientedEdge, "Orientation", out found); if (found) { Orientation = orientation; } else { Importer.TheLog.LogWarning(ifcOrientedEdge.StepId, "Cannot find Orientation attribute, defaulting to true", false); Orientation = true; } // ODA Toolkit doesn't support derived attributes. Set EdgeStart and EdgeEnd // if they haven't been set. if (EdgeStart == null) { EdgeStart = Orientation ? EdgeElement.EdgeStart : EdgeElement.EdgeEnd; if (EdgeStart == null) { Importer.TheLog.LogError(ifcOrientedEdge.StepId, "Cannot find the starting vertex", true); } } if (EdgeEnd == null) { EdgeEnd = Orientation ? EdgeElement.EdgeEnd : EdgeElement.EdgeStart; if (EdgeEnd == null) { Importer.TheLog.LogError(ifcOrientedEdge.StepId, "Cannot find the ending vertex", true); } } }
protected override void CreateShapeInternal(IFCImportShapeEditScope shapeEditScope, Transform lcs, Transform scaledLcs, string guid) { if (shapeEditScope.BuilderType == IFCShapeBuilderType.BrepBuilder) { if (shapeEditScope.BuilderScope == null) { throw new InvalidOperationException("BuilderScope hasn't been initialized yet"); } BrepBuilderScope brepBuilderScope = shapeEditScope.BuilderScope as BrepBuilderScope; if (brepBuilderScope == null) { throw new InvalidOperationException("The wrong BuilderScope is created"); } foreach (IFCOrientedEdge edge in EdgeList) { if (edge == null || edge.EdgeStart == null || edge.EdgeEnd == null) { Importer.TheLog.LogError(Id, "Invalid edge loop", true); return; } edge.CreateShape(shapeEditScope, lcs, scaledLcs, guid); if (lcs == null) { lcs = Transform.Identity; } IFCEdge edgeElement = edge.EdgeElement; Curve edgeGeometry = null; if (edgeElement is IFCEdgeCurve) { edgeGeometry = edgeElement.GetGeometry(); } else { //TODO: find a way to get the edgegeometry here edgeGeometry = null; } if (edgeGeometry == null) { Importer.TheLog.LogError(edgeElement.Id, "Cannot get the edge geometry of this edge", true); } XYZ edgeStart = edgeElement.EdgeStart.GetCoordinate(); XYZ edgeEnd = edgeElement.EdgeEnd.GetCoordinate(); if (edgeStart == null || edgeEnd == null) { Importer.TheLog.LogError(Id, "Invalid start or end vertices", true); } bool orientation = lcs.HasReflection ? !edge.Orientation : edge.Orientation; if (!brepBuilderScope.AddOrientedEdgeToTheBoundary(edgeElement.Id, edgeGeometry.CreateTransformed(lcs), lcs.OfPoint(edgeStart), lcs.OfPoint(edgeEnd), edge.Orientation)) { Importer.TheLog.LogWarning(edge.Id, "Cannot add this edge to the edge loop with Id: " + Id, false); IsValidForCreation = false; return; } } } else { Importer.TheLog.LogError(Id, "Unsupported IFCEdgeLoop", true); } base.CreateShapeInternal(shapeEditScope, lcs, scaledLcs, guid); }
/// <summary> /// Create an IFCEdge object from a handle of type IfcEdge /// </summary> /// <param name="ifcEdge">The IFC handle</param> /// <returns>The IfcEdge object</returns> public static IFCEdge ProcessIFCEdge(IFCAnyHandle ifcEdge) { if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcEdge)) { Importer.TheLog.LogNullError(IFCEntityType.IfcEdge); return null; } if (IFCAnyHandleUtil.IsSubTypeOf(ifcEdge, IFCEntityType.IfcOrientedEdge)) return IFCOrientedEdge.ProcessIFCOrientedEdge(ifcEdge); if (IFCAnyHandleUtil.IsSubTypeOf(ifcEdge, IFCEntityType.IfcEdgeCurve)) return IFCEdgeCurve.ProcessIFCEdgeCurve(ifcEdge); IFCEntity edge; if (!IFCImportFile.TheFile.EntityMap.TryGetValue(ifcEdge.StepId, out edge)) edge = new IFCEdge(ifcEdge); return (edge as IFCEdge); }