Skip to content

Commit

Permalink
Implementing compatibility for the format IFC4
Browse files Browse the repository at this point in the history
  • Loading branch information
o-babii committed Oct 11, 2021
1 parent 3c78986 commit fbaae07
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 465 deletions.
38 changes: 2 additions & 36 deletions Source/Revit.IFC.Export/Toolkit/IFCInstanceExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3925,7 +3925,7 @@ public static IFCData CreateArcIndexType(IFCFile file, IList<int> arcIndexList)
return arcIndexData;
}

public static IFCAnyHandle CreateIndexedPolyCurve(IFCFile file, IFCAnyHandle coordinates, IList<GeometryUtil.SegmentIndices> segmentIndexList, bool? selfIntersect)
public static IFCAnyHandle CreateIndexedPolyCurve(IFCFile file, IFCAnyHandle coordinates, IList<IList<int>> segmentIndexList, bool? selfIntersect)
{
if (coordinates == null)
throw new ArgumentNullException("Points");
Expand All @@ -3936,41 +3936,7 @@ public static IFCAnyHandle CreateIndexedPolyCurve(IFCFile file, IFCAnyHandle coo
IFCAnyHandle indexedPolyCurveHnd = CreateInstance(file, IFCEntityType.IfcIndexedPolyCurve, null);
IFCAnyHandleUtil.SetAttribute(indexedPolyCurveHnd, "Points", coordinates);
if (segmentIndexList != null)
{
IFCAggregate segments = indexedPolyCurveHnd.CreateAggregateAttribute("Segments");
foreach (GeometryUtil.SegmentIndices segmentIndices in segmentIndexList)
{
if(segmentIndices.IsCalculated == false)
throw new ArgumentNullException("Segments");

IFCData segment = null;

var polyLineIndices = segmentIndices as GeometryUtil.PolyLineIndices;
if (polyLineIndices != null)
{
segment = segments.CreateValueOfType("IfcLineIndex");

IFCAggregate lineIndexAggr = segment.AsAggregate();
foreach (int index in polyLineIndices.Indices)
lineIndexAggr.Add(IFCData.CreateInteger(index));
}
else
{
var arcIndices = segmentIndices as GeometryUtil.ArcIndices;
if (arcIndices != null)
{
segment = segments.CreateValueOfType("IfcArcIndex");

IFCAggregate arcIndexAggr = segment.AsAggregate();
arcIndexAggr.Add(IFCData.CreateInteger(arcIndices.Start));
arcIndexAggr.Add(IFCData.CreateInteger(arcIndices.Mid));
arcIndexAggr.Add(IFCData.CreateInteger(arcIndices.End));
}
}
segments.Add(segment);
}
}

IFCAnyHandleUtil.SetAttribute(indexedPolyCurveHnd, "Segments", segmentIndexList, 1, null, 2, null);
IFCAnyHandleUtil.SetAttribute(indexedPolyCurveHnd, "SelfIntersect", selfIntersect);

return indexedPolyCurveHnd;
Expand Down
Loading

0 comments on commit fbaae07

Please sign in to comment.