CodeToCAD Reference Sheet

Repo: https://github.com/CodeToCAD/CodeToCAD
Examples: https://codetocad.github.io/CodeToCAD/examples.html
Filter: Blender Fusion360 Onshape
Legend:
Unsupported
Planned
Partial
Supported
Part
Capabilities related to creating and manipulating 3D shapes.
create_cube() create_cone() create_cylinder() create_torus() create_sphere() create_gear() create_text() clone() 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() 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() mirror() linear_pattern() circular_pattern() remesh() subdivide() decimate() create_from_file() export() scale_xyz() scale_x() scale_y() scale_z() scale_x_by_factor() scale_y_by_factor() scale_z_by_factor() scale_keep_aspect_ratio() create_landmark() get_landmark() union() subtract() intersect()
Sketch
Capabilities related to creating and manipulating 2D sketches, composed of vertices, edges and wires.
get_wires() clone() create_text() create_from_vertices() create_point() create_line() create_line_to() create_circle() create_ellipse() create_arc() create_rectangle() create_polygon() create_trapezoid() create_spiral() 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() mirror() linear_pattern() circular_pattern() create_from_file() export() scale_xyz() scale_x() scale_y() scale_z() scale_x_by_factor() scale_y_by_factor() scale_z_by_factor() scale_keep_aspect_ratio() project() create_landmark() get_landmark()
Vertex
A single point in space, or a control point.
get_control_points() set_control_points() 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() project()
Edge
A curve bounded by two Vertices.
offset() fillet() set_is_construction() get_is_construction() 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() mirror() linear_pattern() circular_pattern() remesh() subdivide() decimate() project() create_landmark() get_landmark()
Wire
A collection of connected edges.
get_normal() get_edges() get_vertices() get_is_closed() loft() revolve() twist() extrude() sweep() offset() profile() create_from_vertices() create_point() create_line() create_line_to() create_arc() 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() mirror() linear_pattern() circular_pattern() project() create_landmark() get_landmark() union() subtract() intersect() remesh() subdivide() decimate()
Landmark
Landmarks are named positions on an entity.
clone() get_landmark_entity_name() get_parent_entity() 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()
Joint
Joints define the relationships and constraints between entities.
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.
get_preset() set_color() set_reflectivity() set_roughness() set_image_texture()
Animation
Animation related functionality.
default() set_frame_start() set_frame_end() set_frame_current() create_key_frame_location() create_key_frame_rotation()
Light
Manipulate a light object.
set_color() create_sun() create_spot() create_point() create_area() 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()
Camera
Manipulate a camera object.
create_perspective() create_orthogonal() create_panoramic() set_focal_length() 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()
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.
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.
measure_distance() measure_angle() get_world_pose() get_bounding_box() get_dimensions() log()

Documentation

