Part: Rename AttachExtension::Support property to AttachmentSupport, to avoid name conflict with base features. Fixes #7052

This commit is contained in:
Josh Coalson
2024-03-02 10:35:11 -08:00
committed by Adrián Insaurralde Avalos
parent 2643902b6b
commit fbd8767242
55 changed files with 162 additions and 197 deletions

View File

@@ -112,8 +112,8 @@ def addComponents(objectsList,host):
g.append(host)
o.Hosts = g
elif DraftGeomUtils.isValidPath(o.Shape) and (hostType in ["Structure","Precast"]):
if o.Support == host:
o.Support = None
if o.AttachmentSupport == host:
o.AttachmentSupport = None
host.Tool = o
elif Draft.getType(o) == "Axis":
if not o in x:

View File

@@ -66,13 +66,13 @@ def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name=N
if FreeCAD.GuiUp:
_ViewProviderRebar(obj.ViewObject)
if baseobj and sketch:
if hasattr(sketch,"Support"):
if sketch.Support:
if isinstance(sketch.Support,tuple):
if sketch.Support[0] == baseobj:
sketch.Support = None
elif sketch.Support == baseobj:
sketch.Support = None
if hasattr(sketch,"AttachmentSupport"):
if sketch.AttachmentSupport:
if isinstance(sketch.AttachmentSupport,tuple):
if sketch.AttachmentSupport[0] == baseobj:
sketch.AttachmentSupport = None
elif sketch.AttachmentSupport == baseobj:
sketch.AttachmentSupport = None
obj.Base = sketch
if FreeCAD.GuiUp:
sketch.ViewObject.hide()
@@ -145,10 +145,10 @@ class _CommandRebar:
if len(obj.Shape.Wires) == 1:
# we have only a wire: extract its support object, if available, and make the rebar
support = "None"
if hasattr(obj,"Support"):
if obj.Support:
if len(obj.Support) != 0:
support = "FreeCAD.ActiveDocument."+obj.Support[0][0].Name
if hasattr(obj,"AttachmentSupport"):
if obj.AttachmentSupport:
if len(obj.AttachmentSupport) != 0:
support = "FreeCAD.ActiveDocument."+obj.AttachmentSupport[0][0].Name
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Rebar"))
FreeCADGui.addModule("Arch")
FreeCADGui.doCommand("Arch.makeRebar("+support+",FreeCAD.ActiveDocument."+obj.Name+")")

View File

@@ -195,15 +195,15 @@ class _CommandWindow:
if obj.Shape.Wires and (not obj.Shape.Solids) and (not obj.Shape.Shells):
FreeCADGui.Control.closeDialog()
host = None
if hasattr(obj,"Support"):
if obj.Support:
if isinstance(obj.Support,tuple):
host = obj.Support[0]
elif isinstance(obj.Support,list):
host = obj.Support[0][0]
if hasattr(obj,"AttachmentSupport"):
if obj.AttachmentSupport:
if isinstance(obj.AttachmentSupport,tuple):
host = obj.AttachmentSupport[0]
elif isinstance(obj.AttachmentSupport,list):
host = obj.AttachmentSupport[0][0]
else:
host = obj.Support
obj.Support = None # remove
host = obj.AttachmentSupport
obj.AttachmentSupport = None # remove
elif Draft.isClone(obj,"Window"):
if obj.Objects[0].Inlist:
host = obj.Objects[0].Inlist[0]

View File

@@ -444,7 +444,7 @@ class ArchTest(unittest.TestCase):
App.Console.PrintLog ('Checking Arch Rebar...\n')
s = Arch.makeStructure(length=2,width=3,height=5)
sk = App.ActiveDocument.addObject('Sketcher::SketchObject','Sketch')
sk.Support = (s,["Face6"])
sk.AttachmentSupport = (s,["Face6"])
sk.addGeometry(Part.LineSegment(App.Vector(-0.85,1.25,0),App.Vector(0.75,1.25,0)))
sk.addGeometry(Part.LineSegment(App.Vector(0.75,1.25,0),App.Vector(0.75,-1.20,0)))
sk.addGeometry(Part.LineSegment(App.Vector(0.75,-1.20,0),App.Vector(-0.85,-1.20,0)))