CodeToCAD Reference Sheet

Repo: https://github.com/CodeToCAD/CodeToCAD
Examples: https://codetocad.github.io/CodeToCAD/examples.html
Scalable
An entity that can be transformed by a scale.
scale_xyz()scale_x()scale_y()scale_z()scale_x_by_factor()scale_y_by_factor()scale_z_by_factor()scale_keep_aspect_ratio()
Mirrorable
An entity that can be mirrored.
mirror()
Patternable
An entity that can be patterned.
linear_pattern()circular_pattern()
Subdividable
An entity that can be broken down or scaled up into more components.
remesh()subdivide()decimate()
Importable
An entity that can be imported from a file.
create_from_file()
Exportable
An enttiy that can be exported.
export()
Projectable
This entity can be projected onto a surface
project()
Part
Capabilities related to creating and manipulating 3D shapes.
implements()create_cube()create_cone()create_cylinder()create_torus()create_sphere()create_gear()clone()union()subtract()intersect()hollow()thicken()hole()twist()set_material()is_colliding_with_part()fillet_all_edges()fillet_edges()fillet_faces()chamfer_all_edges()chamfer_edges()chamfer_faces()select_vertex_near_landmark()select_edge_near_landmark()select_face_near_landmark() constructor()is_exists()rename()delete()is_visible()set_visible()apply()get_native_instance()get_location_world()get_location_local()select()translate_xyz()translate_x()translate_y()translate_z()rotate_xyz()rotate_x()rotate_y()rotate_z()get_bounding_box()get_dimensions()create_landmark()get_landmark()
Sketch
Capabilities related to creating and manipulating 2D sketches, composed of vertices, edges and wires.
implements()constructor()clone()revolve()twist()extrude()sweep()offset()profile()create_text()create_from_vertices()create_point()create_line()create_circle()create_ellipse()create_arc()create_rectangle()create_polygon()create_trapezoid()create_spiral() constructor()is_exists()rename()delete()is_visible()set_visible()apply()get_native_instance()get_location_world()get_location_local()select()translate_xyz()translate_x()translate_y()translate_z()rotate_xyz()rotate_x()rotate_y()rotate_z()get_bounding_box()get_dimensions()create_landmark()get_landmark()
Vertex
A single point in space, or a control point.
implements()constructor()get_control_points()
Edge
A curve bounded by two Vertices.
implements()constructor()offset()fillet()set_is_construction()get_is_construction()
Wire
A collection of connected edges.
implements()constructor()clone()get_normal()get_vertices()get_is_closed()loft()
Landmark
Landmarks are named positions on an entity.
constructor()clone()get_landmark_entity_name()get_parent_entity()
Joint
Joints define the relationships and constraints between entities.
constructor()translate_landmark_onto_another()pivot()gear_ratio()limit_location_xyz()limit_location_x()limit_location_y()limit_location_z()limit_rotation_xyz()limit_rotation_x()limit_rotation_y()limit_rotation_z()
Material
Materials affect the appearance and simulation properties of the parts.
constructor()get_preset()assign_to_part()set_color()set_reflectivity()set_roughness()set_image_texture()
Animation
Animation related functionality.
constructor()default()set_frame_start()set_frame_end()set_frame_current()create_key_frame_location()create_key_frame_rotation()
Light
Manipulate a light object.
constructor()set_color()create_sun()create_spot()create_point()create_area()
Camera
Manipulate a camera object.
constructor()create_perspective()create_orthogonal()set_focal_length()
Render
Render the scene and export images or videos.
render_image()render_video_mp4()render_video_frames()set_frame_rate()set_resolution()set_render_quality()set_render_engine()set_camera()
Scene
Scene, camera, lighting, rendering, animation, simulation and GUI related functionality.
constructor()default()create()delete()is_exists()get_selected_entity()export()set_default_unit()create_group()delete_group()remove_from_group()assign_to_group()set_visible()set_background_image()
Analytics
Tools for collecting data about the entities and scene.
constructor()measure_distance()measure_angle()get_world_pose()get_bounding_box()get_dimensions()log()

