Arch: Misc improvements for IFC workflow
* Added utility to make non-parametric Arch component * Ability for all Arch components to be a clone of another Arch component of same type * Modified the Draft Clone tool to produce Arch Clones if applicable * Fixed Arch Roofs so they can be based on a solid shape like other Arch objects * Ability to change the Root element to be imported in IFC preferences * Ability to import IFC files also as compounds, Part shapes or non-parametric Arch objects * Added an "only" parameter to importIFC.open() to import only a certain object ID. * Ability to read colors (IfcSurfaceStyle) from IFC objects
This commit is contained in:
@@ -192,6 +192,23 @@ def removeComponents(objectsList,host=None):
|
||||
if o in a:
|
||||
a.remove(o)
|
||||
h.Objects = a
|
||||
|
||||
def makeComponent(baseobj=None,name="Component"):
|
||||
'''makeComponent([baseobj]): creates an undefined, non-parametric Arch
|
||||
component from the given base object'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
obj.Label = translate("Arch",name)
|
||||
ArchComponent.Component(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
ArchComponent.ViewProviderComponent(obj.ViewObject)
|
||||
if baseobj:
|
||||
import Part
|
||||
if baseobj.isDerivedFrom("Part::Feature"):
|
||||
obj.Shape = baseobj.Shape
|
||||
obj.Placement = baseobj.Placement
|
||||
elif isinstance(baseobj,Part.Shape):
|
||||
obj.Shape = baseobj
|
||||
return obj
|
||||
|
||||
def fixWindow(obj):
|
||||
'''fixWindow(object): Fixes non-DAG problems in windows
|
||||
@@ -1114,6 +1131,29 @@ class _ToggleIfcBrepFlag:
|
||||
def Activated(self):
|
||||
for o in FreeCADGui.Selection.getSelection():
|
||||
toggleIfcBrepFlag(o)
|
||||
|
||||
|
||||
class _CommandComponent:
|
||||
"the Arch Component command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Component',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Component","Component"),
|
||||
'Accel': "C, M",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Component","Creates an undefined architectural component")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if sel:
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Component"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.Control.closeDialog()
|
||||
for o in sel:
|
||||
FreeCADGui.doCommand("Arch.makeComponent(FreeCAD.ActiveDocument."+o.Name+")")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -1128,3 +1168,4 @@ if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('Arch_IfcExplorer',_CommandIfcExplorer())
|
||||
FreeCADGui.addCommand('Arch_Survey',_CommandSurvey())
|
||||
FreeCADGui.addCommand('Arch_ToggleIfcBrepFlag',_ToggleIfcBrepFlag())
|
||||
FreeCADGui.addCommand('Arch_Component',_CommandComponent())
|
||||
|
||||
Reference in New Issue
Block a user