Difference between revisions of "Glossary of EM.Cube's Python Functions"

From Emagtech Wiki
Jump to: navigation, search
(EM.Cube's Miscellaneous Python Functions)
Line 396: Line 396:
 
|}
 
|}
  
== EM.Cube's Miscellaneous Python Functions ==
+
== EM.Cube's Design Python Functions ==
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 450: Line 450:
 
|}
 
|}
  
== EM.Cube's Python Functions for Object Creation ==
+
== EM.Cube's Python Functions for Geometric Object Creation ==
  
 
====box({{ArgTypeString}} label, {{ArgTypeAny}} x0, {{ArgTypeAny}} y0, {{ArgTypeAny}} z0, {{ArgTypeAny}} length, {{ArgTypeAny}} width, {{ArgTypeAny}} height)====
 
====box({{ArgTypeString}} label, {{ArgTypeAny}} x0, {{ArgTypeAny}} y0, {{ArgTypeAny}} z0, {{ArgTypeAny}} length, {{ArgTypeAny}} width, {{ArgTypeAny}} height)====
Line 537: Line 537:
 
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.
 
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.
  
== EM.Cube's Python Functions for Object Transformation ==
+
== EM.Cube's Python Functions for Geometric Object Transformation ==
  
 
====subtract({{ArgTypeString}} label, {{ArgTypeString}} object_1, {{ArgTypeString}} object_2)====
 
====subtract({{ArgTypeString}} label, {{ArgTypeString}} object_1, {{ArgTypeString}} object_2)====

Revision as of 21:09, 1 September 2016

Contents

Standard Python Functions

Syntax Type Description Notes
abs(x) Std. Python function Absolute value function x if x>0, -x if x<0
ceiling(x) Std. Python function Ceiling function Nearest integer >= x
floor(x) Std. Python function Floor function Nearest integer <= x
pow(x,y) Std. Python function Power function x**y
sqrt(x) Std. Python function Square root function pow(x,0.5)
exp(x) Std. Python function Exponential function pow(e,x)
log(x) Std. Python function Natural logarithm function -
log10(x) Std. Python function Base 10 logarithm function ln(x)/ln(10)
factorial(x) Std. Python function Factorial For integer values of x: n! = n(n-1)(n-2)...3.2.1
max(x,y) Std. Python function Maximum of x and y -
min(x,y) Std. Python function Minimum of x and y -
sin(x) Std. Python function Sine function -
cos(x) Std. Python function Cosine function -
tan(x) Std. Python function Tangent function -
asin(x) Std. Python function Inverse sine function -
acos(x) Std. Python function Inverse cosine function -
atan(x) Std. Python function Inverse tangent function -
atan2(x,y) Std. Python function Inverse tangent function -
sinh(x) Std. Python function Hyperbolic sine function -
cosh(x) Std. Python function Hyperbolic cosine function -
tanh(x) Std. Python function Hyperbolic tangent function -
asinh(x) Std. Python function Inverse hyperbolic sine function -
acosh(x) Std. Python function Inverse hyperbolic cosine function -
atanh(x) Std. Python function Inverse hyperbolic tangent function -

Advanced Mathematical Python Functions

