Creates a shape in the modeling window.
Syntax
hm_createshape
type args
Description
Creates a shape in the modeling window. Returns an index to the
shape, which is required to further manage the shape.
Inputs
- type
- The type of shape to create. Valid values are BOX, SEGMENT, CYLINDER, SPHERE,
POLYHEDRON, and FACET.
- args
- The additional arguments are dependent on the type of the shape.
- BOX - Type 1
- xb yb zb
- The coordinates of the base point.
- xa ya za
- The coordinates of the axis point.
- xp yp zp
- The coordinates of the plane point.
- l1 l2 l3
- The length of each axis.
- BOX - Type 2
- x1 y1 z1
- The coordinates of the first diagonal corner point.
- x2 y2 z2
- The coordinates of the second diagonal corner point.
- CYLINDER
- xc yc zc
- The coordinates of the center point.
- xa ya za
- The coordinates of the axis point.
- h
- The cylinder height.
- r1
- The radius of the cylinder top.
- r2
- The radius of the cylinder bottom.
- SPHERE
- xc yc zc
- The coordinates of the center point.
- xa ya za
- The coordinates of the axis point.
- r
- The sphere radius.
- SEGMENT
- x1 y1 z1
- The coordinates of the first point.
- x2 y2 z2
- The coordinates of the second point.
- FACET - Tria
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- FACET - Quad
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- x4 y4 z4
- The coordinates of the fourth corner point.
- POLYHEDRON - Tetra
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- x4 y4 z4
- The coordinates of the fourth corner point.
- POLYHEDRON - Pyramid
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- x4 y4 z4
- The coordinates of the fourth corner point.
- x5 y5 z5
- The coordinates of the first corner point.
- POLYHEDRON - Penta
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- x4 y4 z4
- The coordinates of the fourth corner point.
- x5 y5 z5
- The coordinates of the first corner point.
- x6 y6 z6
- The coordinates of the second corner point.
- POLYHEDRON - Hexa
- x1 y1 z1
- The coordinates of the first corner point.
- x2 y2 z2
- The coordinates of the second corner point.
- x3 y3 z3
- The coordinates of the third corner point.
- x4 y4 z4
- The coordinates of the fourth corner point.
- x5 y5 z5
- The coordinates of the first corner point.
- x6 y6 z6
- The coordinates of the second corner point.
- x7 y7 z7
- The coordinates of the third corner point.
- x8 y8 z8
- The coordinates of the fourth corner point.
Examples
To create a box using corner points (0,0,0) and
(2,2,2):
set shapehandle [hm_createshape BOX 0 0 0 2 2 2]
To create a sphere with a center of (10,0,0), an axis of (0,1,0) and a radius of 2:
set shapehandle [hm_createshape SPHERE 10 0 0 0 1 0 2]
To create a polyhedron tetra using corner points (25,0,0), (28,0,0), (28,2.5,0) and
(27,2.5,3):
set shapehandle [hm_createshape POLYHEDRON 25 0 0 28 0 0 28 2.5 0 27 2.5 3]
Errors
Incorrect usage results in a
Tcl error. To
detect errors, you can use the
catch
command:
if { [ catch {command_name...} ] } {
# Handle error
}