Skip to content

Commit

Permalink
Window Fix : Attach To Edge, Link Individual Hosts
Browse files Browse the repository at this point in the history
Window :
- can use Gui Edit To Edge (Links also works)
- each Window Link can have Hosts parameters individually (different from its linked object)
- Link of Window in Tree works with Arch Component fix PR merged by @yorik
  • Loading branch information
paullee0 committed Jan 19, 2021
1 parent 320ba6f commit eb61033
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions ArchSketchObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import SketchArchIcon
import SketchArchCommands

# for ArchWindows
from PySide.QtCore import QT_TRANSLATE_NOOP

import math, time
from PySide import QtGui, QtCore
from FreeCAD import Vector
Expand Down Expand Up @@ -122,9 +125,17 @@ def setPropertiesLinkCommon(self, orgFp, linkFp=None, mode=None):

''' Referenced Object '''

if Draft.getType(fp.getLinkedObject()) not in ['Window', 'ArchSketch']: # Not to be added for ArchSketch, nor for Arch Windows also which already has "Hosts"
# "Host" for ArchSketch and Arch Equipment (currently all Objects calls except Window which has "Hosts")
if Draft.getType(fp.getLinkedObject()) != 'Window':
print(" Debug - setPropertiesLinkCommon - not window" )
if "Host" not in prop:
fp.addProperty("App::PropertyLink","Host","Referenced Object","The object that host this object / this object attach to")
# "Hosts" for Window
else:
print(" Debug - setPropertiesLinkCommon - Window" )
if "Hosts" not in prop:
fp.addProperty("App::PropertyLinkList","Hosts","Window",QT_TRANSLATE_NOOP("App::Property","The objects that host this window")) # Arch Window's code
# "Referenced Object","The object that host this object / this object attach to")

if "MasterSketch" not in prop:
fp.addProperty("App::PropertyLink","MasterSketch","Referenced Object","Master Sketch to Attach on")
Expand Down Expand Up @@ -631,17 +642,27 @@ def Activated(self):
class GuiEditWallAttachObserver(SketchArchCommands.selectObjectObserver):

def __init__(self, targetObject, targetHostWall, targetBaseSketch):
SketchArchCommands.selectObjectObserver.__init__(self,None,None,None,'Edge')
self.targetObject = targetObject
self.targetWall = targetHostWall
self.targetArchSketch = targetBaseSketch
if self.targetWall:
self.targetWallTransparentcy=targetHostWall.ViewObject.Transparency
targetHostWall.ViewObject.Transparency = 60
if targetObject.Host != targetHostWall: # Testing For Host first
targetObject.Host = targetHostWall # Not recompute atm to save time
SketchArchCommands.selectObjectObserver.__init__(self,None,None,None,'Edge')
self.targetObject = targetObject
self.targetWall = targetHostWall
self.targetArchSketch = targetBaseSketch
if self.targetWall:
self.targetWallTransparentcy=targetHostWall.ViewObject.Transparency
targetHostWall.ViewObject.Transparency = 60
if hasattr(targetObject, "Host"):
if targetObject.Host != targetHostWall: # Testing For Host first
targetObject.Host = targetHostWall # Not recompute atm to save time
else: # elif hasattr(targetObject, "Hosts"):
if targetObject.Hosts:
if targetObject.Hosts[0] != targetHostWall: # Testing For Host[0]
targetObjectHosts = targetObject.Hosts
targetObjectHosts[0] = targetHostWall # replace 1st item
targetObject.Hosts = targetObjectHosts
else:
targetObject.Hosts = [targetHostWall]
# Not recompute atm to save time
if targetHostWall:
# check if need to assign to attach to 'Hst'
# check if need to assign to attach to 'Host'
if targetObject.AttachToAxisOrSketch != 'Host':
targetObject.AttachToAxisOrSketch = 'Host'

Expand Down

0 comments on commit eb61033

Please sign in to comment.