Draft: Independence from BIM (#17444)
* Draft: Independence from BIM - follow-up of #17390 * Draft: More info in DXF importer if BIM not present
This commit is contained in:
@@ -72,32 +72,37 @@ def make_clone(obj, delta=None, forcedraft=False):
|
||||
cl.Label = prefix + obj[0].Label + " (2D)"
|
||||
elif (len(obj) == 1) and (hasattr(obj[0],"CloneOf") or (utils.get_type(obj[0]) == "BuildingPart")) and (not forcedraft):
|
||||
# arch objects can be clones
|
||||
import Arch
|
||||
if utils.get_type(obj[0]) == "BuildingPart":
|
||||
cl = Arch.makeComponent()
|
||||
try:
|
||||
import Arch
|
||||
except:
|
||||
# BIM not present
|
||||
pass
|
||||
else:
|
||||
try: # new-style make function
|
||||
cl = getattr(Arch, "make_" + obj[0].Proxy.Type.lower())()
|
||||
except Exception:
|
||||
try: # old-style make function
|
||||
cl = getattr(Arch, "make" + obj[0].Proxy.Type)()
|
||||
if utils.get_type(obj[0]) == "BuildingPart":
|
||||
cl = Arch.makeComponent()
|
||||
else:
|
||||
try: # new-style make function
|
||||
cl = getattr(Arch, "make_" + obj[0].Proxy.Type.lower())()
|
||||
except Exception:
|
||||
pass # not a standard Arch object... Fall back to Draft mode
|
||||
if cl:
|
||||
base = utils.get_clone_base(obj[0])
|
||||
cl.Label = prefix + base.Label
|
||||
cl.CloneOf = base
|
||||
if utils.get_type(obj[0]) != "BuildingPart":
|
||||
cl.Placement = obj[0].Placement
|
||||
for prop in ("Description", "IfcType", "Material", "Subvolume", "Tag"):
|
||||
try:
|
||||
setattr(cl, prop, getattr(base, prop))
|
||||
except Exception:
|
||||
pass
|
||||
if App.GuiUp:
|
||||
gui_utils.format_object(cl, base)
|
||||
gui_utils.select(cl)
|
||||
return cl
|
||||
try: # old-style make function
|
||||
cl = getattr(Arch, "make" + obj[0].Proxy.Type)()
|
||||
except Exception:
|
||||
pass # not a standard Arch object... Fall back to Draft mode
|
||||
if cl:
|
||||
base = utils.get_clone_base(obj[0])
|
||||
cl.Label = prefix + base.Label
|
||||
cl.CloneOf = base
|
||||
if utils.get_type(obj[0]) != "BuildingPart":
|
||||
cl.Placement = obj[0].Placement
|
||||
for prop in ("Description", "IfcType", "Material", "Subvolume", "Tag"):
|
||||
try:
|
||||
setattr(cl, prop, getattr(base, prop))
|
||||
except Exception:
|
||||
pass
|
||||
if App.GuiUp:
|
||||
gui_utils.format_object(cl, base)
|
||||
gui_utils.select(cl)
|
||||
return cl
|
||||
|
||||
# fall back to Draft clone mode
|
||||
if not cl:
|
||||
|
||||
Reference in New Issue
Block a user