Syntax Type Description Notes
sp.sici(x) Std. Python function Sine and cosine integral functions See Trigonometric Integrals on Wikipedia.
sp.fresnel(x) Std. Python function Sine and cosine Fresnel integral functions See Fresnel Integrals on Wikipedia.
sp.ellipe(x) Std. Python function Elliptic function of the first kind See Elliptic Integrals on Wikipedia.
sp.ellipk(x) Std. Python function Elliptic function of the second kind See Elliptic Integrals on Wikipedia.
sp.expi(x) Std. Python function Exponential integral function See Exponential Integrals on Wikipedia.
sp.expn(n,x) Std. Python function Generalized exponential integral function of order n See Exponential Integrals on Wikipedia.
sp.erf(x) Std. Python function Error function See Error Function on Wikipedia.
sp.erfc(x) Std. Python function Complementary error function See Error Function on Wikipedia.
sp.gamma(x) Std. Python function Gamma function See Gamma Function on Wikipedia.
sp.airy(x) Std. Python function Airy function of the first (Ai) and second (Bi) kind and their derivatives See Airy Functions on Wikipedia.
sp.j0(x) Std. Python function Bessel function of the first kind and order 0 See Bessel Functions on Wikipedia.
sp.j1(x) Std. Python function Bessel function of the first kind and order 1 See Bessel Functions on Wikipedia.
sp.jv(n,x) Std. Python function Bessel function of the first kind and order n See Bessel Functions on Wikipedia.
sp.y0(x) Std. Python function Bessel function of the second kind and order 0 See Bessel Functions on Wikipedia.
sp.y1(x) Std. Python function Bessel function of the second kind and order 1 See Bessel Functions on Wikipedia.
sp.yv(n,x) Std. Python function Bessel function of the second kind and order n See Bessel Functions on Wikipedia.
sp.i0(x) Std. Python function Modified Bessel function of the first kind and order 0 See Bessel Functions on Wikipedia.
sp.i1(x) Std. Python function Modified Bessel function of the first kind and order 1 See Bessel Functions on Wikipedia.
sp.iv(n,x) Std. Python function Modified Bessel function of the first kind and order n See Bessel Functions on Wikipedia.
sp.k0(x) Std. Python function Modified Bessel function of the second kind and order 0 See Bessel Functions on Wikipedia.
sp.k1(x) Std. Python function Modified Bessel function of the second kind and order 1 See Bessel Functions on Wikipedia.
sp.kv(n,x) Std. Python function Modified Bessel function of the second kind and order n See Bessel Functions on Wikipedia.
sp.sph_jn(n,x) Std. Python function Spherical Bessel function of the first kind and order n See Bessel Functions on Wikipedia.
sp.sph_yn(n,x) Std. Python function Spherical Bessel function of the second kind and order n See Bessel Functions on Wikipedia.
sp.sph_in(n,x) Std. Python function Modified spherical Bessel function of the first kind and order n See Bessel Functions on Wikipedia.
sp.sph_kn(n,x) Std. Python function Modified spherical Bessel function of the second kind and order n See Bessel Functions on Wikipedia.
sp.lpn(n,x) Std. Python function Legendre function of the first kind and order n See Legendre Polynomials on Wikipedia.
sp.lqn(n,x) Std. Python function Legendre function of the second kind and order n See Legendre Polynomials on Wikipedia.
sp.lpmn(m,n,x) Std. Python function Associated Legendre function of the first kind and order n See Legendre Polynomials on Wikipedia.
sp.lqmn(m,n,x) Std. Python function Associated Legendre function of the second kind and order n See Legendre Polynomials on Wikipedia.
sp.eval_chebyt(n,x) Std. Python function Chebyshev polynomial of the first kind and order n See Chebyshev Polynomials on Wikipedia.
sp.eval_chebyu(n,x) Std. Python function Chebyshev polynomial of the second kind and order n See Chebyshev Polynomials on Wikipedia.
sp.eval_legendre(n,x) Std. Python function Legendre polynomial of order n See Legendre Polynomials on Wikipedia.
sp.eval_laguerre(n,x) Std. Python function Laguerre polynomial of order n See Laguerre Polynomials on Wikipedia.
sp.eval_hermite(n,x) Std. Python function Hermite polynomial of order n See Hermite Polynomials on Wikipedia.
Math_ce(n,r,x) Std. Python function Even periodic (cosine) Mathieu function of order n See Mathieu Functions on Wikipedia.
Math_se(n,r,x) Std. Python function Odd periodic (sine) Mathieu function of order n See Mathieu Functions on Wikipedia.

EM.Cube's Miscellaneous Python Functions

Syntax Type Description Notes
rect(x) EMAG Python function Rectangle function 1 if |x|≤0.5, 0 elsewhere
tri(x) EMAG Python function Triangle function 1-x|≤1, 0 elsewhere
spline2(x) EMAG Python function Quadratic spline function -
spline3(x) EMAG Python function Cubic spline function -
step(x) EMAG Python function Step function 1 if x>0, 0 if x<0
sgn(x) Std. Python function Sign function 1 if x>0, -1 if x<0
ramp(x) EMAG Python function Ramp function -
sqr_wave(x) EMAG Python function Square wave function -
tri_wave(x) EMAG Python function Triangle wave function -
sawtooth(x) EMAG Python function Sawtooth wave function -
sinc(x) EMAG Python function Sinc function sin(pi*x)/(pi*x)
gauss(x) Std. Python function Gaussian function -
rand(x,y) EMAG Python function Random function -

EM.Cube's Design Python Functions

Syntax Type Description Notes
Z0_MS(e,x) EMAG Python function Characteristic impedance of a microstrip transmission line x: width-to-height ratio, e: substrate permittivity
w_MS(z,e,t) EMAG Python function Width of a microstrip transmission line z: characteristic impedance, e: substrate permittivity, t: substrate thickness
eeff_MS(e,x) EMAG Python function Effective permittivity of a microstrip transmission line x: width-to-height ratio, e: substrate permittivity
woh_MS(e,z) EMAG Python function Width-to-height ratio of a microstrip transmission line z: characteristic impedance z, e: substrate permittivity
Z0_CPW(e,x,y) EMAG Python function Characteristic impedance of a coplanar waveguide transmission line x: slot width-to-height ratio, y: center strip width-to-height ratio, e: substrate permittivity
eeff_CPW(e,x,y) EMAG Python function Effective permittivity of a coplanar waveguide transmission line x: slot width-to-height ratio, y: center strip width-to-height ratio, e: substrate permittivity
horn_a(d,x,y) EMAG Python function Wavelength-normalized a-dimension of an optimal pyramidal horn antenna d: directivity d, x and y: wavelength-normalized waveguide dimensions
horn_b(d,x,y) EMAG Python function Wavelength-normalized b-dimension of an optimal pyramidal horn antenna d: directivity d, x and y: wavelength-normalized waveguide dimensions
horn_l(d,x,y) EMAG Python function Wavelength-normalized length of an optimal pyramidal horn antenna d: directivity d, x and y: wavelength-normalized waveguide dimensions

