diff --git a/src/Mod/Arch/ArchEquipment.py b/src/Mod/Arch/ArchEquipment.py index 205333c2c8..ae16f0e631 100644 --- a/src/Mod/Arch/ArchEquipment.py +++ b/src/Mod/Arch/ArchEquipment.py @@ -281,6 +281,24 @@ class _Equipment(ArchComponent.Component): obj.IfcType = "Furnishing Element" else: obj.IfcType = "Undefined" + # Add features in the SketchArch External Add-on, if present + self.addSketchArchFeatures(obj) + + def addSketchArchFeatures(self,obj,linkObj=None,mode=None): + ''' + To add features in the SketchArch External Add-on, if present (https://github.com/paullee0/FreeCAD_SketchArch) + - import ArchSketchObject module, and + - set properties that are common to ArchObjects (including Links) and ArchSketch + to support the additional features + + To install SketchArch External Add-on, see https://github.com/paullee0/FreeCAD_SketchArch#iv-install + ''' + + try: + import ArchSketchObject + ArchSketchObject.ArchSketch.setPropertiesLinkCommon(self, obj, linkObj, mode) + except: + pass def setProperties(self,obj): @@ -305,6 +323,9 @@ class _Equipment(ArchComponent.Component): ArchComponent.Component.onDocumentRestored(self,obj) self.setProperties(obj) + # Add features in the SketchArch External Add-on, if present + self.addSketchArchFeatures(obj) + def onChanged(self,obj,prop): self.hideSubobjects(obj,prop) @@ -323,6 +344,40 @@ class _Equipment(ArchComponent.Component): base = self.processSubShapes(obj,base,pl) self.applyShape(obj,base,pl,allowinvalid=False,allownosolid=True) + # Execute features in the SketchArch External Add-on, if present + self.executeSketchArchFeatures(obj) + + def executeSketchArchFeatures(self, obj, linkObj=None, index=None, linkElement=None): + ''' + To execute features in the SketchArch External Add-on (https://github.com/paullee0/FreeCAD_SketchArch) + - import ArchSketchObject module, and + - execute features that are common to ArchObjects (including Links) and ArchSketch + + To install SketchArch External Add-on, see https://github.com/paullee0/FreeCAD_SketchArch#iv-install + ''' + + # To execute features in SketchArch External Add-on, if present + try: + import ArchSketchObject + # Execute SketchArch Feature - Intuitive Automatic Placement for Arch Windows/Doors, Equipment etc. + # see https://forum.freecadweb.org/viewtopic.php?f=23&t=50802 + ArchSketchObject.updateAttachmentOffset(obj, linkObj) + except: + pass + + def appLinkExecute(self, obj, linkObj, index, linkElement): + ''' + Default Link Execute method() - + See https://forum.freecadweb.org/viewtopic.php?f=22&t=42184&start=10#p361124 + @realthunder added support to Links to run Linked Scripted Object's methods() + ''' + + # Add features in the SketchArch External Add-on, if present + self.addSketchArchFeatures(obj, linkObj) + + # Execute features in the SketchArch External Add-on, if present + self.executeSketchArchFeatures(obj, linkObj) + def computeAreas(self,obj): return