<<< LISP in KID | Chapters | Calling the KI/PK Using KID (FLICK) >>> |
All the information concerning an object, including the functions necessary to manipulate it, are kept within the object. The principles of object orientated programming have been exploited in many languages, PARASOLID LISP has been extended by the inclusion of object oriented functions and these are used extensively within KID.
Objects are LISP entities. They consist of some data and a set of operations. The nature of an object's operations depends on the nature of the component it represents. An object representing data structures might store and retrieve information, an object representing a solid body might answer enquiries about its relationships to its component faces and edges, or might perform operations on itself to modify its shape or position in space.
In KID objects are arranged in a predefined hierarchical class structure, see Appendix A, "KID Class Structure".
A message is a request for an object to carry out one of its operations, it specifies which operation is desired, but not how that operation is carried out. The object to which the message was sent determines how that operation should be carried out. A crucial property of messages is that they are the only way to invoke an object's operations.
Operations in KID are generally carried out by passing to the command-line interface messages of the following form:
( object function argument1 argument2 ... ) ( object property argument ) |
Many LISP functions and object operations call a Parasolid PK Function or KI Routine. This provides a convenient, version-independent method of using Parasolid in KID. If timing data is being output (the default action), the name of the function or routine is also output.
KID opens a journal file with the name
kid.jou
and journals all KID commands in this file, which can be renamed before another session is started. It should be possible to reproduce the original operations by loading this file in a subsequent KID session. If the file extension is changed to .lsp then it is not necessary to specify it in the argument to load.
> (load "bug_27.jou") -- file is bug_27.jou > (load ´bug_27) -- file is bug_27.lsp > (load "bug_27" ´reflect) -- commands used are shown > (load ´bug_27 ´verify) -- commands and returns are shown |
When a graphical pick is made with the cursor, a point and a direction are recorded. These vectors are written to the journal file and are used when replaying the journal file so no user interaction is needed.
The kernel is started and stopped using functions of the object modeller, which are pre-defined within the KID class structure.
In the following example, KID is instructed to perform the function
start
(which requires no arguments) on the object
modeller
. This has the effect of calling the Parasolid KI routine STAMOD.
Normally the start function should be called before doing anything else.
> (modeller start) |
> (modeller stop) |
When the kernel is started using (modeller start), a Parasolid journal file is opened, with the default name kid.jnl_txt. This records all the Parasolid PK functions and KI routines called in a KID session, with their received and returned arguments.
The journal file is useful if unexpected errors occur, as it can be inspected to see what functions have been called and when the error occurred.
All GO (Graphical Output) functions are now logged in the journal file. It should be noted that this:
Therefore, it is recommended that Parasolid journalling is turned off unless it is required in a particular modeling session.
The function
mark
provides the means to set marker points in the modeling session, to which it is possible to:
> (modeller mark) -- generates a mark name, e.g. mark5, mark6, etc. |
> (modeller roll) -- returns to the most recent mark) |
When setting a
mark
you can specify a name for it, and then you can roll to that specifically named mark (or a system defined name, e.g. mark6).
> (modeller mark ´start_here ) .... > ( modeller roll ´start_here ) |
Live KID objects can be rolled back in synchrony with the kernel. Define body, face, edge to be types of KID objects you want managed as follows:
> (modeller roll_class ´( body face edge ) ) |
No KID object is created or undefined during a rollback, but those objects in the defined
roll_class
have their tag values updated.
Graphics is kept in step by honoring the current tag values of the objects it is being asked to display.
Only the kernel (without affecting KID objects) is rolled backward/forward, therefore, when a rollback is to a state before the creation of a body in the kernel, KID still acknowledges its existence, while the kernel does not - an error results if any modeling operation referring to such a body is attempted. Conversely if a kernel item has been deleted since the rollmark was set and its corresponding KID object undefined, after a rollback the kernel acknowledges the item's existence, but KID does not.
In LISP an identifier has a value given it by
setq
or
defun
. In object oriented LISP a special function,
defun
, is used to create an object which returns the identifier of the object.
> ( define b0 body ) -- defines a KID object with the `b0´ which belongs to the class `body´ |
In the above example, no Parasolid entity has been created, only a KID entity.
To undefine a previously defined KID object:
> ( undefine b0 ) -- undefines the KID object `b0´ |
To redefine a previously defined KID object as another class:
> ( redefine b0 assembly ) -- redefines the KID object `b0´ in the class `assembly´ |
The function
include
combines the tags contained in the specified KID objects, so that the KID object refers to more Parasolid entities. The function
remove
removes the specified entities from a KID object. The KID objects must be of the same type.
> (e0 tag) ( 46 50 54 ) > (e1 tag) ( 83 80 ) > (e0 include e1) ( 83 80 46 50 54 ) > (e0 remove e1) ( 46 50 54 ) |
The part class and its subclasses, assembly and body, can be received and transmitted. Text files are used unless changed by the appropriate option setting.
Both the
receive
and
transmit
functions take a single argument, the key of the relevant part.
help
returns useful information about an object and its functions.
The option class contains functions which control the interface to the kernel. These functions:
The current setting of any option may be enquired by calling the function without any arguments. If the option has not been set then the default value is returned. Text files are the default for part files and binary files for snapshots. The use of these options is shown below.
Part receive and transmit use the values in the appropriate flags:
These are initialized in (modeller start) to the global value set using (option receive) and (option transmit):
> (option pk_session_receive) > (option pk_session_transmit ´binary) |
When a local operation is performed, there are sometimes a number of possible solutions. When the option check is set to
t
, each solution is reviewed and checked in the resolution of ambiguous cases. If not set, the first solution is picked.
> (option check t) -- default setting for local checking on > (option check nil) -- local checking off |
If local checking has been turned off, an illegal solution is not detected until a complete body check is subsequently done, thus losing a possible legal solution for the local operation, and leaving the body in an invalid state.
> (option pk_session_local_checking) |
This local checking flag is initialized in (modeller start) to the global value set using (option check). It is used in various KID functions where the underlying PK function requires the local checking flag.
The switching on/off of the roll mark facility is controlled by the logging properties. The logging properties that can be set when switching on the logging option are:
logging_size
.
logging_number
option (default number is 20).The roll mark facility creates session marks only. To model in partitions and create partition marks, the appropriate PK functions must be called directly, using the PK FLICK interface. For further details on how to do this, see Chapter 4, "Calling the KI/PK Using KID (FLICK)".
The
option user_field
function is used to set up the user field length which is passed to STAMOD via
modeller start
. The user field length can not be changed while the modeller is running, however, option
user_field
does store the current setting
> (option user_field 0) |
|
> (option user_field 12) |
|
> (option user_field) |
It is now possible to specify some options which only persist for a modeling session, i.e. they are reset by
(modeller stop;start)
. Currently there are only four such options:
(option pk_session_tolerance) (option pk_session_receive) (option pk_session_tansmit) (option pk_session_local_checking) |
If the general values are modified these changes are passed on to the session values immediately, for example:
The tolerance setting is required by various PK boolean and local operation functions and defaults to 0.000001.
<<< LISP in KID | Chapters | Calling the KI/PK Using KID (FLICK) >>> |