Skip to content

Commit

Permalink
Arch: Allow the hi-res version of Equipment objects to be a shape too
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Feb 10, 2017
1 parent 819b3e8 commit e1110bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Arch/ArchComponent.py
Expand Up @@ -764,7 +764,7 @@ def claimChildren(self):
if hasattr(self.Object,link):
objlink = getattr(self.Object,link)
c.extend(objlink)
for link in ["Tool","Subvolume","Mesh"]:
for link in ["Tool","Subvolume","Mesh","Hires"]:
if hasattr(self.Object,link):
objlink = getattr(self.Object,link)
if objlink:
Expand Down
28 changes: 10 additions & 18 deletions src/Mod/Arch/ArchEquipment.py
Expand Up @@ -264,23 +264,15 @@ def __init__(self,obj):
obj.addProperty("App::PropertyString","Url","Arch",QT_TRANSLATE_NOOP("App::Property","The url of the product page of this equipment"))
obj.addProperty("App::PropertyVectorList","SnapPoints","Arch",QT_TRANSLATE_NOOP("App::Property","Additional snap points for this equipment"))
obj.addProperty("App::PropertyFloat","EquipmentPower","Arch",QT_TRANSLATE_NOOP("App::Property","The electric power needed by this equipment in Watts"))
obj.addProperty("App::PropertyLink","Mesh","Arch",QT_TRANSLATE_NOOP("App::Property","An optional higher-resolution mesh representation for this object"))
#obj.addProperty("App::PropertyPlacement","MeshDelta","Arch",QT_TRANSLATE_NOOP("App::Property","Stores the delta between the object placement and the mesh placement"))
obj.addProperty("App::PropertyLink","Hires","Arch",QT_TRANSLATE_NOOP("App::Property","An optional higher-resolution mesh or shape for this object"))
self.Type = "Equipment"
obj.Role = Roles
obj.Proxy = self
obj.setEditorMode("VerticalArea",2)
obj.setEditorMode("HorizontalArea",2)
obj.setEditorMode("PerimeterLength",2)
#obj.setEditorMode("MeshDelta",2)

def onChanged(self,obj,prop):
#if prop == "Mesh":
# if obj.Mesh:
# delta = FreeCAD.Placement()
# delta.Base = obj.Mesh.Placement.Base.sub(obj.Placement.Base)
# delta.Rotation = FreeCAD.Rotation(obj.Placement.Rotation.multVec(FreeCAD.Vector(0,0,1)),obj.Mesh.Placement.Rotation.multVec(FreeCAD.Vector(0,0,1)))
# obj.MeshDelta = delta
self.hideSubobjects(obj,prop)
ArchComponent.Component.onChanged(self,obj,prop)

Expand Down Expand Up @@ -330,7 +322,7 @@ def attach(self, vobj):
self.hiresgroup = coin.SoGroup()
self.meshcolor = coin.SoBaseColor()
self.hiresgroup.addChild(self.meshcolor)
vobj.addDisplayMode(self.hiresgroup,"Mesh");
vobj.addDisplayMode(self.hiresgroup,"Hires");
ArchComponent.ViewProviderComponent.attach(self,vobj)

def updateData(self, obj, prop):
Expand All @@ -342,22 +334,22 @@ def updateData(self, obj, prop):
self.coords.point.deleteValues(0)

def getDisplayModes(self,vobj):
modes=["Mesh"]
modes=["Hires"]
return modes

def setDisplayMode(self,mode):
if mode == "Mesh":
if mode == "Hires":
m = None
if hasattr(self,"Object"):
if hasattr(self.Object,"Mesh"):
if self.Object.Mesh:
m = self.Object.Mesh.ViewObject.RootNode
if hasattr(self.Object,"Hires"):
if self.Object.Hires:
m = self.Object.Hires.ViewObject.RootNode
if not m:
if hasattr(self.Object,"CloneOf"):
if self.Object.CloneOf:
if hasattr(self.Object.CloneOf,"Mesh"):
if self.Object.CloneOf.Mesh:
m = self.Object.CloneOf.Mesh.ViewObject.RootNode
if hasattr(self.Object.CloneOf,"Hires"):
if self.Object.CloneOf.Hires:
m = self.Object.CloneOf.Hires.ViewObject.RootNode
if m:
self.meshnode = m.copy()
self.meshnode.getChild(1).whichChild = 0
Expand Down

0 comments on commit e1110bb

Please sign in to comment.