SubLink: Fix #8 : incorrect position of Vertex
This commit is contained in:
parent
a125089984
commit
00b174c346
|
@ -23,6 +23,8 @@
|
|||
|
||||
from lattice2Common import *
|
||||
import lattice2Markers as markers
|
||||
import lattice2ShapeCopy as ShapeCopy
|
||||
|
||||
import math
|
||||
|
||||
import FreeCAD as App
|
||||
|
@ -165,8 +167,8 @@ class _CompoundFilter:
|
|||
obj.Shape = Part.makeCompound(rst)
|
||||
else: # don't make compound of one shape, output it directly
|
||||
sh = rst[0]
|
||||
sh.transformShape(sh.Placement.toMatrix(),True) #True = make copy
|
||||
sh.Placement = App.Placement()
|
||||
sh = ShapeCopy.transformCopy(sh)
|
||||
sh.Placement = obj.Placement
|
||||
obj.Shape = sh
|
||||
|
||||
return
|
||||
|
|
|
@ -27,6 +27,7 @@ __url__ = ""
|
|||
__doc__ = "Utility methods to copy shapes"
|
||||
|
||||
import FreeCAD
|
||||
import Part
|
||||
|
||||
def shallowCopy(shape, extra_placement = None):
|
||||
"""shallowCopy(shape, extra_placement = None): creates a shallow copy of a shape. The
|
||||
|
@ -67,8 +68,12 @@ def transformCopy(shape, extra_placement = None):
|
|||
if extra_placement is None:
|
||||
extra_placement = FreeCAD.Placement()
|
||||
ret = shape.copy()
|
||||
ret.transformShape(extra_placement.multiply(ret.Placement).toMatrix(), True)
|
||||
ret.Placement = FreeCAD.Placement() #reset placement
|
||||
if ret.ShapeType == "Vertex":
|
||||
# oddly, on Vertex, transformShape behaves strangely. So we'll create a new vertex instead.
|
||||
ret = Part.Vertex(extra_placement.multVec(ret.Point))
|
||||
else:
|
||||
ret.transformShape(extra_placement.multiply(ret.Placement).toMatrix(), True)
|
||||
ret.Placement = FreeCAD.Placement() #reset placement
|
||||
return ret
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ from lattice2Common import *
|
|||
from lattice2BaseFeature import isObjectLattice
|
||||
import lattice2Markers as markers
|
||||
import FreeCAD as App
|
||||
import lattice2ShapeCopy as ShapeCopy
|
||||
|
||||
# -------------------------- feature --------------------------------------------------
|
||||
|
||||
|
@ -92,7 +93,7 @@ class LatticeSubLink:
|
|||
else: # don't make compound of one shape, output it directly
|
||||
sh = rst[0]
|
||||
# absorb placement of original shape
|
||||
sh.transformShape(sh.Placement.toMatrix(),True) #True = make copy
|
||||
sh = ShapeCopy.transformCopy(sh)
|
||||
# apply Placement that is filled into feature's Placement property (not necessary)
|
||||
sh.Placement = selfobj.Placement
|
||||
selfobj.Shape = sh
|
||||
|
|
Loading…
Reference in New Issue
Block a user