Arch: added IFC export preference option to choose triangulation style for non-planar shapes
This commit is contained in:
@@ -314,6 +314,26 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="Gui::PrefCheckBox" name="checkBox_4">
|
||||
<property name="toolTip">
|
||||
<string>Curved shapes that cannot be represented as curves in IFC are decomposed into flat facets. If this is checked, simple triangulation will be used, otherwise some additional calculation is done to join coplanar facets.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use classic triangulation</string>
|
||||
</property>
|
||||
<property name="prefEntry" stdset="0">
|
||||
<cstring>ifcClassicTriangulation</cstring>
|
||||
</property>
|
||||
<property name="prefPath" stdset="0">
|
||||
<cstring>Mod/Arch</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -1175,6 +1175,7 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
|
||||
fcsolid.scale(0.001) # to meters
|
||||
faces = []
|
||||
curves = False
|
||||
shapetype = "brep"
|
||||
for fcface in fcsolid.Faces:
|
||||
for e in fcface.Edges:
|
||||
if not isinstance(e.Curve,Part.Line):
|
||||
@@ -1182,17 +1183,19 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
|
||||
curves = True
|
||||
break
|
||||
if curves:
|
||||
#shapetype = "triangulated"
|
||||
#tris = fcsolid.tessellate(tessellation)
|
||||
#for tri in tris[1]:
|
||||
# pts = [ifcfile.createIfcCartesianPoint(tuple(tris[0][i])) for i in tri]
|
||||
# loop = ifcfile.createIfcPolyLoop(pts)
|
||||
# bound = ifcfile.createIfcFaceOuterBound(loop,True)
|
||||
# face = ifcfile.createIfcFace([bound])
|
||||
# faces.append(face)
|
||||
fcsolid = Arch.removeCurves(fcsolid)
|
||||
|
||||
shapetype = "brep"
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("ifcClassicTriangulation",False):
|
||||
shapetype = "triangulated"
|
||||
tris = fcsolid.tessellate(tessellation)
|
||||
for tri in tris[1]:
|
||||
pts = [ifcfile.createIfcCartesianPoint(tuple(tris[0][i])) for i in tri]
|
||||
loop = ifcfile.createIfcPolyLoop(pts)
|
||||
bound = ifcfile.createIfcFaceOuterBound(loop,True)
|
||||
face = ifcfile.createIfcFace([bound])
|
||||
faces.append(face)
|
||||
fcsolid = Part.Shape() # empty shape so below code is not executed
|
||||
else:
|
||||
fcsolid = Arch.removeCurves(fcsolid)
|
||||
|
||||
for fcface in fcsolid.Faces:
|
||||
loops = []
|
||||
verts = [v.Point for v in Part.Wire(Part.__sortEdges__(fcface.OuterWire.Edges)).Vertexes]
|
||||
@@ -1220,9 +1223,10 @@ def getRepresentation(ifcfile,context,obj,forcebrep=False,subtraction=False,tess
|
||||
face = ifcfile.createIfcFace(loops)
|
||||
faces.append(face)
|
||||
|
||||
shell = ifcfile.createIfcClosedShell(faces)
|
||||
shape = ifcfile.createIfcFacetedBrep(shell)
|
||||
shapes.append(shape)
|
||||
if faces:
|
||||
shell = ifcfile.createIfcClosedShell(faces)
|
||||
shape = ifcfile.createIfcFacetedBrep(shell)
|
||||
shapes.append(shape)
|
||||
|
||||
if shapes:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user