Tools for Library Parts
To create and manage library parts, perform the following steps:
1. Mark the part as a library part in Creo Elements/Direct Modeling. For more information, see the Mark as a library element topic in the Creo Elements/Direct Modeling help.
2. Store the part in the appropriate Creo Elements/Direct Model Manager library class.
You can perform the above steps either programmatically or interactively. Programmatic access allows Creo Elements/Direct Model Manager to process entire assembly structures and identify objects as library elements according to certain criteria, for example, naming conventions, before they are stored in Creo Elements/Direct Model Manager.
Marking a library part in Creo Elements/Direct Modeling
The Creo Elements/Direct Modeling Integration Kit offers the following functions to find or mark library parts:
1. sd-inq-obj-library-p
Determines whether an object is a library part, that is, whether it has a symbolic name and an attribute attached.
2. sd-get-library-attr
Returns the library information stored in the library attribute.
3. sd-set-library-attr
Marks a library part by setting the library attribute (UDA: SOLLIB-INFO). In addition, sets the symbolic name of the part.
Setting the Creo Elements/Direct Model Manager library class
The default target class for library parts is the standard LIBRARY_3D class. When a library part is stored in Creo Elements/Direct Model Manager, the save operation lists the available library target classes. However, manual class changes can be tedious and error-prone. To programmatically determine the default target class, the following methods are available:
1. Creo Elements/Direct Model Manager Java Customization
Implement a custom Java Class Name Manager which selects the default target class. For more information, see Creo Elements/Direct Model Manager Customization Guide.
2. Creo Elements/Direct Modeling Integration Kit
Use the sd-db-set-preferred-doc-class function
This function can be applied to any object but is particularly useful for library parts. It informs the default Creo Elements/Direct Model Manager Java Class Name Manager to use sd-db-set-preferred-doc-class as the default target class during the save operation.
* 
In the above scenarios, you can still manually change the class in the Save dialog box, if needed.
Interactive marking of library parts
You can manually mark a part as a library part by using the Mark as Library Element button in Creo Elements/Direct Modeling. For more information, see the Mark as library element topic in the Creo Element/Direct Modeling help.
You can customize the following values in the Mark as Library Element dialog box:
1. The initial value of the element name
By default, the Element Name box shows the model name of the selected element. If the model name is not set, the instance name is shown. To customize,
a. Implement a LISP function
(defun get-my-library-name(selitem)
;; derive some name for the selected object, return a string
)
b. Register the LISP function
(setf ModelManager::*get-library-name-function* 'get-my-library-name)
2. The list of available library IDs
By default, no library IDs are listed. To customize,
a. Implement a LISP function
(defun get-my-library-ids (selitem)
;; determine list of available library ids, return a list of strings
)
b. Register the new function
(setf ModelManager::* get-library-ids-function* 'get-my-library-ids)
3. The list of available DB class names
By default, the list is retrieved from Creo Elements/Direct Model Manager. To customize,
a. Implement a LISP function
(defun get-my-library-classes (selitem)
;; determine list of available library classes, return a list of strings
)
b. Register the new function
(setf ModelManager::*get-library-classes-function* 'get-my-library-classes)
* 
You must add the customized values in the Mark as Library Element dialog box to the mm_customize file which is located in personality\sd_customize\ModelManager.
Was this helpful?