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:
Yorik van Havre
2015-04-08 12:34:48 -03:00
parent 3baafccb60
commit 86cf572f34
18 changed files with 579 additions and 98 deletions

View File

@@ -40,6 +40,7 @@ if FreeCAD.GuiUp:
else:
def translate(ctxt,txt):
return txt
def addToComponent(compobject,addobject,mod=None):
'''addToComponent(compobject,addobject,mod): adds addobject
@@ -132,8 +133,8 @@ class SelectionTaskPanel:
FreeCADGui.Selection.removeObserver(FreeCAD.ArchObserver)
del FreeCAD.ArchObserver
return True
class ComponentTaskPanel:
'''The default TaskPanel for all Arch components'''
def __init__(self):
@@ -289,6 +290,7 @@ class Component:
"The default Arch Component object"
def __init__(self,obj):
obj.addProperty("App::PropertyLink","Base","Arch",translate("Arch","The base object this component is built upon"))
obj.addProperty("App::PropertyLink","CloneOf","Arch",translate("Arch","The object this component is cloning"))
obj.addProperty("App::PropertyLinkList","Additions","Arch",translate("Arch","Other shapes that are appended to this object"))
obj.addProperty("App::PropertyLinkList","Subtractions","Arch",translate("Arch","Other shapes that are subtracted from this object"))
obj.addProperty("App::PropertyString","Description","Arch",translate("Arch","An optional description for this component"))
@@ -316,6 +318,17 @@ class Component:
def onChanged(self,obj,prop):
pass
def clone(self,obj):
"if this object is a clone, sets the shape. Returns True if this is the case"
if hasattr(obj,"CloneOf"):
if obj.CloneOf:
if Draft.getType(obj.CloneOf) == Draft.getType(obj):
pl = obj.Placement
obj.Shape = obj.CloneOf.Shape.copy()
obj.Placement = pl
return True
return False
def getSiblings(self,obj):
"returns a list of objects with the same type and same base as this object"
if not hasattr(obj,"Base"):
@@ -642,6 +655,10 @@ class ViewProviderComponent:
def updateData(self,obj,prop):
return
def getIcon(self):
import Arch_rc
return ":/icons/Arch_Component.svg"
def onChanged(self,vobj,prop):
if prop == "Visibility":