Draft: fixed obj.TypeId output after utils.get_type() change

.


.
This commit is contained in:
carlopav
2020-08-30 15:41:56 +02:00
committed by Yorik van Havre
parent e78b104a75
commit 41f81b2cff
4 changed files with 15 additions and 13 deletions

View File

@@ -165,7 +165,7 @@ def joinWalls(walls,delete=False):
if base.Base:
if base.Base.Shape.Faces:
return None
if Draft.getType(base.Base) == "Sketch":
if Draft.getType(base.Base) == "Sketcher::SketchObject":
sk = base.Base
else:
sk = Draft.makeSketch(base.Base,autoconstraints=True)
@@ -1017,7 +1017,7 @@ class _Wall(ArchComponent.Component):
if Draft.getType(obj.Base) == "Wire":
#print "modifying p2"
obj.Base.End = p2
elif Draft.getType(obj.Base) == "Sketch":
elif Draft.getType(obj.Base) == "Sketcher::SketchObject":
try:
obj.Base.movePoint(0,2,p2,0)
except:

View File

@@ -1015,15 +1015,17 @@ def export(exportList,filename):
# setting the IFC type
if hasattr(obj,"Role"):
ifctype = obj.Role.replace(" ","")
elif otype == "Foundation":
ifctype = "Footing"
elif otype == "Rebar":
ifctype = "ReinforcingBar"
elif otype == "Undefined":
ifctype = "BuildingElementProxy"
elif otype.startswith("Part::"):
ifctype = "BuildingElementProxy"
else:
ifctype = otype
if ifctype == "Foundation":
ifctype = "Footing"
elif ifctype == "Rebar":
ifctype = "ReinforcingBar"
elif ifctype in ["Part","Undefined"]:
ifctype = "BuildingElementProxy"
# getting the "Force BREP" flag
brepflag = False
if hasattr(obj,"IfcAttributes"):
@@ -1106,7 +1108,7 @@ def export(exportList,filename):
extra = [obj.Width.Value*scaling, obj.Height.Value*scaling]
elif otype == "Space":
extra = ["ELEMENT","INTERNAL",getIfcElevation(obj)]
elif otype == "Part":
elif otype.startswith("Part::"):
extra = ["ELEMENT"]
if not ifctype in supportedIfcTypes:
if DEBUG: print(" Type ",ifctype," is not supported yet. Exporting as IfcBuildingElementProxy instead")

View File

@@ -73,7 +73,7 @@ def offset(obj, delta, copy=False, bind=False, sym=False, occ=False):
newwire = None
delete = None
if utils.get_type(obj) in ["Sketch","Part"]:
if utils.get_type(obj).startswith("Part::") or utils.get_type(obj).startswith("Sketcher::"):
copy = True
print("the offset tool is currently unable to offset a non-Draft object directly - Creating a copy")

View File

@@ -446,11 +446,11 @@ class Snapper:
snaps.extend(self.snapToEndpoints(edge))
snaps.extend(self.snapToIntersection(edge))
elif Draft.getType(obj) == "Mesh":
elif Draft.getType(obj).startswith("Mesh::"):
# for meshes we only snap to vertices
snaps.extend(self.snapToEndpoints(obj.Mesh))
elif Draft.getType(obj) == "Points":
elif Draft.getType(obj).startswith("Points::"):
# for points we only snap to points
snaps.extend(self.snapToEndpoints(obj.Points))