Fixed Shape.Center when called on a compound with multiple solids.
This commit is contained in:
parent
a5837b8c03
commit
aa01be8d9e
|
@ -190,9 +190,10 @@ class Shape(object):
|
||||||
# If there are no Solids, we're probably dealing with a Face or something similar
|
# If there are no Solids, we're probably dealing with a Face or something similar
|
||||||
if len(self.Solids()) == 0:
|
if len(self.Solids()) == 0:
|
||||||
return Vector(self.wrapped.CenterOfMass)
|
return Vector(self.wrapped.CenterOfMass)
|
||||||
else:
|
elif len(self.Solids()) == 1:
|
||||||
# TODO: compute the weighted average instead of using the first solid
|
|
||||||
return Vector(self.Solids()[0].wrapped.CenterOfMass)
|
return Vector(self.Solids()[0].wrapped.CenterOfMass)
|
||||||
|
elif len(self.Solids()) > 1:
|
||||||
|
return self.CombinedCenter(self.Solids())
|
||||||
elif isinstance(self.wrapped, FreeCADPart.Solid):
|
elif isinstance(self.wrapped, FreeCADPart.Solid):
|
||||||
return Vector(self.wrapped.CenterOfMass)
|
return Vector(self.wrapped.CenterOfMass)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user