Merge pull request #9738 from yorikvanhavre/arch-nativeifc-provisions

Arch nativeifc provisions
This commit is contained in:
Yorik van Havre
2023-06-19 10:46:51 +02:00
committed by GitHub
3 changed files with 40 additions and 33 deletions

View File

@@ -2368,7 +2368,7 @@ def getRepresentation(
placement = ifcbin.createIfcLocalPlacement()
representation = [ifcfile.createIfcShapeRepresentation(context,'Body',solidType,shapes)]
# additional representations?
if Draft.getType(obj) in ["Wall"]:
if Draft.getType(obj) in ["Wall","Structure"]:
addrepr = createAxis(ifcfile,obj,preferences)
if addrepr:
representation = representation + [addrepr]
@@ -2477,9 +2477,14 @@ def getAxisContext(ifcfile):
def createAxis(ifcfile,obj,preferences):
"""Creates an axis for a given wall, if applicable"""
if hasattr(obj,"Base") and hasattr(obj.Base,"Shape") and obj.Base.Shape:
if obj.Base.Shape.ShapeType in ["Wire","Edge"]:
curve = createCurve(ifcfile,obj.Base.Shape,preferences["SCALE_FACTOR"])
shape = None
if getattr(obj,"Nodes",None):
shape = Part.makePolygon([obj.Placement.multVec(v) for v in obj.Nodes])
elif hasattr(obj,"Base") and hasattr(obj.Base,"Shape") and obj.Base.Shape:
shape = obj.Base.Shape
if shape:
if shape.ShapeType in ["Wire","Edge"]:
curve = createCurve(ifcfile,shape,preferences["SCALE_FACTOR"])
if curve:
ctx = getAxisContext(ifcfile)
axis = ifcfile.createIfcShapeRepresentation(ctx,'Axis','Curve2D',[curve])

View File

@@ -20,34 +20,29 @@
#* *
#***************************************************************************
"""This module contains placeholders for viewproviders provided by the NativeIFC addon"""
import FreeCAD
class ifc_vp_object:
"""NativeIFC class placeholder"""
def __init__(self):
pass
def attach(self, vobj):
return
def getDisplayModes(self, obj):
return []
def getDefaultDisplayMode(self):
return "FlatLines"
def setDisplayMode(self,mode):
return mode
def __getstate__(self):
return None
def __setstate__(self, state):
return None
class ifc_vp_document(ifc_vp_object):
class ifc_vp_document:
"""NativeIFC class placeholder"""
def __init__(self):
pass
def attach(self, vobj):
FreeCAD.Console.PrintWarning("Warning: Object "+vobj.Object.Label+" depends on the NativeIFC addon which is not installed, and will not display correctly in the 3D view\n")
FreeCAD.Console.PrintWarning("Warning: Object "+vobj.Object.Label+" depends on the NativeIFC addon which is not installed, and might not display correctly in the 3D view\n")
return
class ifc_vp_group:
"""NativeIFC class placeholder"""
def __init__(self):
pass
class ifc_vp_material:
"""NativeIFC class placeholder"""
def __init__(self):
pass