edwilliams16 wrote: ↑Wed Dec 08, 2021 5:31 pm
How about
Code: Select all
pd =App.getDocument('Unnamed').getObject('Pad')
fc = pd.Shape.Faces[1] #Face2
myvector = fc.CenterOfGravity
This is all well and good
if as a human I'm looking at a breakpoint in the code and see Face2 and know that is a count and not a 0 based index.
But, I wasn't clear how code it to access Faces[x].
In this case, I needed something like:
Code: Select all
sel = Gui.Selection.getSelectionEx()
if len(sel) == 1:
subobjs = sel[0].SubObjects
if len(subobjs) == 1:
face = subobjs[0]
if face.ShapeType == 'Face':
COG=face.CenterOfGravity
newvert = App.ActiveDocument.addObject("Part::Vertex","Vertex")
newvert.X=COG.x
newvert.Y=COG.y
newvert.Z=COG.z
Though, shouldn't I be able to use the COG vector rather than it's constituent x,y,z?
And what does the message: "Warning: Wire is deprecated, please use OuterWire" mean...
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."