Miscellaneous Useful Functions   

<<< Local Operation Functions Chapters Enquiries >>>

Contents

[back to top]


8.1 Replication of objects within the modeller

replicate function

The replicate function can be used to make replicas of objects and copies of items within the modeller.

 

Object

Function

modeller

replicate

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.

 

> (define b0 p_sphere)
> (b0 centre ´(0 0 1); radius 10 ; colour ´red )
                            -- local properties of b0
> (define b1 p_sphere)      -- the object must be defined first
> (b1 replicate ´b0)        -- b0 is copied into b1
> (b1 colour)               --> red
> (b0 create )              -- create sphere body b0
> (b1 create )              -- create sphere body b1

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.

[back to top]


8.2 Renaming a modeller item

rename function

The function rename enables a name change of a modeller item.

 

Object

Function

modeller

rename

 

> (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

[back to top]


8.3 Selecting an entity using its identifier

identify function

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.

[back to top]


8.4 Magnifying, reflecting and mirroring a body

magnify function

The function magnify scales a body about it's center of gravity.

 

> ( body magnify <scale> )

reflect function

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

mirror function

The mirror function copies a body, reflects it and unites with the mirror image, merging out redundant topology.

 

> (  body mirror <plane> )

[back to top]


8.5 Mass properties

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:

 

(body volume)
(body area)
(face volume)       --- Treating the face set as a single solid
(face cofg 0.95 t)  --- Treating the face set as a single solid
(face cofg)
(face area)
(face periphery)
(edge length)

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.

[back to top]


8.6 KI/PK Functions

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)".

 

[back to top]

<<< Local Operation Functions Chapters Enquiries >>>