This chapters talks about the functionality to inquire all kind of information from Creo Elements/Direct Modeling. It talks about the various areas of inquiries, about data types and functions.
Using the inquiry functions as described in the following pages, the programmer will get back all kind of different information from the system.
In general, the information is presented to the programmer as result of a Lisp function.
Different Lisp data types represent the different items.
SEL_ITEMs are a handle to the corresponding data within the system. Therefore they cannot be directly inspected, however there are functions available to inquire their contents.
Due to the internal representation of data in Creo Elements/Direct Modeling, SEL_ITEMs are not permanent. Actually SEL_ITEMs may become invalid right after the next modeling operation.
Caution: Do not use SEL_ITEMs to permanently store system information! Accessing invalid SEL_ITEMs may lead to unforeseeable results, it may even lead to a system crash with total data loss !!
The use of SEL_ITEMs is recommended within the Dialog Generator for inquiring system and user data and then executing single Creo Elements/Direct Modeling Action Routines. As SEL_ITEMs may become invalid after a modeling operation, "User Defined Features" are the way to execute multiple modeling operations on the same Creo Elements/Direct Modeling entities, for example faces.
The two examples below illustrate the recommended and the wrong way to perform these kind of operations.
(sd-defdialog 'my_move :dialog-title "Move Ok" :variables '((a-face :value-type :face :after-input (attach-name "Hugo" a-face)) (next :push-action (doit))) :local-functions '((attach-name (n f) (sd-call-cmds (remove_feature :full_name :start_name "/cube" :feature n :end_name)) (sd-call-cmds (define_feature :selection f :name n))) (doit () (sd-call-cmds (move :nocheck :by_feature :full_name :start_name (sd-inq-curr-part-name) :feature "Hugo" :end_name :transformation :translate :dir_len :face_normal :by_feature :full_name :start_name (sd-inq-curr-part-name) :feature "Hugo" :end_name 5)))) :start-variable 'a-face :ok-action '(doit))Caution: The following example will cause Creo Elements/Direct Modeling to crash
(sd-defdialog 'my_move_crash :dialog-title "Move Crash" :variables '((a-face :value-type :face) (next :push-action (doit))) :local-functions '((doit () (sd-call-cmds (move :nocheck a-face ;;; Invalid after first use !!! :transformation :translate :dir_len :face_normal a-face 5)))) :start-variable 'a-face :ok-action '(doit))
To make sure, that accuracy is maintained when doing arithmetic operations in the Lisp system, use the floating point calculation as follows:
(setf f (* f 2.0))instead of
(setf f (* f 2))
Functions exist to work with these data types or to transfer one into the other. Mostly the same functions can deal with as well gpnt2d and gpnt3d data.
A special function is provided to check for equivalence of these data types taking in account the geometric resolution set in the system.
In Creo Elements/Direct Modeling objects name parts, assemblies, workplanes, workplane sets, layouts and layout views.
The Creo Elements/Direct Modeling Integration Kit offers functionality to inquire objects and object trees. It also offers functionality to inquire their properties (shared, modified, read-only) and filing status (DB_DESCRIPTION_FILE)
Tutorial Example Reference Manual
The Creo Elements/Direct Modeling Integration Kit allows the programmer to use the full power of Creo Elements/Direct Modeling's selector programmatically.
The tool for doing so is the "GET_SELECTION" interrupt action routine. It accepts all selector options and returns a list of the selected items.
The following example returns all edges around a face
(sd-call-cmds (GET_SELECTION :select :edge_3d :by_face a-face))
The "GET_SELECTION" command also accepts initial focus types as well as a check-function, that performs additional checks on selected items
The following example selects all red faces in a the current part
(sd-call-cmds (GET_SELECTION :focus-type *sd-face-seltype* :check-function is-red-face :select :all_3d))
Inquiry functions are provide to access workplane information like workplane properties, workplane positioning and defaults.
The Creo Elements/Direct Modeling Integration Kit provides various functions to inquire the geometrical shape of Creo Elements/Direct Modeling entities
Functions include generic functions (all faces have a bounding box) and specific ones (specific for e.g. a planar face).
The geometrical inquiry functions do not distinguish between 2D geometry in workplanes or 3D geometry. The same functions return e.g the geometrical properties of 2D and 3D edges.
Coordinate values returned depend on the destination space specified. It can be global, local (relative to the owning part or workplane) or relative to a specific item.
All necessary functions are provided to work with Features and Named Elements. They can be selected, inquired, set.
Tutorial Example Reference Manual
The Creo Elements/Direct Modeling Integration Kit allows to inquire and set all viewport related information.
This includes camera (how do I look into a viewport?), lights, show settings and drawlist information for all available viewports.
Tutorial Example Reference Manual
The Creo Elements/Direct Modeling Integration Kit provides functionality to find out information about layouts. This is information about defaults and about specific layouts.
The Creo Elements/Direct Modeling Integration Kit provides functionality to inquire data of specific coordinate systems and their elements and about default settings.
The Creo Elements/Direct Modeling Integration Kit provides functionality to inquire data of configurations. Furthermore there is a way to programmatically create configurations.
The Creo Elements/Direct Modeling Integration Kit provides functionality to inquire data of patterns and their elements.
© 2023 Parametric
Technology GmbH (a subsidiary of PTC Inc.), All Rights Reserved |