@@ -1119,7 +1119,17 @@ private static IFCAnyHandle CreateEdgeCurveFromCurve(IFCFile file, ExporterIFC e
1119
1119
bool sameSense , IDictionary < IFCFuzzyXYZ , IFCAnyHandle > cartesianPoints )
1120
1120
{
1121
1121
bool allowAdvancedCurve = ExporterCacheManager . ExportOptionsCache . ExportAs4 ;
1122
- IFCAnyHandle baseCurve = GeometryUtil . CreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints ) ;
1122
+
1123
+ IFCAnyHandle baseCurve ;
1124
+ try
1125
+ {
1126
+ baseCurve = GeometryUtil . CreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints ) ;
1127
+
1128
+ }
1129
+ catch
1130
+ {
1131
+ baseCurve = GeometryUtil . OutdatedCreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints ) ;
1132
+ }
1123
1133
1124
1134
if ( IFCAnyHandleUtil . IsNullOrHasNoValue ( baseCurve ) )
1125
1135
return null ;
@@ -1132,7 +1142,17 @@ private static IFCAnyHandle CreateProfileCurveFromCurve(IFCFile file, ExporterIF
1132
1142
IDictionary < IFCFuzzyXYZ , IFCAnyHandle > cartesianPoints , Transform additionalTrf = null )
1133
1143
{
1134
1144
bool allowAdvancedCurve = ExporterCacheManager . ExportOptionsCache . ExportAs4 ;
1135
- IFCAnyHandle ifcCurve = GeometryUtil . CreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints , additionalTrf ) ;
1145
+
1146
+ IFCAnyHandle ifcCurve ;
1147
+ try
1148
+ {
1149
+ ifcCurve = GeometryUtil . CreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints , additionalTrf ) ;
1150
+ }
1151
+ catch
1152
+ {
1153
+ ifcCurve = GeometryUtil . OutdatedCreateIFCCurveFromRevitCurve ( file , exporterIFC , curve , allowAdvancedCurve , cartesianPoints , additionalTrf ) ;
1154
+ }
1155
+
1136
1156
IFCAnyHandle sweptCurve = null ;
1137
1157
1138
1158
bool isBound = false ;
@@ -2677,7 +2697,8 @@ private static BodyData ExportBodyAsBRep(ExporterIFC exporterIFC, IList<Geometry
2677
2697
{
2678
2698
currentFaceHashSetList . Add ( facetHnds ) ;
2679
2699
alreadyExported = true ;
2680
- bodyData . AddRepresentationItemInfo ( document , geomObject , materialId , sweptSolidExporter . RepresentationItem ) ;
2700
+ GraphicsStyle style = document . GetElement ( geomObject . GraphicsStyleId ) as GraphicsStyle ;
2701
+ bodyData . AddRepresentationItemInfo ( document , style , materialId , sweptSolidExporter . RepresentationItem ) ;
2681
2702
}
2682
2703
}
2683
2704
@@ -2691,7 +2712,8 @@ private static BodyData ExportBodyAsBRep(ExporterIFC exporterIFC, IList<Geometry
2691
2712
alreadyExported = true ;
2692
2713
hasAdvancedBrepGeometry = true ;
2693
2714
CreateSurfaceStyleForRepItem ( exporterIFC , document , options . CreatingVoid , advancedBrepBodyItem , materialId ) ;
2694
- bodyData . AddRepresentationItemInfo ( document , geomObject , materialId , advancedBrepBodyItem ) ;
2715
+ GraphicsStyle style = document . GetElement ( geomObject . GraphicsStyleId ) as GraphicsStyle ;
2716
+ bodyData . AddRepresentationItemInfo ( document , style , materialId , advancedBrepBodyItem ) ;
2695
2717
}
2696
2718
}
2697
2719
@@ -2704,10 +2726,11 @@ private static BodyData ExportBodyAsBRep(ExporterIFC exporterIFC, IList<Geometry
2704
2726
IList < IFCAnyHandle > triangulatedBodyItems = ExportBodyAsTessellatedFaceSet ( exporterIFC , element , options , geomObject , trfToUse ) ;
2705
2727
if ( triangulatedBodyItems != null && triangulatedBodyItems . Count > 0 )
2706
2728
{
2729
+ GraphicsStyle style = document . GetElement ( geomObject . GraphicsStyleId ) as GraphicsStyle ;
2707
2730
foreach ( IFCAnyHandle triangulatedBodyItem in triangulatedBodyItems )
2708
2731
{
2709
2732
bodyItems . Add ( triangulatedBodyItem ) ;
2710
- bodyData . AddRepresentationItemInfo ( document , geomObject , materialId , triangulatedBodyItem ) ;
2733
+ bodyData . AddRepresentationItemInfo ( document , style , materialId , triangulatedBodyItem ) ;
2711
2734
}
2712
2735
alreadyExported = true ;
2713
2736
hasTriangulatedGeometry = true ;
@@ -2821,21 +2844,26 @@ private static BodyData ExportBodyAsBRep(ExporterIFC exporterIFC, IList<Geometry
2821
2844
int size = currentFaceHashSetList . Count ;
2822
2845
if ( exportAsBReps )
2823
2846
{
2824
- int matToUse = - 1 ;
2847
+ int brepIndex = - 1 ;
2848
+ ElementId currMatId = ElementId . InvalidElementId ;
2849
+ GraphicsStyle currStyle = null ;
2825
2850
for ( int ii = 0 ; ii < size ; ii ++ )
2826
2851
{
2827
- if ( startIndexForObject [ matToUse + 1 ] == ii )
2828
- matToUse ++ ;
2852
+ if ( startIndexForObject [ brepIndex + 1 ] == ii )
2853
+ {
2854
+ brepIndex ++ ;
2855
+ currMatId = materialIds [ brepIndex ] ;
2856
+ currStyle = document . GetElement ( splitGeometryList [ brepIndex ] . GraphicsStyleId ) as GraphicsStyle ;
2857
+ }
2829
2858
HashSet < IFCAnyHandle > currentFaceHashSet = currentFaceHashSetList [ ii ] ;
2830
- ElementId currMatId = materialIds [ matToUse ] ;
2831
-
2832
2859
IFCAnyHandle faceOuter = IFCInstanceExporter . CreateClosedShell ( file , currentFaceHashSet ) ;
2833
2860
IFCAnyHandle brepHnd = RepresentationUtil . CreateFacetedBRep ( exporterIFC , document ,
2834
2861
options . CreatingVoid , faceOuter , currMatId ) ;
2835
2862
2836
2863
if ( ! IFCAnyHandleUtil . IsNullOrHasNoValue ( brepHnd ) )
2837
2864
{
2838
2865
bodyItems . Add ( brepHnd ) ;
2866
+ bodyData . AddRepresentationItemInfo ( document , currStyle , currMatId , brepHnd ) ;
2839
2867
}
2840
2868
}
2841
2869
}
@@ -3123,7 +3151,8 @@ public static BodyData ExportBody(ExporterIFC exporterIFC,
3123
3151
materialIdsForExtrusions . Add ( matId ) ;
3124
3152
if ( matId != ElementId . InvalidElementId )
3125
3153
{
3126
- bodyData . AddRepresentationItemInfo ( document , geometryList [ 0 ] , matId , extrusionData . BaseRepresentationItems [ 0 ] ) ;
3154
+ GraphicsStyle style = document . GetElement ( geometryList [ 0 ] . GraphicsStyleId ) as GraphicsStyle ;
3155
+ bodyData . AddRepresentationItemInfo ( document , style , matId , extrusionData . BaseRepresentationItems [ 0 ] ) ;
3127
3156
}
3128
3157
bodyData . RepresentationHnd = extrusionData . Handle ;
3129
3158
bodyData . ShapeRepresentationType = extrusionData . ShapeRepresentationType ;
@@ -3308,7 +3337,9 @@ public static BodyData ExportBody(ExporterIFC exporterIFC,
3308
3337
}
3309
3338
exportedAsExtrusion = true ;
3310
3339
hasExtrusions = true ;
3311
- bodyData . AddRepresentationItemInfo ( document , geometryList [ geomIndex ] , matId , extrusionHandle ) ;
3340
+ GraphicsStyle style = document . GetElement ( geometryList [ geomIndex ] . GraphicsStyleId ) as GraphicsStyle ;
3341
+
3342
+ bodyData . AddRepresentationItemInfo ( document , style , matId , extrusionHandle ) ;
3312
3343
}
3313
3344
}
3314
3345
@@ -3363,7 +3394,8 @@ public static BodyData ExportBody(ExporterIFC exporterIFC,
3363
3394
bodyItems . Add ( sweptHandle ) ;
3364
3395
ElementId matId = exporterIFC . GetMaterialIdForCurrentExportState ( ) ;
3365
3396
materialIdsForExtrusions . Add ( matId ) ;
3366
- bodyData . AddRepresentationItemInfo ( document , solid , matId , sweptHandle ) ;
3397
+ GraphicsStyle style = document . GetElement ( solid . GraphicsStyleId ) as GraphicsStyle ;
3398
+ bodyData . AddRepresentationItemInfo ( document , style , matId , sweptHandle ) ;
3367
3399
exported = true ;
3368
3400
hasRepresentationType = sweptSolidExporter . RepresentationType ;
3369
3401
0 commit comments