Draft: Shape2Dview now takes groups as input
This commit is contained in:
parent
0638b524ec
commit
97b5ec2479
|
@ -3691,6 +3691,18 @@ class _Shape2DView(_DraftObject):
|
|||
comp.Placement = opl.inverse()
|
||||
if comp:
|
||||
obj.Shape = comp
|
||||
|
||||
elif obj.Base.isDerivedFrom("App::DocumentObjectGroup"):
|
||||
shapes = []
|
||||
for o in obj.Base.Group:
|
||||
if o.isDerivedFrom("Part::Feature"):
|
||||
if o.Shape:
|
||||
if not o.Shape.isNull():
|
||||
shapes.append(o.Shape)
|
||||
if shapes:
|
||||
import Part
|
||||
comp = Part.makeCompound(shapes)
|
||||
obj.Shape = self.getProjected(obj,comp,obj.Projection)
|
||||
|
||||
elif obj.Base.isDerivedFrom("Part::Feature"):
|
||||
if not DraftVecUtils.isNull(obj.Projection):
|
||||
|
|
|
@ -238,16 +238,25 @@ def findIntersection(edge1,edge2,infinite1=False,infinite2=False,ex1=False,ex2=F
|
|||
norm1 = pt2.sub(pt1).cross(pt3.sub(pt1))
|
||||
norm2 = pt2.sub(pt4).cross(pt3.sub(pt4))
|
||||
if not DraftVecUtils.isNull(norm1):
|
||||
norm1.normalize()
|
||||
try:
|
||||
norm1.normalize()
|
||||
except:
|
||||
return []
|
||||
if not DraftVecUtils.isNull(norm2):
|
||||
norm2.normalize()
|
||||
try:
|
||||
norm2.normalize()
|
||||
except:
|
||||
return []
|
||||
if DraftVecUtils.isNull(norm1.cross(norm2)):
|
||||
vec1 = pt2.sub(pt1)
|
||||
vec2 = pt4.sub(pt3)
|
||||
if DraftVecUtils.isNull(vec1) or DraftVecUtils.isNull(vec2):
|
||||
return [] # One of the line has zero-length
|
||||
vec1.normalize()
|
||||
vec2.normalize()
|
||||
try:
|
||||
vec1.normalize()
|
||||
vec2.normalize()
|
||||
except:
|
||||
return []
|
||||
norm3 = vec1.cross(vec2)
|
||||
if not DraftVecUtils.isNull(norm3) :
|
||||
k = ((pt3.z-pt1.z)*(vec2.x-vec2.y)+(pt3.y-pt1.y)*(vec2.z-vec2.x)+ \
|
||||
|
|
Loading…
Reference in New Issue
Block a user