create_object
Create a FreeCAD object in a document by specifying its type and properties, including primitives, booleans, and transforms.
Instructions
Create an object in a document.
Frequently used TypeIds: Primitives Part::Box (Length,Width,Height) | Part::Cylinder (Radius,Height,Angle) Part::Sphere (Radius) | Part::Cone (Radius1,Radius2,Height) Part::Torus (Radius1,Radius2) | Part::Plane (Length,Width) Part::Wedge | Part::Ellipsoid | Part::Prism (Polygon,Circumradius,Height) Booleans Part::Cut / Part::Fuse / Part::Common (properties: Base, Tool) Part::MultiFuse / Part::MultiCommon (property: Shapes = [names]) Transforms Part::Mirroring (Source,Normal,Base) | Part::Extrusion | Part::Revolution Structure App::Part | App::DocumentObjectGroup | App::Link (LinkedObject) Modelling PartDesign::Body | Sketcher::SketchObject (build these with run_python)
Value formats accepted by properties:
numbers/lengths 10 or 10.5 (millimetres)
vectors [x, y, z] or {"x":.., "y":.., "z":..}
placement {"Base":[x,y,z], "Rotation":{"Axis":[0,0,1], "Angle":45}}
rotation 45 (degrees about Z) | {"Axis":[..],"Angle":..} | {"Yaw":..,"Pitch":..,"Roll":..}
links "Box" (object Name or Label) link lists: ["Box","Cylinder"]
colours "#ff8800" | [1.0, 0.53, 0.0] | [255, 133, 0]
view_properties targets the ViewObject: ShapeColor, Transparency (0-100),
DisplayMode ("Flat Lines","Shaded","Wireframe"), Visibility.
Example: a 20mm cube offset on X, coloured orange type_id="Part::Box" properties={"Length": 20, "Width": 20, "Height": 20, "Placement": {"Base": [30, 0, 0]}} view_properties={"ShapeColor": "#ff8800"}
Example: cut a cylinder out of a box (both must already exist) type_id="Part::Cut", properties={"Base": "Box", "Tool": "Cylinder"}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | ||
| label | No | ||
| type_id | Yes | ||
| document | No | ||
| properties | No | ||
| view_properties | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||