BIM: NativeIFC 2D support - section planes

This commit is contained in:
Yorik van Havre
2024-09-30 14:58:11 +02:00
committed by Yorik van Havre
parent c0d452f6c5
commit 14585a760e
9 changed files with 240 additions and 48 deletions

View File

@@ -427,7 +427,7 @@ def get_svg(obj,
# all the SVG strings from the contents of the group
if hasattr(obj, "isDerivedFrom"):
if (obj.isDerivedFrom("App::DocumentObjectGroup")
or utils.get_type(obj) in ["Layer", "BuildingPart"]
or utils.get_type(obj) in ["Layer", "BuildingPart", "IfcGroup"]
or obj.isDerivedFrom("App::LinkGroup")
or (obj.isDerivedFrom("App::Link")
and obj.LinkedObject.isDerivedFrom("App::DocumentObjectGroup"))):
@@ -546,7 +546,8 @@ def get_svg(obj,
svg = _svg_shape(svg, obj, plane,
fillstyle, pathdata, stroke, linewidth, lstyle)
elif utils.get_type(obj) in ["Dimension", "LinearDimension"]:
elif (utils.get_type(obj) in ["Dimension", "LinearDimension"]
or (utils.get_type(obj) == "IfcAnnotation" and obj.ObjectType == "DIMENSION")):
svg = _svg_dimension(obj, plane, scale, linewidth, fontsize,
stroke, tstroke, pointratio, techdraw, rotation)
@@ -690,7 +691,8 @@ def get_svg(obj,
rotation, position, text,
linespacing, justification)
elif utils.get_type(obj) in ["Annotation", "DraftText", "Text"]:
elif (utils.get_type(obj) in ["Annotation", "DraftText", "Text"]
or (utils.get_type(obj) == "IfcAnnotation" and obj.ObjectType == "TEXT")):
# returns an svg representation of a document annotation
if not App.GuiUp:
_wrn("Export of texts to SVG is only available in GUI mode")

View File

@@ -213,11 +213,15 @@ class Shape2DView(DraftObject):
import DraftGeomUtils
pl = obj.Placement
if obj.Base:
if utils.get_type(obj.Base) in ["BuildingPart","SectionPlane"]:
if utils.get_type(obj.Base) in ["BuildingPart","SectionPlane","IfcAnnotation"]:
objs = []
if utils.get_type(obj.Base) == "SectionPlane":
objs = self.excludeNames(obj,obj.Base.Objects)
cutplane = obj.Base.Shape
elif utils.get_type(obj.Base) == "IfcAnnotation":
# this is a NativeIFC section plane
objs, cutplane = obj.Base.Proxy.get_section_data(obj.Base)
objs = self.excludeNames(obj, objs)
else:
objs = self.excludeNames(obj,obj.Base.Group)
cutplane = Part.makePlane(1000, 1000, App.Vector(-500, -500, 0))