Capabilities related to creating and manipulating 3D shapes.
Part::
create_cube(width,
length,
height)
Adds cuboid geometry to a part.
width
Type: string,float,Dimension
Example: Dimension(0,'mm')
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
create_cone(radius,
height,
draft_radius)
Adds cone geometry to a part.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
draft_radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
create_cylinder(radius,
height)
Adds cylinder geometry to a part.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
create_torus(inner_radius,
outer_radius)
Adds torus geometry to a part.
inner_radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
outer_radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
create_sphere(radius)
Adds sphere geometry to a part.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
create_gear(outer_radius,
addendum,
inner_radius,
dedendum,
height,
pressure_angle,
number_of_teeth,
skew_angle,
conical_angle,
crown_angle)
Adds gear geometry to a part.
outer_radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
addendum
Type: string,float,Dimension
Example: Dimension(0,'mm')
inner_radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
dedendum
Type: string,float,Dimension
Example: Dimension(0,'mm')
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
pressure_angle
Type: string,float,Angle
Default Value: 20d
Example: Angle(90)
number_of_teeth
Type: int
Default Value: 12
Example: 0
skew_angle
Type: string,float,Angle
Example: Angle(90)
conical_angle
Type: string,float,Angle
Example: Angle(90)
crown_angle
Type: string,float,Angle
Example: Angle(90)
Part::
create_text(text,
extrude_amount,
font_size,
bold,
italic,
underlined,
character_spacing,
word_spacing,
line_spacing,
font_file_path,
profile_curve_name)
Add 3D text. This is a shortcut for quickly extruding Sktech.create_text. Use a sketch for more flexibility.
text
Type: string
Example: 'String'
extrude_amount
Type: string,float,Dimension
Example: Dimension(0,'mm')
font_size
Type: string,float,Dimension
Default Value: 1.0
Example: Dimension(0,'mm')
bold
Type: boolean
Example: True
italic
Type: boolean
Example: True
underlined
Type: boolean
Example: True
character_spacing
Type: int
Default Value: 1
Example: 0
word_spacing
Type: int
Default Value: 1
Example: 0
line_spacing
Type: int
Default Value: 1
Example: 0
font_file_path
Type: string
Required: false
Example: 'String'
profile_curve_name
Type: string,Wire,Sketch
Required: false
Example: Wire('a wire',[])
Part::
clone(new_name,
copy_landmarks)
Clone an existing Part with its geometry and properties. Returns the new Part.
returnType: Part
new_name
Type: string
Example: 'String'
copy_landmarks
Type: boolean
Default Value: True
Example: True
Part::
hollow(thickness_x,
thickness_y,
thickness_z,
start_axis,
flip_axis)
Remove vertices, if necessary, until the part has a specified wall thickness.
thickness_x
Type: string,float,Dimension
Example: Dimension(0,'mm')
thickness_y
Type: string,float,Dimension
Example: Dimension(0,'mm')
thickness_z
Type: string,float,Dimension
Example: Dimension(0,'mm')
start_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
flip_axis
Type: boolean
Example: True
Part::
thicken(radius)
Uniformly add a wall around a Part.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
hole(hole_landmark,
radius,
depth,
normal_axis,
flip_axis,
initial_rotation_x,
initial_rotation_y,
initial_rotation_z,
mirror_about_entity_or_landmark,
mirror_axis,
mirror,
circular_pattern_instance_count,
circular_pattern_instance_separation,
circular_pattern_instance_axis,
circular_pattern_about_entity_or_landmark,
linear_pattern_instance_count,
linear_pattern_instance_separation,
linear_pattern_instance_axis,
linear_pattern2nd_instance_count,
linear_pattern2nd_instance_separation,
linear_pattern2nd_instance_axis)
Create a hole.
hole_landmark
Type: string,Landmark
Example: Landmark('name', 'parent')
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
depth
Type: string,float,Dimension
Example: Dimension(0,'mm')
normal_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
flip_axis
Type: boolean
Example: True
initial_rotation_x
Type: string,float,Angle
Example: Angle(90)
initial_rotation_y
Type: string,float,Angle
Example: Angle(90)
initial_rotation_z
Type: string,float,Angle
Example: Angle(90)
mirror_about_entity_or_landmark
Type: string,Entity
Required: false
Example: __import__("codetocad").Part('an entity')
mirror_axis
Type: string,int,Axis
Default Value: x
Example: 'x'
mirror
Type: boolean
Example: True
circular_pattern_instance_count
Type: int
Default Value: 1
Example: 0
circular_pattern_instance_separation
Type: string,float,Angle
Example: Angle(90)
circular_pattern_instance_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
circular_pattern_about_entity_or_landmark
Type: string,Entity
Required: false
Example: __import__("codetocad").Part('an entity')
linear_pattern_instance_count
Type: int
Default Value: 1
Example: 0
linear_pattern_instance_separation
Type: string,float,Dimension
Example: Dimension(0,'mm')
linear_pattern_instance_axis
Type: string,int,Axis
Default Value: x
Example: 'x'
linear_pattern2nd_instance_count
Type: int
Default Value: 1
Example: 0
linear_pattern2nd_instance_separation
Type: string,float,Dimension
Example: Dimension(0,'mm')
linear_pattern2nd_instance_axis
Type: string,int,Axis
Default Value: y
Example: 'x'
Part::
twist(angle,
screw_pitch,
iterations,
axis)
AKA Helix, Screw. Revolve an entity
angle
Type: string,float,Angle
Example: Angle(90)
screw_pitch
Type: string,float,Dimension
Example: Dimension(0,'mm')
iterations
Type: int
Default Value: 1
Example: 0
axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Part::
set_material(material_name)
Assign a known material to this part.
material_name
Type: string,Material
Example: Material('mat')
Part::
is_colliding_with_part(other_part)
Check if this part is colliding with another.
returnType: boolean
other_part
Type: string,Part
Example: Part('a part')
Part::
fillet_all_edges(radius,
use_width)
Fillet all edges.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
use_width
Type: boolean
Example: True
Part::
fillet_edges(radius,
landmarks_near_edges,
use_width)
Fillet specific edges.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
landmarks_near_edges
Type: list[string,Landmark]
Example: ["Landmark('name', 'parent')"]
use_width
Type: boolean
Example: True
Part::
fillet_faces(radius,
landmarks_near_faces,
use_width)
Fillet specific faces.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
landmarks_near_faces
Type: list[string,Landmark]
Example: ["Landmark('name', 'parent')"]
use_width
Type: boolean
Example: True
Part::
chamfer_all_edges(radius)
Chamfer all edges.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
chamfer_edges(radius,
landmarks_near_edges)
Chamfer specific edges.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
landmarks_near_edges
Type: list[string,Landmark]
Example: ["Landmark('name', 'parent')"]
Part::
chamfer_faces(radius,
landmarks_near_faces)
Chamfer specific faces.
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
landmarks_near_faces
Type: list[string,Landmark]
Example: ["Landmark('name', 'parent')"]
Part::
select_vertex_near_landmark(landmark_name)
Select the vertex closest to a Landmark on the entity (in UI).
landmark_name
Type: string,Landmark
Required: false
Example: Landmark('name', 'parent')
Part::
select_edge_near_landmark(landmark_name)
Select an edge closest to a landmark on the entity (in UI).
landmark_name
Type: string,Landmark
Required: false
Example: Landmark('name', 'parent')
Part::
select_face_near_landmark(landmark_name)
Select a face closest to a landmark on the entity (in UI).
landmark_name
Type: string,Landmark
Required: false
Example: Landmark('name', 'parent')
Part-Entity::
is_exists()
Check if an entity exists
returnType: boolean
Part-Entity::
rename(new_name,
renamelinked_entities_and_landmarks)
Rename the entity, with an option to rename linked landmarks and underlying data.
new_name
Type: string
Example: 'String'
renamelinked_entities_and_landmarks
Type: boolean
Default Value: True
Example: True
Part-Entity::
delete(remove_children)
Delete the entity from the scene. You may need to delete an associated joint or other features.
remove_children
Type: boolean
Default Value: True
Example: True
Part-Entity::
is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Part-Entity::
set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Part-Entity::
apply(rotation,
scale,
location,
modifiers)
Apply any modifications. This is application specific, but a general function is that it finalizes any changes made to an entity.
rotation
Type: boolean
Default Value: True
Example: True
scale
Type: boolean
Default Value: True
Example: True
location
Type: boolean
Example: True
modifiers
Type: boolean
Default Value: True
Example: True
Part-Entity::
get_native_instance()
Get the native API's object instance. For example, in Blender API, this would return a bpy.object instance.
returnType: any
Part-Entity::
get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Part-Entity::
get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Part-Entity::
select()
Select the entity (in UI).
Part-Entity::
translate_xyz(x,
y,
z)
Translate in the XYZ directions. Pass a number, Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
x
Type: string,float,Dimension
Example: Dimension(0,'mm')
y
Type: string,float,Dimension
Example: Dimension(0,'mm')
z
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part-Entity::
translate_x(amount)
Translate in the X direction. Pass a number or Dimension or Dimension-String (e.g. '2cm') to translate to a specific length.
amount
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part-Entity::
translate_y(amount)
Translate in the Y direction. Pass a number or Dimension or Dimension-String (e.g. '2cm') to translate to a specific length.
amount
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part-Entity::
translate_z(amount)
Translate in the z direction. Pass a number or Dimension or Dimension-String (e.g. '2cm') to translate to a specific length.
amount
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part-Entity::
rotate_xyz(x,
y,
z)
Rotate in the XYZ direction. Default units is degrees. Pass in a number, Angle or Angle-String (e.g. 'PI/4radians' or 'PI/4r' or '90d'
x
Type: string,float,Angle
Example: Angle(90)
y
Type: string,float,Angle
Example: Angle(90)
z
Type: string,float,Angle
Example: Angle(90)
Part-Entity::
rotate_x(rotation)
Rotate in the X direction. Default units is degrees. Pass in a number, Angle or Angle-String (e.g. 'PI/4radians' or 'PI/4r' or '90d'
rotation
Type: string,float,Angle
Example: Angle(90)
Part-Entity::
rotate_y(rotation)
Rotate in the Y direction. Default units is degrees. Pass in a number, Angle or Angle-String (e.g. 'PI/4radians' or 'PI/4r' or '90d'
rotation
Type: string,float,Angle
Example: Angle(90)
Part-Entity::
rotate_z(rotation)
Rotate in the Z direction. Default units is degrees. Pass in a number, Angle or Angle-String (e.g. 'PI/4radians' or 'PI/4r' or '90d'
rotation
Type: string,float,Angle
Example: Angle(90)
Part-Entity::
get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Part-Entity::
get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Part::
mirror(mirror_across_entity,
axis,
resulting_mirrored_entity_name)
Mirror an existing entity with respect to a landmark. If a name is provided, the mirror becomes a separate entity.
mirror_across_entity
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
axis
Type: string,int,Axis
Example: 'x'
resulting_mirrored_entity_name
Type: string
Required: false
Example: 'String'
Part::
linear_pattern(instance_count,
offset,
direction_axis)
Pattern in a uniform direction.
offset
Type: string,float,Dimension
Example: Dimension(0,'mm')
direction_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Part::
circular_pattern(instance_count,
separation_angle,
center_entity_or_landmark,
normal_direction_axis)
Pattern in a circular direction.
separation_angle
Type: string,float,Angle
Example: Angle(90)
center_entity_or_landmark
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
normal_direction_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Part::
remesh(strategy,
amount)
Remeshing changes the shape of an entity.
strategy
Type: string
Example: 'String'
Part::
subdivide(amount)
Subdivide an entity into more components.
Part::
decimate(amount)
Decimate an entity into less components.
Part::
create_from_file(file_path,
file_type)
Imports geometry from a file.
file_path
Type: string
Example: 'String'
file_type
Type: string
Required: false
Example: 'String'
Part::
export(file_path,
overwrite,
scale)
Export Entity. Use the filePath to control the export type, e.g. '/path/to/cube.obj' or '/path/to/curve.svg'
file_path
Type: string
Example: 'String'
overwrite
Type: boolean
Default Value: True
Example: True
scale
Type: float
Default Value: 1.0
Example: 0.0
Part::
scale_xyz(x,
y,
z)
Scale in the XYZ directions. Pass a number, Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
x
Type: string,float,Dimension
Example: Dimension(0,'mm')
y
Type: string,float,Dimension
Example: Dimension(0,'mm')
z
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
scale_x(scale)
Scale in the X direction. Pass a number, Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
scale
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
scale_y(scale)
Scale in the Y direction. Pass a number, Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
scale
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
scale_z(scale)
Scale in the Z direction. Pass a number, Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
scale
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
scale_x_by_factor(scale_factor)
Scale in the X direction by a multiple.
Part::
scale_y_by_factor(scale_factor)
Scale in the Y direction by a multiple.
Part::
scale_z_by_factor(scale_factor)
Scale in the X direction by a multiple.
Part::
scale_keep_aspect_ratio(scale,
axis)
Scale in one axis and maintain the others. Pass a Dimension or Dimension-String (e.g. '2cm') to scale to a specific length.
scale
Type: string,float,Dimension
Example: Dimension(0,'mm')
axis
Type: string,int,Axis
Example: 'x'
Part::
create_landmark(landmark_name,
x,
y,
z)
Shortcut for creating and assigning a landmark to this entity. Returns a Landmark instance.
returnType: Landmark
landmark_name
Type: string
Example: 'String'
x
Type: string,float,Dimension
Example: Dimension(0,'mm')
y
Type: string,float,Dimension
Example: Dimension(0,'mm')
z
Type: string,float,Dimension
Example: Dimension(0,'mm')
Part::
get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Example: PresetLandmark.leftTop
Part::
union(other,
delete_after_union,
is_transfer_data)
Boolean union
other
Type: string,Booleanable
Example: __import__("codetocad").Part('a booleanable part')
delete_after_union
Type: boolean
Default Value: True
Example: True
is_transfer_data
Type: boolean
Example: True
Part::
subtract(other,
delete_after_subtract,
is_transfer_data)
Boolean subtraction
other
Type: string,Booleanable
Example: __import__("codetocad").Part('a booleanable part')
delete_after_subtract
Type: boolean
Default Value: True
Example: True
is_transfer_data
Type: boolean
Example: True
Part::
intersect(other,
delete_after_intersect,
is_transfer_data)
Boolean intersection
other
Type: string,Booleanable
Example: __import__("codetocad").Part('a booleanable part')
delete_after_intersect
Type: boolean
Default Value: True
Example: True
is_transfer_data
Type: boolean
Example: True