Skip to content

Commit

Permalink
Draft: patch attachable objects + make clones attachable
Browse files Browse the repository at this point in the history
Pathcing: add calls to positionBySupport on recomputes of features built on Part2DObjectPython.
Clone: make it attachable, regardless of source object type
  • Loading branch information
DeepSOIC committed May 19, 2016
1 parent b4102fc commit c929739
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Mod/Draft/Draft.py
Expand Up @@ -2469,7 +2469,7 @@ def clone(obj,delta=None):
cl.CloneOf = base
return cl
else:
cl = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Clone")
cl = FreeCAD.ActiveDocument.addObject("Part::AttachableObjectPython","Clone")
cl.Label = "Clone of " + obj[0].Label
_Clone(cl)
if gui:
Expand Down Expand Up @@ -4161,6 +4161,7 @@ def execute(self, obj):
shape = Part.Face(shape)
obj.Shape = shape
obj.Placement = plm
obj.positionBySupport()

class _ViewProviderRectangle(_ViewProviderDraft):
def __init__(self,vobj):
Expand Down Expand Up @@ -4192,6 +4193,7 @@ def execute(self, obj):
shape = Part.Face(shape)
obj.Shape = shape
obj.Placement = plm
obj.positionBySupport()

class _Ellipse(_DraftObject):
"The Circle object"
Expand Down Expand Up @@ -4228,6 +4230,7 @@ def execute(self, obj):
shape = Part.Face(shape)
obj.Shape = shape
obj.Placement = plm
obj.positionBySupport()

class _Wire(_DraftObject):
"The Wire object"
Expand Down Expand Up @@ -4349,6 +4352,7 @@ def execute(self, obj):
if hasattr(obj,"Length"):
obj.Length = shape.Length
obj.Placement = plm
obj.positionBySupport()
self.onChanged(obj,"Placement")

def onChanged(self, obj, prop):
Expand Down Expand Up @@ -4511,6 +4515,8 @@ def execute(self, obj):
shape = Part.Face(shape)
obj.Shape = shape
obj.Placement = plm
obj.positionBySupport()


class _DrawingView(_DraftObject):
"The Draft DrawingView object"
Expand Down Expand Up @@ -4612,6 +4618,7 @@ def execute(self, obj):
spline.interpolate(obj.Points, False)
obj.Shape = spline.toShape()
obj.Placement = plm
obj.positionBySupport()

# for compatibility with older versions
_ViewProviderBSpline = _ViewProviderWire
Expand Down Expand Up @@ -4639,6 +4646,7 @@ def __init__(self, obj):

def execute(self, fp):
self.createGeometry(fp)
fp.positionBySupport()

def _segpoleslst(self,fp):
"""split the points into segments"""
Expand Down Expand Up @@ -4760,6 +4768,7 @@ def execute(self, obj):
shape = Part.makeCompound(shps)
obj.Shape = shape
obj.Placement = plm
obj.positionBySupport()

class _Shape2DView(_DraftObject):
"The Shape2DView object"
Expand Down Expand Up @@ -4800,6 +4809,7 @@ def getProjected(self,obj,shape,direction):

def execute(self,obj):
import DraftGeomUtils
obj.positionBySupport()
pl = obj.Placement
if obj.Base:
if getType(obj.Base) == "SectionPlane":
Expand Down Expand Up @@ -5241,7 +5251,9 @@ def execute(self,obj):
else:
obj.Shape = Part.makeCompound(shapes)
obj.Placement = pl

if hasattr(obj,"positionBySupport"):
obj.positionBySupport()

def getSubVolume(self,obj,placement=None):
# this allows clones of arch windows to return a subvolume too
if obj.Objects:
Expand Down Expand Up @@ -5339,6 +5351,7 @@ def execute(self, obj):
obj.Shape = shape
if plm:
obj.Placement = plm
obj.positionBySupport()

def makeFaces(self, wireChar):
import Part
Expand Down

0 comments on commit c929739

Please sign in to comment.