Identifying Models
 
Functions Introduced:
The object ProMdl is an opaque handle, and is therefore volatile. It cannot be used to refer to models that are not in memory in , for example. To reference a model in a way that is valid for models not in memory, and also persistent across sessions of , use the model name and type.
The functions ProMdlMdlnameGet() and ProMdlTypeGet() provide the name and type of a model, given its ProMdl handle. The type of a model is expressed in terms of the enumerated type ProMdlType. From 3.0 onward, this enumerated data type contains an additional value PRO_MDL_CE_SOLID that represents a Layout model. functions will only be able to read models of type Layout, but will not be able to pass Layout models as input to other functions. PTC recommends that you review all applications that use the enumerated type ProMdlType and modify the code as appropriate to ensure that the applications work correctly. The input argument handle specifies the handle for the model. The output argument name stores the model name at the specified memory address.
The function ProMdlOriginGet() retrieves the full source path of the model, that is, the path from where the specified model has been opened. It returns NULL if the specified model is new in the session, and has not been saved. For instances, it returns the full path of the file that created the instance. For example, the accelerator file if applicable or otherwise the generic.
The function ProMdlExtensionGet() retrieves the file extension for the specified model.
The function ProMdlDirectoryPathGet() returns the file path where the specified model would be saved. It specifies the target home directory for the model.
The function ProMdlDisplaynameGet() returns the name of the model, which is displayed in the user interface. The name is displayed in the graphics area, such as, the model tree, window title, and so on. If the model is an instance of native model, the display name is the instance name. For configurations or instances of non-native models, the display name consists of the model name along with the configuration name or instance name. If you specify the input argument include_ext as PRO_B_TRUE, then the display name returned by the function also includes the file extension of the model.
The functions ProMdlCommonnameGet() and ProMdlCommonnameSet() obtain and assign the common name of a model, respectively. This name is used to identify the model in a Product Database Management system such as PDMLink.
Note:
 
ProMdlCommonnameSet() can modify the name only for models that are not yet owned by PDMLink, or in certain situations if the configuration option let_proe_rename_pdm_objects is set to yes.
The function ProMdlObjectdefaultnameGet() returns the next available default name for a given model type. The type of the model is specified by the enumerated type ProType and has one of the following values:
PRO_PART
PRO_ASSEMBLY
PRO_CABLE
PRO_DRAWING
PRO_REPORT
PRO_2DSECTION
PRO_3DSECTION
PRO_LAYOUT
PRO_DWGFORM
PRO_MARKUP
Note:
 
For each of the above types, ProMdlObjectdefaultnameGet() returns the next available default name, for example PRT00# for PRO_PART or DRW00# for PRO_DRAWING, where # specifies the part or drawing number. This number depends on the following factors:
Models present in the active session
Files in the current working directory
Connection to an active server with the autonumber option enabled
Thus, if no object with the specified name is actually created, the next time the same name is returned; otherwise the next available name is returned.
The function ProMdlnameInit() does the opposite, and provides a valid ProMdl handle for a given name and type. The function fails if the specified model is not in memory in the session.
A third way to identify a model is by an integer identifier. Unlike the integer identifiers of objects within a model, such as surfaces and edges, the identifier of a model is not persistent between sessions. The function ProMdlIdGet() provides the identifier of a model, given its ProMdl handle.
The function ProMdlActiveGet() retrieves the model handle ProMdl for an active object.
The function ProMdlSubtypeGet() provides the subtype (such as sheet metal) of a specified model. Valid model subtypes are Part, Assembly, or Manufacturing. This is like finding subtypes at the File > New > Model Type menu.
The function ProMdlFiletypeGet() retrieves the file type of the specified model using the enumerated data type ProMdlfileType.
The function ProFileSubtypeGet() retrieves the following information when you specify the path to a file as the input argument. The output arguments are:
file_type—Specifies the file type using the enumerated data type ProMdlfileType. For native models, the file type and model type are the same.
type—Specifies the model type using the enumerated data type ProMdlType.
subtype—Specifies the subtype of the model using the enumerated data type ProMdlsubtype. For model types that do not have subtypes, the argument returns PROMDLSTYPE_NONE.
The function ProMdlToModelitem() is used only when you need to represent the model as a ProModelitem object—the first step in building a ProSelection object that describes the role of a model in a parent assembly. Model item objects are described later in this section. See the section Fundamentals for information on the ProSelection object.
Isto foi útil?