Why can’t I see the Body objects when I listed objects from a python script?
(It works if I run a macro using freecadcmd but I need a python script to better integrate with my other projects.)
Here is what I did:
I opened FreeCAD, created a cube via part design and saved the file as Cube.FCStd.
In the model view there is Case > Body > Origin and Pad. When I run following lines in Freecad python console:
Code: Select all
for obj in App.ActiveDocument.Objects:
print(obj.Label)
Code: Select all
Body
Origin
X_Axis
Y_Axis
Z_Axis
XY_Plane
XZ_Plane
YZ_Plane
Sketch
Pad
Here is my test.py:
Code: Select all
import FreeCAD, Part
App=FreeCAD
doc = FreeCAD.open("Cube.FCStd")
App.setActiveDocument('Cube')
for obj in doc.Objects:
print(obj.TypeId, obj.Label)
Code: Select all
App::Origin Origin
App::Line X_Axis
App::Line Y_Axis
App::Line Z_Axis
App::Plane XY_Plane
App::Plane XZ_Plane
App::Plane YZ_Plane
Sketcher::SketchObject Sketch
I appreciate any kind of help.