EM.Cube's Python Functions for Geometric Object Creation

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.

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.

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.

EM.Cube's Python Functions for Geometric Object Transformation

subtract(string label, string object_1, string object_2)

Example:subtract("Subtract_Object","Rect_Strip1","Rect_Strip2")

Description: Creates a Boolean object named 'label' by subtracting object_2 from object_1. An error will be thrown if a Boolean object named 'label' already exists.

union(string label, string object_1, string object_2)

Example:union("Union_Object","Rect_Strip1","Rect_Strip2")

Description: Creates a Boolean object named 'label' by unioning object_1 and object_2. An error will be thrown if a Boolean object named 'label' already exists.

intersect(string label, string object_1, string object_2)

Example:intersect("Intersection_Object","Rect_Strip1","Rect_Strip2")

Description: Creates a Boolean object named 'label' by intersecting object_1 and object_2. An error will be thrown if a Boolean object named 'label' already exists.

array(string label, string object, any x_count, any y_count, any z_count, any x_spacing, any y_spacing, any z_spacing)

Example:array("Array_1","Rect_Strip_1",4,4,1,"spacing","spacing",0)

Description: Create or modify an Array object.

translate_by(string label, real x_dist, real y_dist, real z_dist)

Example:translate_by("MyObj",10,10,x)

Description: Translates an object by the specified distances in each direction.

translate_to(string label, real x_dest, real y_dest, real z_dest)

Example:translate_to("MyObj",20,20,x2)

Description: Translates an object to the specified destination.

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, string object, any height)

Example:extrude("Extrude_Object","Rect_Strip1",50)

Description: Creates or modifies an Extrusion object from CAD object 'object'. If modifying an existing extrusion, 'object' is ignored, and the pre-existing primitive is used. extrude(...) can only extrude objects that have a single face, and will extrude in the direction of the face's normal.

explode(string object)

Example:explode("MyArray")

Description: Performs an explode operation on a CAD object named 'object'.

revolve(string label, string object, any x0, any y0, any z0, any uX, any uY, any uZ, any rot_angle)

Example:revolve("Rev1","Line_1",0,0,0,0,0,1)

Description: Creates or modifies a Revolution object called 'label', with a primitive object named 'object'. If modifying an existing Revolution object, 'object' is ignored, and the pre-existing primitive object is used. (x0,y0,z0) specifies the center of revolution, and (uX,uY,uZ) specifies the revolution axis. rot_angle is in degrees.

EM.Cube Python Functions for Material Group Creation

pec_group(string label)

Example:pec_group("PEC_1")

Description: Creates a PEC material group in the current module. If a PEC group 'label' already exists, the group is activated.

pmc_group(string label)

Example:pmc_group("PMC_1")

Description: Creates a PMC material group in the current module. If a PMC group 'label' already exists, the group is activated.

dielectric_group(string label, any eps, any sigma, any mu, any rho)

Example:dielectric_group("Dielectric_1","my_eps",0,1,0)

Description: Creates a Dielectric material group in the current module with the specified material properties. If a Dielectric group 'label' already exists, the group is activated.

thinwire_group(string label, any radius)

Example:thinwire_group("Thinwire_1",4)

Description: Creates a Thinwire material group in the current module. If a Thinwire group 'label' already exists, the group is activated.

base_point_group(string label)

Example:base_point_set("BP_Set_1")

Description: Creates a Base Point Set in EM.Terrano. If a Base Point Set group 'label' already exists, the group is activated.

color_group(string label)

Example:color_group("Color_1")

Description: Creates a Color group in CubeCAD module. If a Color group 'label' already exists, the group is activated.

penetrable_group(string label, any eps, any sigma, any thickness)

Example:penetrable_group("Impenet_1",2.2,.0001, 1)

Description: Creates a Penetrable material group in EM.Terrano. If a Penetrable group 'label' already exists, the group is activated.

impenetrable_group(string label, any eps, any sigma)

Example:impenetrable_group("Impenet_1",2.2,.0001)

Description: Creates a Impenetrable material group in EM.Terrano. If an Impenetrable group 'label' already exists, the group is activated.


 

Back icon.png Back to EM.Cube Main Page