Miscellaneous Useful Functions
<<< Local Operation Functions | Chapters | Enquiries >>> |
replicate
function can be used to make replicas of objects and copies of items within the modeller.
The following example shows the effect upon objects which do not refer to a kernel item and those the kernel is not capable of copying, in this case before a primitive has been turned into a body.
The function copies all the local properties of one object to another object, and overwrites any existing properties with the same names.
If the objects refer to an item in the kernel which can be copied:
> (define b0 p_torus) > (b0 majrad 20; minrad 5; colour ´blue; create) -- create torus b0, property blue > (define b3 body) > (b3 replicate ´b0) -- copy b0 and property into b3 |
This also copies all local properties of b0 to b3, except for the
tag
property. When the
replicate
function encounters the tag property, it calls the KI routine COPYEN to create a copy of the kernel item. The tag of this new item is put into the
tag
property of the copied object.
The kernel objects which cannot have their tags copied in this way are edges, faces, vertices, loops, shells and attributes; a call to
replicate
for these objects creates a new object with the same tag value.
The function
rename
enables a name change of a modeller item.
> (define b0 p_block) > (b0 x 10; y 20; z 30; create) > (b0 rename ´p7112) --> renames b0 to p7112 > (p7112 is) --> body > (b0 is) --> error as b0 is now undefined |
To uniquely select a face from a body in a way that is not session dependent you can use their identifiers.
> ( f0 identify ) --> ( FA2 FA33 FA100 ) > ( e0 identify ) --> ( ED12 ED24 ) |
Identifiers are the same after the body is transmitted or received, and they are the same in copies of the part also.
Getting to the tags again from the identifiers requires specifying which part the identifiers refer to:
> ( f0 identify_in b0 ) -- mandatory parameter > ( f0 identify ´( FA2 FA33 F100 )) |
This locates the tags of these faces and saves them in the object f0.
This method is much faster and more robust than doing a pick on a complex body. It may be useful to locate faces in test scripts.
The function
magnify
scales a body about it's center of gravity.
> ( body magnify <scale> ) |
The function
reflect
images the body in a plane.
> ( body reflect <plane> ) |
A plane can conveniently be created by picking from the model. for example:
> ( define s1 surface ) > ( s1 pick ) -- & use graphics picking |
The
mirror
function copies a body, reflects it and unites with the mirror image, merging out redundant topology.
> ( body mirror <plane> ) |
Mass property enquiries are driven from general functions associated with the topology object:
(topology mass_amount) (topology mass) (topology cofg) (topology mofi) (topology periphery) |
The interpretation of the mass_amount ("amount" in the PK documentation) and periphery depend upon the specific type of topology. Bodies, faces and edges have specific enquiries for some of this information:
All the above functions take two optional arguments. The first is used to control the accuracy of the calculations and defaults to 0.95 (this is not especially precise), for example:
(e0 length 0.9)
would provide a less accurate result.
The second is just a logical which controls whether facesets are considered as a single solid or not. This affects the meaning of the amount and periphery values, e.g.
(f0 mass_amount 0.95 t)
returns the volume of the enclosed space, whereas
(f0 mass_amount 0.95)
returns the surface area of the faces.
It is possible to combine low level calls to individual KI/PK functions,
> ( <KI routine name> <arguments separated by spaces>) |
with KID commands as have been described in this chapter. This may be necessary in cases where only a low level call to a particular KI/PK routine is possible. This is described in Chapter 4, "Calling the KI/PK Using KID (FLICK)".
<<< Local Operation Functions | Chapters | Enquiries >>> |