Download: Pro/toolkitdata structure .docx
Pro/toolkitdata Structure
I. object handle
Each object in Pro/Toolkit has a corresponding C-type definition called a handle. Its name is usually prefixed with Pro before the object name. The handle is used as a Type in all variables and parameters pointing to that type object. For example, any Pro/TOOLKIT function that performs an operation on an object model has a prosolid input parameter.
Handles are defined and used in the following two ways:
Opaque handle or ohandle)
Database handle (Database handle or dhandle)
Opaque handle ohandle
In proe, the simplest way to reference an object is to use the memory address that describes the object's proe data structure. To prevent the Pro/TOOLKIT application from directly accessing the content of the object's data structure, the data structure statement is not provided. For example, the object handle prosurface is defined
Typedef struct Geom * prosurface;
In proe, the struct Geom structure is used to describe a surface, but its Data Structure declaration is not included in Pro/Toolkit. For this reason, this handle type is called an opaque handle or an opaque pointer.
The advantages of an opaque handle are simple and effective. They can be directly removed from reference in the Pro/TOOLKIT function without any search. They can also reference temporary or non-existent items in the PROE database, such as the surfaces and edges obtained in the interference volume calculation.
Examples of other Pro/TOOLKIT ohandle objects are as follows:
Typedef void * promdl;
Typedef struct curve_header * proedge;
Typedef struct sld_part * prosolid;
Typedef struct entity * propoint;
Typedef struct entity * proaxis;
Typedef struct entity * procsys;
Typedef struct entity * procurve;
Because the opaque handles are only memory pointers, they have the variable disadvantage of all pointers. If the database objects they point to are moved to different memory locations, the pointer will become invalid. For example, a prosurface handle (a pointer to the PROE surface) may expire after the part where it is located is regenerated because its memory may have been located.
However, most of the PROE data structures referenced by opaque handles will contain an integer-type identifier, which is unique in the model where it is located for that type of item. In addition, this identifier will keep its value throughout the life cycle of the item. Even between different jobs of proe, Pro/Toolkit also provides prosurfaceidget () and proaxisidget () to your application, you can use these identifiers to reference objects. These integer identifiers are also used in dhandle.
In the model, the name and type are continuous. The promdlnameget () and promdltypeget () functions provide the model name and type of a specific opaque model handle.
Database handle dhandle
The opaque handle can protect the data structure. Therefore, you cannot access the specific members in the structure in the program. For example, in theory, a function that provides the name of a ry can act on any ry object (prosurface, proedge, procsys, etc ). However, the opacity handles of these different geometries are not compatible with each other. Therefore, the Pro/TOOLKIT function also needs to know the object type before the object can reference the opacity pointer internally.
To solve this problem, Pro/TOOLKIT defines a new and common object type and declares this type with a data handle or dhandle. Dhandle is a clear data structure that contains exactly enough information to uniquely identify a database item. The information includes: type, integer identifier, and model handle. Because dhandle must contain an integer identifier (not a special opaque handle), it also has a sustained advantage.
A typical example of dhandle is progeomitem, which is a common type for the aforementioned ry. In addition, there is a promodelitem, which is a more common object containing progeomitem. The statement is as follows:
Typedef struct pro_model_item
{
Protype type;
Int ID;
Promdl owner;
} Promodelitem, progeomitem;
Note: because the owner uses ohandle promdl for definition, it is strictly variable, but this handle is valid when the PROE model it points to is still in the memory.
The general object progeomitem can be used to represent any ry in an entity model, such as prosurface, proedge, procurve, and procsys. A special object type can be said to have evolved from the most common type and is also an instance of that type. The progeomitem object type is, in turn, an instance of promodelitem. Promodelitem can also represent non- ry database items.
Generic objects such as promodelitem and progeomitem are often input parameters used to execute action functions for generic objects in Pro/Toolkit. For example, the progeomitemfeatureget () function can act on any type of progeomitem instance objects (such as prosurface, proedge, procsys, and so on. Promodelitemnameget () can be used in a wider range of database objects, not just in ry.
If you have a ohandle pointing to an object, such as prosurface, and want to call a general function such as progeomitemfeatureget (), you must convert its ohandle into a more general dhandle. For example, the progeomiteminit () and promodeliteminit () functions provide such functions. Similarly, you can use prosurfaceinit () to convert a progeomitem into a prosurface.
Workspace handle workspace handles
When you create an object that contains many important information (such as a feature) in Pro/TOOLKIT and proe, before adding the object to the PROE database, it is important to create all the information first. However, the Pro/TOOLKIT object-oriented style does not allow explicit access to such a data structure. Therefore, this alternative method is to use a special workspace object which is allocated and provided by the Pro/TOOLKIT application.
In fact, the workspace is a piece of memory area in proe, which contains the data structure, but is not part of the design database.
The workspace handle stores the memory address, which is similar to ohandle. To distinguish it from ohandle, it is called workspace handle in Pro/Toolkit.