Enquiries   

<<< Miscellaneous Useful Functions Chapters Attributes in KID >>>

Contents

[back to top]


9.1 Introduction

This chapter describes the enquiries available in KID.

enquire function

It is possible to enquire about topological and geometrical items. The enquire function is applicable to points, curves, surfaces, vertices, edges and faces. The function can be used to print out either all available information or just specific details about the geometry of the item. For instance, assuming c1 ( a curve), f1 ( a face) and a1 ( an assembly) have already been picked:

 

Object

Function

modeller

enquire

> (c1 enquire)
> (f1 enquire)
> (a1 enquire)

This prints out information about the geometry of the item on the screen.

Using enquire on a one layer assembly

In addition, for assemblies of only one layer of substructure, a statement to that effect and the number of sheet and solid bodies the assembly consists of are printed out.

Using the level function to create a single layer assembly

To convert an "unlevelled" assembly to a single layer assembly, type:

 

> ( a1 level )

Other enquiries on an assembly are:

 

> ( a1 instances )    -- a list of the first layer of instances
> ( a1 bodies )       -- a list of the first layer of bodies
> ( a1 transforms ) 
                 -- a list of the first layer of transform tags

It is also possible to get more specific information from the enquire function. An argument identifying the type of information required is given to the enquire function, and the function thens return the value of the information, or nil if it is not found.

Assuming c1 is a circular curve:

 

> (c1 enquire ´point)     -->(0 0 0)
> (c1 enquire ´direction) -->(0 0 1)
> (c1 enquire ´radius)    --> 42
> (c1 enquire ´maj_axis)  --> nil
> (c1 enquire ´type)      --> circle

[back to top]


9.2 Enquiring/setting the tag property

If a primitive is created, or if an object has been picked from the screen, it has a property which contains the value of the kernel tag which represents the item. KID uses this when it calls the KI / PK. It is possible to access the value of the tag, or to set it to a particular value. For instance, if it is known that tag 99 refers to a face, the following creates an object which may then be manipulated by KID:

 

> (define f1 face)
> (f1 tag 99)         -- set tag property to 99
> (f1 enquire)        --> information
> (f1 tag)            --> gives tag value 99

It may prove useful to manipulate tag values in this way to perform operations which are not possible with the normal KID functions.

[back to top]


9.3 Using enquire to construct complex functions

Some KID functions result in the tag property of an entity having a LISP list of tags. An example of this is the function pick_from . It is often possible to manipulate an object with a list of tags using the same functions as if it had a single tag. This facility is not provided by all KID functions.

 

> (define b1 p_block)
> (b1 x 10; y 20; z 10; create)    -- create block b1
> (define f1 face)
> (f1 pick_from ´b1)        -- f1 is a list of b1´s 6 faces
> (f1 pick_using ´(f1 clash ´(5 5 10)))
    -- leave only those faces which clash with this point f1
       now refers to a set of three faces from body b1

> (f1 enquire )                    --> information
> (f1 direction ´(10 9 8); move)
                       -- this will move all three faces

This form of the enquire function can be used to construct complex functions where the geometry of one surface is used to define the size of another.

 

> (define b0 p_cone)
> (b0 lrad 10; urad 0; height 30; create)
> (define f1 face)
> (define s1 surface)
> (f1 pick_from b0)
> (f1 pick_using ´(f1 clash ´(0 0 30))) 
           -- see later for clash definition
> (s1 pick_from f1)
> (f1 enquire)
> (s1 enquire)
> (s1 enquire ´sense)

The argument type can be used to select specific curve or surface types, which are named as follows:

 

Curve

Surface

line

planar

circle

cylindrical

ellipse

conical

intersection

spherical

B-curve

toroidal

SP-curve

blend

foreign_geometry

B-surface

constant_parameter

swept

 

spun

 

offset

 

foreign_geometry

Use of the enquire function within the pick facility using type is described in the section "Picking directly from other objects" in Chapter 14, "Picking".

[back to top]


9.4 Accessing the KI routine IDCOEN for topological entities

A convenient way of accessing the KI routine IDCOEN for topological entities is:

 

> ( b0 faces )    -- returning a list of b0´s (body) faces
> ( f0 edges )    -- returning a list of f0´s (face) edges
> ( a0 bodies )   -- returning a list of a0´s (assembly) bodies

[back to top]


9.5 Enquiring coordinates of box enclosing single item

The function box returns two vectors defining the extremes of a minimal rectangular box aligned with the axis system, and enclosing the single topology item, or list of topology items of the same type. This is true for assemblies, bodies, faces, edges and vertices. For a single vertex point, the box extremes are identical.

 

Object

Function

topology

box

> (define b1 p_block)
> (b1 x 10;y 20;z 30; create)
> (b1 box)        --> ( ( -5.0 -10.0 0.0 ) ( 5.0 10.0 30.0 ) )

> (define v1 vertex)
> (v1 pick_from ´b1)
> (v1 box)        --> ( ( -5.0 -10.0  0.0 ) ( 5.0 10.0 30.0 ) )

> (v1 pick_using ´(v1 clash ´(5 10 30)))
> (v1 box)        --> ( ( 5.0 10.0 30.0 ) ( 5.0 10.0 30.0 ) )

[back to top]


9.6 Enquiring on a supplied point

Function clash provides a means of testing whether a supplied point is contained in, on or outside a body, face, edge or vertex. Clash uses the KI routine ENCONT.

 

Object

Function

topology

clash

> (define b1 p_block)
> (b1 x 20; y 20; z 10; create) -- creates block
> (b1 help clash)               --> information on clash for b1
> (b1 clash ´(0 0 5))           --> in
> (b1 clash ´(0 0 0))           --> on
> (b1 clash ´(0 0 -5))          --> nil (i.e. outside)

 

[back to top]

<<< Miscellaneous Useful Functions Chapters Attributes in KID >>>