Part
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.
instance_count
Type: int
Example: 0
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.
instance_count
Type: int
Example: 0
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'
amount
Type: float
Example: 0.0
Part::subdivide(amount)
Subdivide an entity into more components.
amount
Type: float
Example: 0.0
Part::decimate(amount)
Decimate an entity into less components.
amount
Type: float
Example: 0.0
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.
scale_factor
Type: float
Example: 0.0
Part::scale_y_by_factor(scale_factor)
Scale in the Y direction by a multiple.
scale_factor
Type: float
Example: 0.0
Part::scale_z_by_factor(scale_factor)
Scale in the X direction by a multiple.
scale_factor
Type: float
Example: 0.0
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
Sketch
Capabilities related to creating and manipulating 2D sketches, composed of vertices, edges and wires.
Sketch::get_wires()
Get a list of Wires in this Sketch.
returnType: list[Wire]
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
Example: 'String'
copy_landmarks
Type: boolean
Default Value: True
Example: True
Sketch::create_text(text, font_size, bold, italic, underlined, character_spacing, word_spacing, line_spacing, font_file_path, center_at, profile_curve_name)
Adds text to a sketch.
text
Type: string
Example: 'String'
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'
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
profile_curve_name
Type: string,Wire,Sketch
Required: false
Example: Wire('a wire',[])
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]
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_point(point)
Create a point
returnType: Wire
point
Type: string,list[string],list[float],list[Dimension],Point
Example: Point.from_list_of_float_or_string([0,0,0])
Sketch::create_line(length, angle, start_at)
Create a line between two points
returnType: Wire
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
angle
Type: string,float,Angle
Example: Angle(90)
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_line_to(to, start_at)
Create a line between two points
returnType: Wire
to
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Example: ['Point.from_list_of_float_or_string([0,0,0])']
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_circle(radius, center_at)
Create a circle
returnType: Wire
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_ellipse(radius_minor, radius_major, center_at)
Create an ellipse
returnType: Wire
radius_minor
Type: string,float,Dimension
Example: Dimension(0,'mm')
radius_major
Type: string,float,Dimension
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_arc(end_at, radius, start_at, 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
end_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
Example: Point.from_list_of_float_or_string([0,0,0])
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
Example: Dimension(0,'mm')
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
flip
Type: boolean
Required: false
Example: True
Sketch::create_rectangle(length, width, center_at)
Create a rectangle
returnType: Wire
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
width
Type: string,float,Dimension
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_polygon(number_of_sides, length, width, center_at)
Create an n-gon
returnType: Wire
number_of_sides
Type: int
Example: 0
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
width
Type: string,float,Dimension
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_trapezoid(length_upper, length_lower, height, center_at)
Create a trapezoid
returnType: Wire
length_upper
Type: string,float,Dimension
Example: Dimension(0,'mm')
length_lower
Type: string,float,Dimension
Example: Dimension(0,'mm')
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch::create_spiral(number_of_turns, height, radius, is_clockwise, radius_end, center_at)
Create a spiral or helix
returnType: Wire
number_of_turns
Type: int
Example: 0
height
Type: string,float,Dimension
Example: Dimension(0,'mm')
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
is_clockwise
Type: boolean
Default Value: True
Example: 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
Example: Dimension(0,'mm')
center_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Sketch-Entity::is_exists()
Check if an entity exists
returnType: boolean
Sketch-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
Sketch-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
Sketch-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Sketch-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Sketch-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
Sketch-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
Sketch-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Sketch-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Sketch-Entity::select()
Select the entity (in UI).
Sketch-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')
Sketch-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')
Sketch-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')
Sketch-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')
Sketch-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)
Sketch-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)
Sketch-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)
Sketch-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)
Sketch-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Sketch-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Sketch::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'
Sketch::linear_pattern(instance_count, offset, direction_axis)
Pattern in a uniform direction.
instance_count
Type: int
Example: 0
offset
Type: string,float,Dimension
Example: Dimension(0,'mm')
direction_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Sketch::circular_pattern(instance_count, separation_angle, center_entity_or_landmark, normal_direction_axis)
Pattern in a circular direction.
instance_count
Type: int
Example: 0
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'
Sketch::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'
Sketch::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
Sketch::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')
Sketch::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')
Sketch::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')
Sketch::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')
Sketch::scale_x_by_factor(scale_factor)
Scale in the X direction by a multiple.
scale_factor
Type: float
Example: 0.0
Sketch::scale_y_by_factor(scale_factor)
Scale in the Y direction by a multiple.
scale_factor
Type: float
Example: 0.0
Sketch::scale_z_by_factor(scale_factor)
Scale in the X direction by a multiple.
scale_factor
Type: float
Example: 0.0
Sketch::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'
Sketch::project(project_from)
Project another entity onto this one.
returnType: Projectable
project_from
Information: Projectable to project from. The other shape will be copied to this one.
Type: Projectable
Example: __import__("codetocad").Sketch('a projected sketch')
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
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')
Sketch::get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Example: PresetLandmark.leftTop
Vertex
A single point in space, or a control point.
Vertex::get_control_points()
Get a vertex's curve control points. This may not be applicable for some curve types.
returnType: list[Point]
Vertex::set_control_points(points)
Set a vertex's curve control points. This may not be applicable for some curve types.
points
Information: A list of Points or coordinates describing the control points. The list must be the same size as the list returned by get_control_points().
Type: list[string,list[string],list[float],list[Dimension],Point]
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Vertex-Entity::is_exists()
Check if an entity exists
returnType: boolean
Vertex-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
Vertex-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
Vertex-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Vertex-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Vertex-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
Vertex-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
Vertex-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Vertex-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Vertex-Entity::select()
Select the entity (in UI).
Vertex-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')
Vertex-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')
Vertex-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')
Vertex-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')
Vertex-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)
Vertex-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)
Vertex-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)
Vertex-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)
Vertex-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Vertex-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Vertex::project(project_from)
Project another entity onto this one.
returnType: Projectable
project_from
Information: Projectable to project from. The other shape will be copied to this one.
Type: Projectable
Example: __import__("codetocad").Sketch('a projected sketch')
Edge
A curve bounded by two Vertices.
Edge::offset(distance)
Clone and offset this edge a distance away from this one. This returns a new edge in the same sketch.
returnType: Edge
distance
Type: string,float,Dimension
Example: Dimension(0,'mm')
Edge::fillet(other_edge, amount)
Fillet this and another edge.
other_edge
Type: Edge
Example: Edge(v1=Vertex('a vertex', Point.from_list_of_float_or_string([0,0,0])), v2=Vertex('a vertex', Point.from_list_of_float_or_string([0,0,0])), name='an edge')
amount
Type: string,float,Angle
Example: Angle(90)
Edge::set_is_construction(is_construction)
Mark this edge for construction only.
is_construction
Type: boolean
Example: True
Edge::get_is_construction()
Check if this edge is for construction only.
returnType: boolean
Edge-Entity::is_exists()
Check if an entity exists
returnType: boolean
Edge-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
Edge-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
Edge-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Edge-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Edge-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
Edge-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
Edge-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Edge-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Edge-Entity::select()
Select the entity (in UI).
Edge-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')
Edge-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')
Edge-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')
Edge-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')
Edge-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)
Edge-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)
Edge-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)
Edge-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)
Edge-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Edge-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Edge::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'
Edge::linear_pattern(instance_count, offset, direction_axis)
Pattern in a uniform direction.
instance_count
Type: int
Example: 0
offset
Type: string,float,Dimension
Example: Dimension(0,'mm')
direction_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Edge::circular_pattern(instance_count, separation_angle, center_entity_or_landmark, normal_direction_axis)
Pattern in a circular direction.
instance_count
Type: int
Example: 0
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'
Edge::remesh(strategy, amount)
Remeshing changes the shape of an entity.
strategy
Type: string
Example: 'String'
amount
Type: float
Example: 0.0
Edge::subdivide(amount)
Subdivide an entity into more components.
amount
Type: float
Example: 0.0
Edge::decimate(amount)
Decimate an entity into less components.
amount
Type: float
Example: 0.0
Edge::project(project_from)
Project another entity onto this one.
returnType: Projectable
project_from
Information: Projectable to project from. The other shape will be copied to this one.
Type: Projectable
Example: __import__("codetocad").Sketch('a projected sketch')
Edge::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')
Edge::get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Example: PresetLandmark.leftTop
Wire
A collection of connected edges.
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
Required: false
Example: True
Wire::get_edges()
Return references to all the edges making up this wire.
returnType: list[Edge]
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
Example: Wire('a 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
Example: 'String'
Wire::revolve(angle, about_entity_or_landmark, axis)
Revolve a Wire around another Entity or Landmark
returnType: Part
angle
Type: string,float,Angle
Example: Angle(90)
about_entity_or_landmark
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Wire::twist(angle, screw_pitch, iterations, axis)
AKA Helix, Screw.
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'
Wire::extrude(length)
Extrude a curve by a specified length. Returns a Part type.
returnType: Part
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
Wire::sweep(profile_name_or_instance, fill_cap)
Extrude this Wire along the path of another Wire
returnType: Part
profile_name_or_instance
Type: string,Wire
Example: Wire('a wire',[])
fill_cap
Type: boolean
Default Value: True
Example: True
Wire::offset(radius)
Uniformly add a wall around a Wire. This returns a new wire in the same sketch.
returnType: Wire
radius
Type: string,float,Dimension
Example: Dimension(0,'mm')
Wire::profile(profile_curve_name)
Bend this curve along the path of another
profile_curve_name
Type: string,Wire,Sketch
Example: Wire('a wire',[])
Wire::create_from_vertices(points)
Create a curve from 2D/3D points.
points
Type: list[string,list[string],list[float],list[Dimension],Point,Vertex]
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Wire::create_point(point)
Create a point
point
Type: string,list[string],list[float],list[Dimension],Point
Example: Point.from_list_of_float_or_string([0,0,0])
Wire::create_line(length, angle, start_at)
Create a line between two points
length
Type: string,float,Dimension
Example: Dimension(0,'mm')
angle
Type: string,float,Angle
Example: Angle(90)
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Wire::create_line_to(to, start_at)
Create a line between two points
to
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Example: ['Point.from_list_of_float_or_string([0,0,0])']
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
Wire::create_arc(end_at, radius, start_at, 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.
end_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex
Example: Point.from_list_of_float_or_string([0,0,0])
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
Example: Dimension(0,'mm')
start_at
Type: string,list[string],list[float],list[Dimension],Point,Vertex,Landmark,PresetLandmark
Default Value: PresetLandmark.end
Required: false
Example: ['Point.from_list_of_float_or_string([0,0,0])']
flip
Type: boolean
Required: false
Example: True
Wire-Entity::is_exists()
Check if an entity exists
returnType: boolean
Wire-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
Wire-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
Wire-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Wire-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Wire-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
Wire-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
Wire-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Wire-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Wire-Entity::select()
Select the entity (in UI).
Wire-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')
Wire-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')
Wire-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')
Wire-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')
Wire-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)
Wire-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)
Wire-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)
Wire-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)
Wire-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Wire-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Wire::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'
Wire::linear_pattern(instance_count, offset, direction_axis)
Pattern in a uniform direction.
instance_count
Type: int
Example: 0
offset
Type: string,float,Dimension
Example: Dimension(0,'mm')
direction_axis
Type: string,int,Axis
Default Value: z
Example: 'x'
Wire::circular_pattern(instance_count, separation_angle, center_entity_or_landmark, normal_direction_axis)
Pattern in a circular direction.
instance_count
Type: int
Example: 0
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'
Wire::project(project_from)
Project another entity onto this one.
returnType: Projectable
project_from
Information: Projectable to project from. The other shape will be copied to this one.
Type: Projectable
Example: __import__("codetocad").Sketch('a projected sketch')
Wire::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')
Wire::get_landmark(landmark_name)
Get the landmark by name
returnType: Landmark
landmark_name
Type: string,PresetLandmark
Example: PresetLandmark.leftTop
Wire::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
Wire::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
Wire::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
Wire::remesh(strategy, amount)
Remeshing changes the shape of an entity.
strategy
Type: string
Example: 'String'
amount
Type: float
Example: 0.0
Wire::subdivide(amount)
Subdivide an entity into more components.
amount
Type: float
Example: 0.0
Wire::decimate(amount)
Decimate an entity into less components.
amount
Type: float
Example: 0.0
Landmark
Landmarks are named positions on an entity.
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
Example: 'String'
offset
Type: string,list[string],list[float],list[Dimension],Dimensions
Required: false
Example: Dimensions(Dimension(0,'mm'),Dimension(0,'mm'),Dimension(0,'mm'))
new_parent
Type: string,Entity
Required: false
Example: __import__("codetocad").Part('an entity')
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
Landmark-Entity::is_exists()
Check if an entity exists
returnType: boolean
Landmark-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
Landmark-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
Landmark-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Landmark-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Landmark-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
Landmark-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
Landmark-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Landmark-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Landmark-Entity::select()
Select the entity (in UI).
Landmark-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')
Landmark-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')
Landmark-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')
Landmark-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')
Landmark-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)
Landmark-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)
Landmark-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)
Landmark-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)
Landmark-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Landmark-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Joint
Joints define the relationships and constraints between entities.
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
Example: 0.0
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
Example: Dimension(0,'mm')
y
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
z
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
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
Example: Dimension(0,'mm')
max
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
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
Example: Dimension(0,'mm')
max
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
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
Example: Dimension(0,'mm')
max
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
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
Example: Angle(90)
y
Type: string,float,Angle
Required: false
Example: Angle(90)
z
Type: string,float,Angle
Required: false
Example: Angle(90)
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
Example: Angle(90)
max
Type: string,float,Angle
Required: false
Example: Angle(90)
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
Example: Angle(90)
max
Type: string,float,Angle
Required: false
Example: Angle(90)
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
Example: Angle(90)
max
Type: string,float,Angle
Required: false
Example: Angle(90)
Material
Materials affect the appearance and simulation properties of the parts.
Material::get_preset(material_name)
Get a material from a preset
returnType: Material
material_name
Information: A PresetMaterial name or instance
Type: PresetMaterial
Example: PresetMaterial.red
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
Example: 0
g_value
Type: int,float
Example: 0
b_value
Type: int,float
Example: 0
a_value
Type: int,float
Default Value: 1.0
Example: 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
Example: 0.0
Material::set_roughness(roughness)
Change the surface roughness of the material.
roughness
Information: A float value between 0.0-1.0
Type: float
Example: 0.0
Material::set_image_texture(image_file_path)
Add a texture from an image file.
image_file_path
Type: string
Example: 'String'
Animation
Animation related functionality.
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
Example: 0
Animation::set_frame_end(frame_number)
Set the end animation frame in the scene.
frame_number
Type: int
Example: 0
Animation::set_frame_current(frame_number)
Set the current animation frame in the scene.
frame_number
Type: int
Example: 0
Animation::create_key_frame_location(entity, frame_number)
Create an animation key-frame using the location of the entity.
entity
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
frame_number
Type: int
Example: 0
Animation::create_key_frame_rotation(entity, frame_number)
Create an animation key-frame using the rotation of the entity.
entity
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
frame_number
Type: int
Example: 0
Light
Manipulate a light object.
Light::set_color(r_value, g_value, b_value)
Set the color of an existing light.
r_value
Type: int,float
Example: 0
g_value
Type: int,float
Example: 0
b_value
Type: int,float
Example: 0
Light::create_sun(energy_level)
Create a Sun-type light.
energy_level
Type: float
Example: 0.0
Light::create_spot(energy_level)
Create a Spot-type light.
energy_level
Type: float
Example: 0.0
Light::create_point(energy_level)
Create a Point-type light.
energy_level
Type: float
Example: 0.0
Light::create_area(energy_level)
Create an Area-type light.
energy_level
Type: float
Example: 0.0
Light-Entity::is_exists()
Check if an entity exists
returnType: boolean
Light-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
Light-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
Light-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Light-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Light-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
Light-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
Light-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Light-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Light-Entity::select()
Select the entity (in UI).
Light-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')
Light-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')
Light-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')
Light-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')
Light-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)
Light-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)
Light-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)
Light-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)
Light-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Light-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
Camera
Manipulate a camera object.
Camera::create_perspective()
Create a perspective camera in the scene.
Camera::create_orthogonal()
Create an orthogonal camera in the scene.
Camera::create_panoramic()
Create a panorama camera in the scene.
Camera::set_focal_length(length)
Set the focal length of the camera.
length
Type: float
Example: 0.0
Camera-Entity::is_exists()
Check if an entity exists
returnType: boolean
Camera-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
Camera-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
Camera-Entity::is_visible()
Returns whether the entity is visible in the scene.
returnType: boolean
Camera-Entity::set_visible(is_visible)
Toggles visibility of an entity in the scene.
is_visible
Type: boolean
Example: True
Camera-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
Camera-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
Camera-Entity::get_location_world()
Get the entities XYZ location relative to World Space.
returnType: Point
Camera-Entity::get_location_local()
Get the entities XYZ location relative to Local Space.
returnType: Point
Camera-Entity::select()
Select the entity (in UI).
Camera-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')
Camera-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')
Camera-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')
Camera-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')
Camera-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)
Camera-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)
Camera-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)
Camera-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)
Camera-Entity::get_bounding_box()
Get the Boundary Box around the entity.
returnType: BoundaryBox
Camera-Entity::get_dimensions()
Get the bounding-box dimensions in each axis (X,Y,Z).
returnType: Dimensions
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
Example: 'String'
overwrite
Type: boolean
Default Value: True
Example: True
file_type
Type: string
Required: false
Example: 'String'
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
Example: 'String'
start_frame_number
Type: int
Default Value: 1
Example: 0
end_frame_number
Type: int
Default Value: 100
Example: 0
step_frames
Type: int
Default Value: 1
Example: 0
overwrite
Type: boolean
Default Value: True
Example: 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
Example: 'String'
file_name_prefix
Type: string
Example: 'String'
start_frame_number
Type: int
Default Value: 1
Example: 0
end_frame_number
Type: int
Default Value: 100
Example: 0
step_frames
Type: int
Default Value: 1
Example: 0
overwrite
Type: boolean
Default Value: True
Example: True
file_type
Type: string
Required: false
Example: 'String'
Render::set_frame_rate(frame_rate)
Set rendering framerate.
frame_rate
Type: int
Example: 0
Render::set_resolution(x, y)
Set rendering resolution
x
Type: int
Example: 0
y
Type: int
Example: 0
Render::set_render_quality(quality)
Set rendering quality.
quality
Information: A value between 0 and 100
Type: int
Example: 0
Render::set_render_engine(name)
Set rendering engine name.
name
Type: string
Example: 'String'
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
Example: Camera('a camera')
Scene
Scene, camera, lighting, rendering, animation, simulation and GUI related functionality.
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
Example: 'String'
entities
Type: list[string,Exportable]
Example: [__import__("codetocad").Part('an exportable part')]
overwrite
Type: boolean
Default Value: True
Example: True
scale
Type: float
Default Value: 1.0
Example: 0.0
Scene::set_default_unit(unit)
Set the document's default measurements system.
unit
Type: string,LengthUnit
Example: 'mm'
Scene::create_group(name)
Create a new group
name
Type: string
Example: 'String'
Scene::delete_group(name, remove_children)
Delete a new group
name
Type: string
Example: 'String'
remove_children
Type: boolean
Example: True
Scene::remove_from_group(entity_name, group_name)
Removes an existing entity from a group
entity_name
Type: string
Example: 'String'
group_name
Type: string
Example: '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]
Example: ['__import__("codetocad").Part(\'an entity\')']
group_name
Type: string
Example: 'String'
remove_from_other_groups
Type: boolean
Default Value: True
Required: false
Example: True
Scene::set_visible(entities, is_visible)
Change the visibiltiy of the entity.
entities
Type: list[string,Entity]
Example: ['__import__("codetocad").Part(\'an entity\')']
is_visible
Type: boolean
Example: True
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
Example: 'String'
location_x
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
location_y
Type: string,float,Dimension
Required: false
Example: Dimension(0,'mm')
Analytics
Tools for collecting data about the entities and scene.
Analytics::measure_distance(entity1, entity2)
The ubiquitous ruler.
returnType: Dimensions
entity1
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
entity2
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
Analytics::measure_angle(entity1, entity2, pivot)
The ubiquitous ruler.
returnType: list[Angle]
entity1
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
entity2
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
pivot
Type: string,Entity
Required: false
Example: __import__("codetocad").Part('an entity')
Analytics::get_world_pose(entity)
Returns the world pose of an entity.
returnType: list[float]
entity
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
Analytics::get_bounding_box(entity_name)
Returns the bounding box of an entity.
returnType: BoundaryBox
entity_name
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
Analytics::get_dimensions(entity_name)
Returns the dimensions of an entity.
returnType: Dimensions
entity_name
Type: string,Entity
Example: __import__("codetocad").Part('an entity')
Analytics::log(message)
Write a message
message
Type: string
Example: 'String'