 |
Creation of Primitives |
|
Contents
[back to top]
5.1 Introduction
The following sections deal with the creation of primitives which include assemblies, points, acorns, wires, sheets, solids, curves and surfaces. The primitive classes are temporary storage for data about an object before a kernel item is created. When created, the objects are transferred to an appropriate subclass of entity i.e. assembly, vertex, body, curve or surface.
[back to top]
5.1.1 Solid Primitives
Various types of solid can be created from primitive objects. Note that all primitive bodies inherit pre-defined properties from the class p_body. These are
point
, with a value of
'(0 0 0)
, and
direction
, with a value of
'(0 0 1)
. These properties are used as defaults for the creation of some of the primitives unless they are superseded by locally defined properties.
Object
|
Function
|
p_acorn, p_block, p_cone, p_cylinder, p_prism, p_sphere, p_torus, p_paracurve, p_parasurf, p_sheet, p_wire, p_profile, p_pyramid
|
create
|
Creating a block
> (p_block help create) -- information on property names and
defaults
> (define b0 p_block) -- define the primitive
> (b0 x 10; y 20; z 30) -- and direction gets default values
> (b0 create)
> (b0 is) --> body
|
Creating a sphere
> (define b1 p_sphere)
> (b1 help create) --> information
> (b1 radius 20; point ´(10 10 10); create
-- change default point
|
Each newly created primitive body carries properties, top and bottom, which can be used to position further primitives.
> ( define cube p_block )
> ( define bar p_cylinder )
> ( cube z 50; direction ´( 1 0 0 ); create )
> ( bar height 30; radius 5; point ( cube top ); create )
|
[back to top]
5.2 Additional Primitive Options
Additional primitive options which create non-convex bodies, self obscuring bodies, or those with many edges meeting at a vertex, and profiles are supported as follows for:
[back to top]
5.2.1 p_pyramid
The primitive type
p_pyramid
parameters are sides, radius, height (mandatory) point, direction (default table). The radius may be omitted if the parameter "length" specifying length of side is provided instead.
[back to top]
5.2.2 p_block, p_cone and p_cylinder
The
p_block
,
p_cone
and
p_cylinder
recognize the defining parameter "thickness", which defines the wall thickness of the primitive. Hollow pipes of various cross section can be defined using this.
> ( define pipe p_cylinder )
> ( pipe height 10; radius 5; thickness 1.5 ; create)
|
[back to top]
5.2.3 p_sphere and p_torus
If the thickness parameter is applied to
p_sphere
or
p_torus
a simple sphere or torus is created containing an internal void.
[back to top]
5.2.4 Profiling
p_profile class
Primitive contains a class
p_profile
. This class allows the user to define a facial profile on a body, from a given list of vector points. The user can create a minimum body from a single point, a wire body from a list of unconnected points, or a sheet body from a list of connected points (points are connected if they define a closed loop.) An attempt to create a sheet body may fail if the points are not co-planar. All the edges of the wire body are straight. The examples below illustrate each case:
Object
|
Function
|
p_profile
|
create
|
To create a minimum body and move it to coordinates (1 2 3):
> (define b0 p_profile)
> (b0 coordinate ´(1 2 3))
> (b0 create)
|
To create a sheet body with a triangular profile:
> (define b1 p_profile)
> (b1 coordinate ´( (0 0 0) (0 1 0) (1 1 0) (0 0 0) ))
> (b1 create)
|
Note: Had the set of coordinates not been closed then a wire body would have resulted.
|
scribe function
The scribe function may be used to scribe the bounded portion of the curve onto a specified face, region or body.
Object
|
Function
|
p_bounded_curve
|
scribe
|
> (( define b0 p_acorn) create )
> (( define c0 p_line ) point ´( 0 0 0 );
direction ´( 0 0 1 ); create )
> (( define bc0 p_bounded_curve )
body ´b0;
curve ´c0;
startp ( c0 deparameterise 0 );
endp ( c0 deparameterise 1 );
scribe)
|
Geometric Primitives
Simple geometric properties such as points, vectors, curves and surfaces can also be created from primitives. Primitive curves and surfaces inherit pre-defined properties from the class
p_geometry
.
Object
|
Function
|
p_circle, p_ellipse, p_intersection, p_line
|
create
|
Creating a circle:
> (p_circle help create) --> information
> (define c1 p_circle)
> (c1 point ´(3 2 0)) -- center of circle
> (c1 radius 10)
> (c1 direction ´(1 1 1)) -- axis direction
> (c1 create)
|
Creating an ellipse:
> (define c2 p_ellipse)
> (c2 point ´(0 10 0)) -- center of ellipse
> (c2 direction ´(1 0 0)) -- normal, i.e. ellipse in YZ plane
> (c2 majrad 10;minrad 5)
> (c2 majaxi ´(0 1 0)) -- major axis along Y axis
> (c2 create)
|
Creating a p_wire from a p_line
p_wire
creates a wire body from a bounded region of a curve. The range property is optional if the curve is bounded.
Object
|
Function
|
p_wire
|
create
|
> (( define c0 p_line ) point ´( 0 0 0 );
direction ´( 0 0 1 ); create )
> (( define b0 p_wire ) curve ´c0; urange ´( 0 1 ); create )
|
Object
|
Function
|
p_planar, p_cylindrical, p_conical, p_spherical, p_toroidal, p_swept, p_spun, p_offset
|
create
|
Creating a planar surface:
> (p_planar help create) -->information
> (define s1 p_planar)
> (s1 point ´(0 0 0); direction ´(1 0 0))
> (s1 create)
|
Creating a swept surface from a given curve:
> (( define c0 p_line ) point ´( 0 0 0 );
direction ´( 0 0 1 ); create )
> (( define s0 p_swept ) curve ´c0;
direction ´( 1 0 0 ); create )
|
Creating a spun surface from a given curve:
> (( define c0 p_line ) point ´( 0 0 0 );
direction ´( 0 0 1 ); create )
> (( define s0 p_spun ) curve ´c0; point ´( 0 2 0 );
direction ´( 1 0 0 ); create )
|
Creating an offset from a given surface, which if possible, is simplified:
> (( define s0 p_planar ) point ´(0 0 0);
direction ´(0 0 1); create)
> (( define off0 p_offset ) surface ´s0; distance 5; create )
|
Creating a p_sheet from a p_planar surface:
p_sheet
creates a sheet body from a bounded region of a surface. The range properties are optional bounded parameters.
Object
|
Function
|
p_sheet
|
create
|
> (( define s0 p_planar ) point ´( 0 0 0 );
direction ´( 0 0 1 ); create)
> (( define b0 p_sheet ) surface ´s0;
urange ´( 0 1 ); vrange ´( 0 1 ); create )
|
[back to top]
5.3 Transformation Primitives
For all of the following, the transform is first defined and then applied to the given entity.
Object
|
Function
|
p_equal_scaling, p_reflection, p_rotation, p_translation, p_general_transform
|
apply
|
[back to top]
5.3.1 p_equal_scaling
> ( ( define b0 p_block ) create )
> ( ( define t0 p_equal_scaling )
scale 1.5; centre ´( 0 0 5 ); create )
> ( graphics ske ´b0; ar )
> ( t0 apply ´b0 )
> ( graphics sketch ´b0; ar )
|
[back to top]
5.3.2 p_reflection
> ( ( define b0 p_block ) create )
> ( ( define t0 p_reflection )
point ´( 11 0 0 ); normal ´( 1 0 0 ); create )
> ( graphics ske ´b0; ar )
> ( t0 apply ´b0 )
> ( graphics sketch ´b0; ar )
|
[back to top]
5.3.3 p_rotation
> (( define b0 p_block ) create )
> (( define t0 p_rotation ) point ´( 11 0 0 );
direction ´( 1 0 0 ); angle 3.1415926; create )
> ( graphics ske ´b0; ar )
> ( t0 apply ´b0 )
> ( graphics sketch ´b0; ar )
|
[back to top]
5.3.4 p_translation
> ( ( define b0 p_block ) create )
> (( define t0 p_translation )
direction ´(0 0 1); distance 30; create)
> ( graphics ske ´b0; ar )
> ( t0 apply ´b0 )
> ( graphics sketch ´b0; ar )
|
[back to top]
5.3.5 p_general_transform
With this function the transformation is specified explicitly by the transform matrix. Therefore, this primitive may be used to create more complicated transforms, e.g. general affine. Note, this can only be applied to a limited subset of the usual entities.
A combination translation and general affine deformation:
> ( ( define b0 p_block ) create )
> ( ( define t0 p_general_transform )
matrix ´ ( 1 0 0 1 0 2 0 1 0 0 3 1 0 0 0 1 ); create )
> ( graphics ske ´b0; ar )
> ( t0 apply ´b0 )
> ( graphics sketch ´b0; ar )
|
[back to top]
5.4 Assemblies and Instances
assembly and instance functions
Assemblies and instances can be created from primitives.
Object
|
Function
|
p_assembly, p_instance
|
create
|
Creating an empty assembly:
> (define a0 p_assembly)
> (a0 create)
|
Creating an instance within an assembly:
> (define i1 p_instance)
> (i1 assembly ´a0; part ´b0)
> (i1 create)
|
disassemble function
To convert a flat assembly (a0) to the class body, where a0's tag list contains all those Parasolid bodies in the assembly, use:
[back to top]