Documentation

Scalable
An entity that can be transformed by a scale.
Scalable::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
y
Type: string,float,Dimension
z
Type: string,float,Dimension
Scalable::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
Scalable::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
Scalable::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
Scalable::scale_x_by_factor(scale_factor)
Scale in the X direction by a multiple.
scale_factor
Type: float
Scalable::scale_y_by_factor(scale_factor)
Scale in the Y direction by a multiple.
scale_factor
Type: float
Scalable::scale_z_by_factor(scale_factor)
Scale in the X direction by a multiple.
scale_factor
Type: float
Scalable::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
axis
Type: string,int,Axis
Mirrorable
An entity that can be mirrored.
Mirrorable::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
axis
Type: string,int,Axis
resulting_mirrored_entity_name
Type: string
Required: False
Patternable
An entity that can be patterned.
Patternable::linear_pattern(instance_count, offset, direction_axis)
Pattern in a uniform direction.
instance_count
Type: int
offset
Type: string,float,Dimension
direction_axis
Type: string,int,Axis
Default Value: z
Patternable::circular_pattern(instance_count, separation_angle, center_entity_or_landmark, normal_direction_axis)
Pattern in a circular direction.
instance_count
Type: int
separation_angle
Type: string,float,Angle
center_entity_or_landmark
Type: string,Entity
normal_direction_axis
Type: string,int,Axis
Default Value: z
Subdividable
An entity that can be broken down or scaled up into more components.
Subdividable::remesh(strategy, amount)
Remeshing changes the shape of an entity.
strategy
Type: string
amount
Type: float
Subdividable::subdivide(amount)
Subdivide an entity into more components.
amount
Type: float
Subdividable::decimate(amount)
Decimate an entity into less components.
amount
Type: float
Importable
An entity that can be imported from a file.
Importable::create_from_file(file_path, file_type)
Imports geometry from a file.
file_path
Type: string
file_type
Type: string
Required: False
Exportable
An enttiy that can be exported.
Exportable::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
overwrite
Type: boolean
Default Value: True
scale
Type: float
Default Value: 1.0
Projectable
This entity can be projected onto a surface
Projectable::project(project_onto)
Project this entity onto another
returnType: Projectable
project_onto
Information: Sketch to project onto
Type: Sketch
Required: True
Part
Capabilities related to creating and manipulating 3D shapes.
Part::implements() Part::create_cube(width, length, height, keyword_arguments)
Adds cuboid geometry to a part.
width
Type: string,float,Dimension
length
Type: string,float,Dimension
height
Type: string,float,Dimension
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
Part::create_cone(radius, height, draft_radius, keyword_arguments)
Adds cone geometry to a part.
radius
Type: string,float,Dimension
height
Type: string,float,Dimension
draft_radius
Type: string,float,Dimension
Default Value: 0
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
Part::create_cylinder(radius, height, keyword_arguments)
Adds cylinder geometry to a part.
radius
Type: string,float,Dimension
height
Type: string,float,Dimension
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
Part::create_torus(inner_radius, outer_radius, keyword_arguments)
Adds torus geometry to a part.
inner_radius
Type: string,float,Dimension
outer_radius
Type: string,float,Dimension
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
Part::create_sphere(radius, keyword_arguments)
Adds sphere geometry to a part.
radius
Type: string,float,Dimension
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
Part::create_gear(outer_radius, addendum, inner_radius, dedendum, height, pressure_angle, number_of_teeth, skew_angle, conical_angle, crown_angle, keyword_arguments)
Adds gear geometry to a part.
outer_radius
Type: string,float,Dimension
addendum
Type: string,float,Dimension
inner_radius
Type: string,float,Dimension
dedendum
Type: string,float,Dimension
height
Type: string,float,Dimension
pressure_angle
Type: string,float,Angle
Default Value: 20d
number_of_teeth
Type: int
Default Value: 12
skew_angle
Type: string,float,Angle
Default Value: 0
conical_angle
Type: string,float,Angle
Default Value: 0
crown_angle
Type: string,float,Angle
Default Value: 0
keyword_arguments
Information: key-value pairs to pass onto the native api
Type: object
Required: False
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
copy_landmarks
Type: boolean
Default Value: True
Part::union(with_part, delete_after_union, is_transfer_landmarks)
Boolean union
with_part
Type: string,Part
delete_after_union
Type: boolean
Default Value: True
is_transfer_landmarks
Type: boolean
Default Value: False
Part::subtract(with_part, delete_after_subtract, is_transfer_landmarks)
Boolean subtraction
with_part
Type: string,Part
delete_after_subtract
Type: boolean
Default Value: True
is_transfer_landmarks
Type: boolean
Default Value: False
Part::intersect(with_part, delete_after_intersect, is_transfer_landmarks)
Boolean intersection
with_part
Type: string,Part
delete_after_intersect
Type: boolean
Default Value: True
is_transfer_landmarks
Type: boolean
Default Value: False
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
thickness_y
Type: string,float,Dimension
thickness_z
Type: string,float,Dimension
start_axis
Type: string,int,Axis
Default Value: z
flip_axis
Type: boolean
Default Value: False
Part::thicken(radius)
Uniformly add a wall around a Part.
radius
Type: string,float,Dimension
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
radius
Type: string,float,Dimension
depth
Type: string,float,Dimension
normal_axis
Type: string,int,Axis
Default Value: z
flip_axis
Type: boolean
Default Value: False
initial_rotation_x
Type: string,float,Angle
Default Value: 0.0
initial_rotation_y
Type: string,float,Angle
Default Value: 0.0
initial_rotation_z
Type: string,float,Angle
Default Value: 0.0
mirror_about_entity_or_landmark
Type: string,Entity
Required: False
mirror_axis
Type: string,int,Axis
Default Value: x
mirror
Type: boolean
Default Value: False
circular_pattern_instance_count
Type: int
Default Value: 1
circular_pattern_instance_separation
Type: string,float,Angle
Default Value: 0.0
circular_pattern_instance_axis
Type: string,int,Axis
Default Value: z
circular_pattern_about_entity_or_landmark
Type: string,Entity
Required: False
linear_pattern_instance_count
Type: int
Default Value: 1
linear_pattern_instance_separation
Type: string,float,Dimension
Default Value: 0.0
linear_pattern_instance_axis
Type: string,int,Axis
Default Value: x
linear_pattern2nd_instance_count
Type: int
Default Value: 1
linear_pattern2nd_instance_separation
Type: string,float,Dimension
Default Value: 0.0
linear_pattern2nd_instance_axis
Type: string,int,Axis
Default Value: y
Part::twist(angle, screw_pitch, iterations, axis)
AKA Helix, Screw. Revolve an entity
angle
Type: string,float,Angle
screw_pitch
Type: string,float,Dimension
iterations
Type: int
Default Value: 1
axis
Type: string,int,Axis
Default Value: z
Part::set_material(material_name)
Assign a known material to this part.
material_name
Type: string,Material
Part::is_colliding_with_part(other_part)
Check if this part is colliding with another.
returnType: boolean
other_part
Type: string,Part
Part::fillet_all_edges(radius, use_width)
Fillet all edges.
radius
Type: string,float,Dimension
use_width
Type: boolean
Default Value: False
Part::fillet_edges(radius, landmarks_near_edges, use_width)
Fillet specific edges.
radius
Type: string,float,Dimension
landmarks_near_edges
Type: list[string,Landmark]
use_width
Type: boolean
Default Value: False
Part::fillet_faces(radius, landmarks_near_faces, use_width)
Fillet specific faces.
radius
Type: string,float,Dimension
landmarks_near_faces
Type: list[string,Landmark]
use_width
Type: boolean
Default Value: False
Part::chamfer_all_edges(radius)
Chamfer all edges.
radius
Type: string,float,Dimension
Part::chamfer_edges(radius, landmarks_near_edges)
Chamfer specific edges.
radius
Type: string,float,Dimension
landmarks_near_edges
Type: list[string,Landmark]
Part::chamfer_faces(radius, landmarks_near_faces)
Chamfer specific faces.
radius
Type: string,float,Dimension
landmarks_near_faces
Type: list[string,Landmark]
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
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
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
Part::constructor(name, description, native_instance)
name
Type: string
description
Type: string
Required: False
native_instance
Information: A cached instance of the native object. This may become stale.
Type: any
Required: False
Part::is_exists()
Check if an entity exists
returnType: boolean
Part::rename(new_name, renamelinked_entities_and_landmarks)
Rename the entity, with an option to rename linked landmarks and underlying data.
new_name
Type: string
renamelinked_entities_and_landmarks
Type: boolean
Default Value: True
Part::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
Part::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Part::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Part::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
scale
Type: boolean
Default Value: True
location
Type: boolean
Default Value: False
modifiers
Type: boolean
Default Value: True
Part::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::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Part::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Part::select()
Select the entity (in UI).
Part::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
y
Type: string,float,Dimension
z
Type: string,float,Dimension
Part::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
Part::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
Part::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
Part::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
y
Type: string,float,Angle
z
Type: string,float,Angle
Part::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
Part::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
Part::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
Part::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Part::get_dimensions()
Get the length span in each point axis (X,Y,Z).
returnType: Dimensions
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
x
Type: string,float,Dimension
y
Type: string,float,Dimension
z
Type: string,float,Dimension
Part::get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Sketch
Capabilities related to creating and manipulating 2D sketches, composed of vertices, edges and wires.
Sketch::implements() Sketch::constructor(name, curve_type, description)
name
Type: string
curve_type
Type: CurveTypes
Required: False
description
Type: string
Required: False
Sketch::clone(new_name, copy_landmarks)
Clone an existing sketch with its geometry and properties. Returns the new Sketch.
returnType: Sketch
new_name
Type: string
copy_landmarks
Type: boolean
Default Value: True
Sketch::revolve(angle, about_entity_or_landmark, axis)
Revolve a Sketch around another Entity or Landmark
returnType: Part
angle
Type: string,float,Angle
about_entity_or_landmark
Type: string,Entity
axis
Type: string,int,Axis
Default Value: z
Sketch::twist(angle, screw_pitch, iterations, axis)
AKA Helix, Screw.
angle
Type: string,float,Angle
screw_pitch
Type: string,float,Dimension
iterations
Type: int
Default Value: 1
axis
Type: string,int,Axis
Default Value: z
Sketch::extrude(length)
Extrude a curve by a specified length. Returns a Part type.
returnType: Part
length
Type: string,float,Dimension
Sketch::sweep(profile_name_or_instance, fill_cap)
Extrude this Sketch along the path of another Sketch
returnType: Part
profile_name_or_instance
Type: string,Sketch
fill_cap
Type: boolean
Default Value: True
Sketch::offset(radius)
Uniformly add a wall around a Sketch.
radius
Type: string,float,Dimension
Sketch::profile(profile_curve_name)
Bend this curve along the path of another
profile_curve_name
Type: string
Sketch::create_text(text, font_size, bold, italic, underlined, character_spacing, word_spacing, line_spacing, font_file_path)
Adds text to a sketch.
text
Type: string
font_size
Type: string,float,Dimension
Default Value: 1.0
bold
Type: boolean
Default Value: False
italic
Type: boolean
Default Value: False
underlined
Type: boolean
Default Value: False
character_spacing
Type: int
Default Value: 1
word_spacing
Type: int
Default Value: 1
line_spacing
Type: int
Default Value: 1
font_file_path
Type: string
Default Value: None
Required: False
Sketch::create_from_vertices(points)
Create a curve from 2D/3D points.
returnType: Wire
points
Type: list[string,list[string],list[float],list[Dimension],Point,Vertex]
Sketch::create_point(point)
Create a point
returnType: Vertex
point
Type: string,list[string],list[float],list[Dimension],Point
Sketch::create_line(start_at, end_at)
Create a line between two points
returnType: Edge
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
end_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
Sketch::create_circle(radius)
Create a circle
returnType: Wire
radius
Type: string,float,Dimension
Sketch::create_ellipse(radius_minor, radius_major)
Create an ellipse
returnType: Wire
radius_minor
Type: string,float,Dimension
radius_major
Type: string,float,Dimension
Sketch::create_arc(start_at, end_at, radius, flip)
Create an arc. The radius is the distance from the center of the circle that forms the arc, to the chord tying start_at and end_at.
returnType: Wire
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
end_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
radius
Information: The radius is the distance from the center of the circle that forms the arc, to the chord tying start_at and end_at.
Type: string,float,Dimension
flip
Type: boolean
Default Value: False
Required: False
Sketch::create_rectangle(length, width)
Create a rectangle
returnType: Wire
length
Type: string,float,Dimension
width
Type: string,float,Dimension
Sketch::create_polygon(number_of_sides, length, width)
Create an n-gon
returnType: Wire
number_of_sides
Type: int
length
Type: string,float,Dimension
width
Type: string,float,Dimension
Sketch::create_trapezoid(length_upper, length_lower, height)
Create a trapezoid
returnType: Wire
length_upper
Type: string,float,Dimension
length_lower
Type: string,float,Dimension
height
Type: string,float,Dimension
Sketch::create_spiral(number_of_turns, height, radius, is_clockwise, radius_end)
Create a spiral or helix
returnType: Wire
number_of_turns
Type: int
height
Type: string,float,Dimension
radius
Type: string,float,Dimension
is_clockwise
Type: boolean
Default Value: True
radius_end
Information: Specify a radiusEnd to make a conical or drafted spiral. Pass None to make a cylindrical spiral.
Type: string,float,Dimension
Required: False
Sketch::constructor(name, description, native_instance)
name
Type: string
description
Type: string
Required: False
native_instance
Information: A cached instance of the native object. This may become stale.
Type: any
Required: False
Sketch::is_exists()
Check if an entity exists
returnType: boolean
Sketch::rename(new_name, renamelinked_entities_and_landmarks)
Rename the entity, with an option to rename linked landmarks and underlying data.
new_name
Type: string
renamelinked_entities_and_landmarks
Type: boolean
Default Value: True
Sketch::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
Sketch::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Sketch::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Sketch::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
scale
Type: boolean
Default Value: True
location
Type: boolean
Default Value: False
modifiers
Type: boolean
Default Value: True
Sketch::get_native_instance()
Get the native API's object instance. For example, in Blender API, this would return a bpy.object instance.
returnType: any
Sketch::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Sketch::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Sketch::select()
Select the entity (in UI).
Sketch::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
y
Type: string,float,Dimension
z
Type: string,float,Dimension
Sketch::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
Sketch::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
Sketch::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
Sketch::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
y
Type: string,float,Angle
z
Type: string,float,Angle
Sketch::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
Sketch::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
Sketch::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
Sketch::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Sketch::get_dimensions()
Get the length span in each point axis (X,Y,Z).
returnType: Dimensions
Sketch::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
x
Type: string,float,Dimension
y
Type: string,float,Dimension
z
Type: string,float,Dimension
Sketch::get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Vertex
A single point in space, or a control point.
Vertex::implements() Vertex::constructor(location, parent_entity)
location
Information: Point coordinates of a vertex.
Type: Point
parent_entity
Type: string,Entity
Required: False
Vertex::get_control_points(parameter)
Get a vertex's curve control points. This may not be applicable in several situations.
returnType: list[Vertex]
parameter
Information:
Type:
Default Value:
Required: False
Edge
A curve bounded by two Vertices.
Edge::implements() Edge::constructor(v1, v2, parent_entity)
v1
Type: Vertex
v2
Type: Vertex
parent_entity
Type: string,Entity
Required: False
Edge::offset(distance)
Clone and offset this edge a distance away from this one.
returnType: Edge
distance
Type: string,float,Dimension
Edge::fillet(other_edge, amount)
Fillet this and another edge.
other_edge
Type: Edge
amount
Type: string,float,Angle
Edge::set_is_construction(is_construction)
Mark this edge for construction only.
is_construction
Type: boolean
Edge::get_is_construction()
Check if this edge is for construction only.
returnType: boolean
Wire
A collection of connected edges.
Wire::implements() Wire::constructor(edges, parent_entity)
edges
Information: A collection of edges
Type: list[Edge]
parent_entity
Type: string,Entity
Required: False
Wire::clone(new_name, new_parent)
Clone an existing Wire with an option to assign to a new Sketch. Returns the new Wire.
returnType: Wire
new_name
Type: string
new_parent
Type: string,Sketch
Required: False
Wire::get_normal(flip)
Get the normal created by this wire. Must be a closed wire.
returnType: Point
flip
Information: Flip the normal direction.
Type: boolean
Default Value: False
Required: False
Wire::get_vertices()
Collapse all edges' vertices into one list.
returnType: list[Vertex]
Wire::get_is_closed()
Checks if a wire is closed. Note: A closed wire is a Face or Surface.
returnType: boolean
Wire::loft(other, new_part_name)
Create a surface between two Wires (Faces). If new_part_name is not provided, the two Wires' parents and the surface will be boolean union'ed, and the resulting Part will take the name of the first wire.
returnType: Part
other
Information: The other wire/face to loft to.
Type: Wire
new_part_name
Information: If provided, the resulting part will not be merged with the parent of this wire/face.
Type: string
Required: False
Landmark
Landmarks are named positions on an entity.
Landmark::constructor(name, parent_entity, description)
name
Type: string
Required: True
parent_entity
Type: string,Entity
Required: True
description
Type: string
Required: False
Landmark::clone(new_name, offset, new_parent)
Clone an existing Landmark with an optional offset, and reassignment to a different parent. Returns the new Landmark.
returnType: Landmark
new_name
Type: string
offset
Type: string,list[string],list[float],list[Dimension],Dimensions
Required: False
new_parent
Type: string,Entity
Required: False
Landmark::get_landmark_entity_name()
Get the landmark object name in the scene, which may be different to the name of the landmark when it was first created. For example, the generated name may be {parentName}_{landmarkName}.
returnType: string
Landmark::get_parent_entity()
Get the name of the entity this landmark belongs to.
returnType: Entity
Joint
Joints define the relationships and constraints between entities.
Joint::constructor(entity1, entity2)
entity1
Type: string,Entity
entity2
Type: string,Entity
Joint::translate_landmark_onto_another()
Transforms one landmark onto another
Joint::pivot()
Constraint the rotation origin of entity B to entity A's landmark.
Joint::gear_ratio(ratio)
Constraint the rotation of entity B to be a percentage of entity A's
ratio
Type: float
Joint::limit_location_xyz(x, y, z)
Constraint the translation of entity B, relative to entity A's landmark.
x
Type: string,float,Dimension
Required: False
y
Type: string,float,Dimension
Required: False
z
Type: string,float,Dimension
Required: False
Joint::limit_location_x(min, max)
Constraint the translation of entity B, relative to entity A's landmark.
min
Type: string,float,Dimension
Required: False
max
Type: string,float,Dimension
Required: False
Joint::limit_location_y(min, max)
Constraint the translation of entity B, relative to entity A's landmark.
min
Type: string,float,Dimension
Required: False
max
Type: string,float,Dimension
Required: False
Joint::limit_location_z(min, max)
Constraint the translation of entity B, relative to entity A's landmark.
min
Type: string,float,Dimension
Required: False
max
Type: string,float,Dimension
Required: False
Joint::limit_rotation_xyz(x, y, z)
Constraint the rotation of entity B, relative to entity A's landmark.
x
Type: string,float,Angle
Required: False
y
Type: string,float,Angle
Required: False
z
Type: string,float,Angle
Required: False
Joint::limit_rotation_x(min, max)
Constraint the rotation of entity B, relative to entity A's landmark.
min
Type: string,float,Angle
Required: False
max
Type: string,float,Angle
Required: False
Joint::limit_rotation_y(min, max)
Constraint the rotation of entity B, relative to entity A's landmark.
min
Type: string,float,Angle
Required: False
max
Type: string,float,Angle
Required: False
Joint::limit_rotation_z(min, max)
Constraint the rotation of entity B, relative to entity A's landmark.
min
Type: string,float,Angle
Required: False
max
Type: string,float,Angle
Required: False
Material
Materials affect the appearance and simulation properties of the parts.
Material::constructor(name, description)
name
Type: string
description
Type: string
Required: False
Material::get_preset(parameter)
Get a material from a preset
returnType: Material
parameter
Information: A PresetMaterial name or instance
Type: PresetMaterial
Required: True
Material::assign_to_part(part_name_or_instance)
Assigns the material to a part.
part_name_or_instance
Type: string,Part
Material::set_color(r_value, g_value, b_value, a_value)
Set the RGBA color of an entity. Supports 0-255 int or 0.0-1.0 float values.
r_value
Type: int,float
g_value
Type: int,float
b_value
Type: int,float
a_value
Type: int,float
Default Value: 1.0
Material::set_reflectivity(reflectivity)
Change the surface reflectivity (metallic luster) of the material.
reflectivity
Information: A float value between 0.0-1.0
Type: float
Required: True
Material::set_roughness(roughness)
Change the surface roughness of the material.
roughness
Information: A float value between 0.0-1.0
Type: float
Required: True
Material::set_image_texture(image_file_path)
Add a texture from an image file.
image_file_path
Type: string
Animation
Animation related functionality.
Animation::constructor() Animation::default()
Get an Animation instance for the current scene.
returnType: Animation
Animation::set_frame_start(frame_number)
Set the start animation frame in the scene.
frame_number
Type: int
Animation::set_frame_end(frame_number)
Set the end animation frame in the scene.
frame_number
Type: int
Animation::set_frame_current(frame_number)
Set the current animation frame in the scene.
frame_number
Type: int
Animation::create_key_frame_location(entity, frame_number)
Create an animation key-frame using the location of the entity.
entity
Type: string,Entity
frame_number
Type: int
Animation::create_key_frame_rotation(entity, frame_number)
Create an animation key-frame using the rotation of the entity.
entity
Type: string,Entity
frame_number
Type: int
Light
Manipulate a light object.
Light::constructor(name, description)
name
Type: string
description
Type: string
Required: False
Light::set_color(r_value, g_value, b_value)
Set the color of an existing light.
r_value
Type: int,float
g_value
Type: int,float
b_value
Type: int,float
Light::create_sun(energy_level)
Create a Sun-type light.
energy_level
Type: float
Light::create_spot(energy_level)
Create a Spot-type light.
energy_level
Type: float
Light::create_point(energy_level)
Create a Point-type light.
energy_level
Type: float
Light::create_area(energy_level)
Create an Area-type light.
energy_level
Type: float
Camera
Manipulate a camera object.
Camera::constructor(name, description)
name
Type: string
description
Type: string
Required: False
Camera::create_perspective()
Create a perspective camera in the scene.
Camera::create_orthogonal()
Create an orthogonal camera in the scene.
Camera::set_focal_length(length)
Set the focal length of the camera.
length
Type: float
Render
Render the scene and export images or videos.
Render::render_image(output_file_path, overwrite, file_type)
Render a still image.
output_file_path
Type: string
Required: True
overwrite
Type: boolean
Default Value: True
file_type
Type: string
Required: False
Render::render_video_mp4(output_file_path, start_frame_number, end_frame_number, step_frames, overwrite)
Render an MP4 video.
output_file_path
Type: string
Required: True
start_frame_number
Type: int
Default Value: 1
end_frame_number
Type: int
Default Value: 100
step_frames
Type: int
Default Value: 1
overwrite
Type: boolean
Default Value: True
Render::render_video_frames(output_folder_path, file_name_prefix, start_frame_number, end_frame_number, step_frames, overwrite, file_type)
Render a video as image frame stills.
output_folder_path
Type: string
Required: True
file_name_prefix
Type: string
Required: True
start_frame_number
Type: int
Default Value: 1
end_frame_number
Type: int
Default Value: 100
step_frames
Type: int
Default Value: 1
overwrite
Type: boolean
Default Value: True
file_type
Type: string
Required: False
Render::set_frame_rate(frame_rate)
Set rendering framerate.
frame_rate
Type: int
Required: True
Render::set_resolution(x, y)
Set rendering resolution
x
Type: int
Required: True
y
Type: int
Required: True
Render::set_render_quality(quality)
Set rendering quality.
quality
Information: A value between 0 and 100
Type: int
Required: True
Render::set_render_engine(name)
Set rendering engine name.
name
Type: string
Required: True
Render::set_camera(camera_name_or_instance)
Set the rendering camera.
camera_name_or_instance
Information: The camera name or Camera class instance.
Type: string,Camera
Scene
Scene, camera, lighting, rendering, animation, simulation and GUI related functionality.
Scene::constructor(name, description)
name
Type: string
Required: False
description
Type: string
Required: False
Scene::default()
Get a Scene instance for the current scene.
returnType: Scene
Scene::create()
Creates a new scene.
Scene::delete()
Deletes a scene.
Scene::is_exists()
Check if the scene exists
returnType: boolean
Scene::get_selected_entity()
Get the selected entity in the Scene.
returnType: Entity
Scene::export(file_path, entities, overwrite, scale)
Export the entire scene or specific entities.
file_path
Type: string
entities
Type: list[string,Exportable]
overwrite
Type: boolean
Default Value: True
scale
Type: float
Default Value: 1.0
Scene::set_default_unit(unit)
Set the document's default measurements system.
unit
Type: string,LengthUnit
Scene::create_group(name)
Create a new group
name
Type: string
Scene::delete_group(name, remove_children)
Delete a new group
name
Type: string
remove_children
Type: boolean
Scene::remove_from_group(entity_name, group_name)
Removes an existing entity from a group
entity_name
Type: string
group_name
Type: string
Scene::assign_to_group(entities, group_name, remove_from_other_groups)
Assigns an existing entity to a new group
entities
Type: list[string,Entity]
group_name
Type: string
remove_from_other_groups
Type: boolean
Default Value: True
Required: False
Scene::set_visible(entities, is_visible)
Change the visibiltiy of the entity.
entities
Type: list[string,Entity]
is_visible
Type: boolean
Scene::set_background_image(file_path, location_x, location_y)
Set the scene background image. This can be an image or an HDRI texture.
file_path
Type: string
location_x
Type: string,float,Dimension
Default Value: 0
Required: False
location_y
Type: string,float,Dimension
Default Value: 0
Required: False
Analytics
Tools for collecting data about the entities and scene.
Analytics::constructor() Analytics::measure_distance(entity1, entity2)
The ubiquitous ruler.
returnType: Dimensions
entity1
Type: string,Entity
entity2
Type: string,Entity
Analytics::measure_angle(entity1, entity2, pivot)
The ubiquitous ruler.
returnType: list[Angle]
entity1
Type: string,Entity
entity2
Type: string,Entity
pivot
Type: string,Entity
Required: False
Analytics::get_world_pose(entity)
Returns the world pose of an entity.
returnType: list[float]
entity
Type: string,Entity
Analytics::get_bounding_box(entity_name)
Returns the bounding box of an entity.
returnType: BoundaryBox
entity_name
Type: string,Entity
Analytics::get_dimensions(entity_name)
Returns the dimensions of an entity.
returnType: Dimensions
entity_name
Type: string,Entity
Analytics::log(message)
Write a message
message
Type: string