Python Integration

From Emagtech Wiki
Revision as of 17:37, 2 December 2015 by Shatch (Talk | contribs)

Jump to: navigation, search

Contents

CAD Functions

Surface Objects

rect_strip(string label, any x0, any y0, any z0, any length, any width)

Example:rect_strip("my_rectangle",0,0,0,"x",y)

Description: Draws a Rect Strip object in the scene under the currently activated Material Group node, or modifies a Rect Strip if Rect Strip 'label' already exists.

circ_strip(string label, any x0, any y0, any z0, any inner_radius, any outer_radius)

Example:circ_strip("cs_1",0,0,0,0,100)

Description: Draws a Circular Strip object in the scene under the currently activated Material Group node, or modifies a Circular Strip if Circular Strip 'label' already exists.

poly_strip(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:poly_strip("ps_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a PolyStrip object in the scene. Each point is represented with a Python tuple type. The poly_strip function is 'self-closing' -- there is no need to supply the first point again at the end of the point list.

nurbs_strip(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:nurbs_strip("ns_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a NURBS Strip object in the scene. Each point is represented with a Python tuple type. The nurbs_strip function is 'self-closing' -- there is no need to supply the first point again at the end of the point list.


Solid Objects

box(string label, any x0, any y0, any z0, any length, any width, any height)

Example:box("my_box",0,0,0,"x",y,100)

Description: Draws a Box object in the scene under the currently activated Material Group node, or modifies a Box if Box 'label' already exists.

cylinder(string label, any x0, any y0, any z0, any radius, any height)

Example:cylinder("cylinder_1",0,0,0,10,100)

Description: Draws a Cylinder object in the scene under the currently activated Material Group node, or modifies a Cylinder if Cylinder 'label' already exists.

pyramid(string label, any x0, any y0, any z0, any base_x, any base_y, any height)

Example:pyramid("pyramid_1",0,0,0,10,10,100)

Description: Draws a Pyramid object in the scene under the currently activated Material Group node, or modifies a Pyramid if Pyramid 'label' already exists.

sphere(string label, any x0, any y0, any z0, any radius, any start_angle, any end_angle)

Example:sphere("sphere",0,0,0,10,0,180)

Description: Draws a Sphere object in the scene under the currently activated Material Group node, or modifies a Sphere if Sphere 'label' already exists. The arguments start_angle and end_angle are in degrees and specify a sweep about the sphere's theta axis.


Line Objects

line(string label, any x0, any y0, any z0, any length)

Example:line("my_line",0,0,0,100)

Description: Draws a Line object in the scene under the currently activated Material Group node, or modifies a Line if Line 'label' already exists.

line_rotated(string label, any x0, any y0, any z0, any rot_x, any rot_y, any rot_z, any length)

Example:line_rotated("line_1",0,0,0,0,90,0,100)

Description: Draws a rotated Line object in the scene under the currently activated Material Group node. Unlike most other CAD functions, if Line 'label' already exists in the scene, an error will be thrown.

circle(string label, any x0, any y0, any z0, any radius, any start_angle, any end_angle)

Example:circle("pyramid_1",0,0,0,10,10,100)

Description: Draws a circular curve object in the scene under the currently activated Material Group node, or modifies a Circle object if Circle 'label' already exists. The parameters start_angle and end_angle are in degrees.

helix(string label, any x0, any y0, any z0, any nturns, any radius_inner, any radius_outer)

Example:helix("Helix_1",0,0,0,5,15,50)

Description: Draws a helical curve in the scene under the currently activated Material Group node, or modifies a Helix if Helix 'label' already exists. radius_inner specifies the helix's radius at the beginning of the helix, and radius_outer specifies the radius at the end of the helix.

poly_line(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:poly_line("pl_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a PolyLine object in the scene. Each point is represented with a Python tuple type. The poly_line is closed if p0 is specified again as pn, otherwise, it is open.

nurbs_curve(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:nurbs_curve("nc_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a NURBS Curve object in the scene. Each point is represented with a Python tuple type. The curve is closed if p0 is specified again as pn, otherwise, it is open.

Transform Functions

subtract(string label, any x0, any y0, any z0, any length)

Example:subtract("my_line",0,0,0,100)

Description: Draws a Line object in the scene under the currently activated Material Group node, or modifies a Line if Line 'label' already exists.

line_union(string label, any x0, any y0, any z0, any rot_x, any rot_y, any rot_z, any length)

Example:lineunionrotated("line_1",0,0,0,0,90,0,100)

Description: Draws a rotated Line object in the scene under the currently activated Material Group node. Unlike most other CAD functions, if Line 'label' already exists in the scene, an error will be thrown.

intersect(string label, any x0, any y0, any z0, any radius, any start_angle, any end_angle)

Example:intersect("pyramid_1",0,0,0,10,10,100)

Description: Draws a circular curve object in the scene under the currently activated Material Group node, or modifies a Circle object if Circle 'label' already exists. The parameters start_angle and end_angle are in degrees.

array(string label, any x0, any y0, any z0, any nturns, any radius_inner, any radius_outer)

Example:array("Helix_1",0,0,0,5,15,50)

Description: Draws a helical curve in the scene under the currently activated Material Group node, or modifies a Helix if Helix 'label' already exists. radius_inner specifies the helix's radius at the beginning of the helix, and radius_outer specifies the radius at the end of the helix.

translate_by(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:translate_by("pl_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a PolyLine object in the scene. Each point is represented with a Python tuple type. The poly_line is closed if p0 is specified again as pn, otherwise, it is open.

translate_to(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:translate_to("nc_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a NURBS Curve object in the scene. Each point is represented with a Python tuple type. The curve is closed if p0 is specified again as pn, otherwise, it is open.

rotate(string label, any x0, any y0, any z0, any radius, any start_angle, any end_angle)

Example:rotate("pyramid_1",0,0,0,10,10,100)

Description: Draws a circular curve object in the scene under the currently activated Material Group node, or modifies a Circle object if Circle 'label' already exists. The parameters start_angle and end_angle are in degrees.

extrude(string label, any x0, any y0, any z0, any nturns, any radius_inner, any radius_outer)

Example:extrude("Helix_1",0,0,0,5,15,50)

Description: Draws a helical curve in the scene under the currently activated Material Group node, or modifies a Helix if Helix 'label' already exists. radius_inner specifies the helix's radius at the beginning of the helix, and radius_outer specifies the radius at the end of the helix.

explode(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:explode("pl_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a PolyLine object in the scene. Each point is represented with a Python tuple type. The poly_line is closed if p0 is specified again as pn, otherwise, it is open.

revolve(string label, 3x1 Python tuple p0, 3x1 Python tuple p1, ... 3x1 Python tuple pn)

Example:revolve("nc_1",(0,0,0),(1,0,0),(1,0,0))

Description: Creates or modifies a NURBS Curve object in the scene. Each point is represented with a Python tuple type. The curve is closed if p0 is specified again as pn, otherwise, it is open.

Source Functions

Result Functions

Simulation Setup and Meshing Functions