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