Quote:
Originally Posted by Wolfgang
finally here it goes,
1st of all you have programmed a fine and complete example of attribute handling and creating BOM data for an Annotation Bom. Well done. But this is all 'database' independent.
The major key word for ModelManager Attribute together with Modeling is " user defined attribute" or in short form UDA .
Have a look to the goodies.
https://support.ptc.com/help/creo_el...es/Readme.html
There is one goodies to be loaded
Code:
(load "inq_db_uda")
this will display defined DB UDA definitions and personalities.
The second one is
Code:
(load "inq_all_atts")
This one is working with the 'item-attributes' as you have used in your BOM Utilities.
________________________________________________________________
"user defined attributes" as mandatory for ModelManager are based on 'item-attributes' functionality, but do have special behaviour in addtition.
Major function is:
Code:
sd-define-db-attribute
Herein is a slot called :master which defines whether Creo Elements/Direct Modeling, the database or both control the attribute value defined. Several other details are almost identical to item-attributes.
Have a look here: https://support.ptc.com/help/creo_el...ce/db_uda.html where also a bunch of other db-attribute functions are documented.
To reflect those attributes in your structure browser there are 5 functions named sd-create-uda-<valuetype>-column-definition to be used.
I recommend, you will start with ONE attribute and explore the new functions before extending your code to 15 attributes ;-)
You can also inspect and manipulate UDAs with the item-attributes functions.
Sorry for the long delay.
|
Hi Wofgang, thank you for time and patience! To be honest I'm not the creator of that file: I just found something somewhere in the internet and adapted it to my needs.
Actually I was aware of that page(s) of the user manual, and I tried to apply them, but without success.
I have this section in my lisp file:
Code:
(oli::sd-define-db-attribute "TEST"
:class-name "MASTERDATA"
:attachment :contents
:keys '(("TEST" :label "TEST"))
:allowed-owner-types '(:part :assembly)
:master :all
:filing '(:db :sd-file)
:on-copy :copy
:on-merge :detach
:on-split :copy
:command-name 'set_attribute)
But the attribute is simply ignored and not present in the part, both before saving to MM:
Code:
Instance Attributes
----------------------------
----------------------------
Contents Attributes
----------------------------
(MY_SPECIAL_BOM_ATTR)
:FILING = :SD-FILE
:ON-COPY = :COPY
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :MAINTAIN
:ON-SPLIT = :COPY
:FILING = :DB
:MATERIALE = " - "
:AUT_REV = = NIL
:DATA = = NIL
:CODICE = = NIL
:N_REV = "0"
:DESCR_REV = = NIL
:TRATTAMENTO = = NIL
:COMMESSA = " - "
:DENOMINAZIONE_AGG = = NIL
:TEST = "STI-AM"
:DATA_REV = = NIL
:DENOMINAZIONE = "/p07"
:DISEGNATORE = = NIL
:CLASSE = "P"
(DB-GREF)
:FILING = :MI-FILE
:FILING = :SD-FILE
:ON-COPY = :MAINTAIN
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :DETACH
:ON-SPLIT = :MAINTAIN
:MM_STATUS = "-2"
:MM_STATUS_TEXT = "Nuovo"
and after saving to MM:
Code:
----------------------------
Part/Assy = /p06
----------------------------
Instance Attributes
----------------------------
----------------------------
Contents Attributes
----------------------------
(DB-PREF)
:FILING = :MI-FILE
:FILING = :SD-FILE
:ON-COPY = :MAINTAIN
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :DETACH
:ON-SPLIT = :MAINTAIN
:VERSION = "-"
:ELID = "DIYQMGMHHXTZXA"
:UNIQUE_ID_STRING = "_-_F000238: [-] in_lavoraz"
:CLASS_NAME = "MASTERDATA"
:NAME = "_-_F000238"
:CLASS_TYPE = "$PARTDESC"
:CREATE_DATE = "2022/11/22 22:05:46 +0100"
(DB-DREF)
:FILING = :MI-FILE
:FILING = :SD-FILE
:ON-COPY = :MAINTAIN
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :DETACH
:ON-SPLIT = :MAINTAIN
:MODEL_ID = "272992-1669147179-ec8eb5966ce4-0 2056"
:VERSION = "1"
:ELID = "DIYQMGM7HXTZXA"
:UNIQUE_ID_STRING = "p06: [1] in_lavoraz"
:CLASS_NAME = "MODEL_3D"
:NAME = "_-_F000238"
:INSTANCE_NAME = "p06"
:CREATE_DATE = "2022/11/22 22:05:46 +0100"
:CLASS_TYPE = "$DOC"
(DB-GREF)
:FILING = :MI-FILE
:FILING = :SD-FILE
:ON-COPY = :MAINTAIN
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :DETACH
:ON-SPLIT = :MAINTAIN
:INSEPARABLE = "0"
:MM_STATUS = "1"
:FILETYPE = "Model.SD"
:IN_PACKET_DMS_NAME = "Alessandro Marchetti"
"RelatedFile0" = "B1.SD.sd_gfx"
"PL_ObjectType" = "npart3-contents"
:PL_BASETYPE = "P"
:MM_STATUS_TEXT = "Aggiornato"
(MY_SPECIAL_BOM_ATTR)
:FILING = :SD-FILE
:ON-COPY = :COPY
:ON-XFORM = :MAINTAIN
:ON-SYSID-CHANGE = :MAINTAIN
:ON-MERGE = :MAINTAIN
:ON-SPLIT = :COPY
:FILING = :DB
:MATERIALE = " - "
:AUT_REV = = NIL
:DATA = = NIL
:CODICE = = NIL
:N_REV = "0"
:DESCR_REV = = NIL
:TRATTAMENTO = = NIL
:COMMESSA = " - "
:DENOMINAZIONE_AGG = "Albero"
:TEST = "STI-AM"
:DATA_REV = = NIL
:DENOMINAZIONE = "/p06"
:DISEGNATORE = = NIL
:CLASSE = "P"
I have created a dictionary word "TEST" in MM and assigned to masterdata: the attribute exists in the newly created masterdata, but it is empty.
I guess that my "sd-define-attribute" instruction contains one or more errors, but I'm not able to find them.
This is the output of the inq-db-uda command:
Code:
-----------------------
DB UDA Personalities
-----------------------
[Distinta Base]
Command = MM_ASSIGN_BOM
Auto Cmd = NIL
Offer Defaults = NIL
Icon = bitmaps/bmp/commands/MoldBaseAdvisor/bom.bmp
Category = /Predefiniti
-----------------------
DB UDA Definitions
-----------------------
[bom-reference]
Classtype = LINK
Classname = INSTANCE_LINK
Command = NIL
Keys = (BOM_REFERENCE)
Owners = PART-ASSEMBLY
Attachment = INSTANCE
Master = OSD
[bom-indicator]
Classtype = DOC
Classname = _MODEL
Command = NIL
Keys = (BOM_INDICATOR)
Owners = ASSEMBLY
Attachment = CONTENTS
Master = ALL
[bom-quantities]
Classtype = DOC
Classname = _MODEL
Command = NIL
Keys = (_LINK_OVERWRITES _LINK_SPARES)
Owners = ASSEMBLY
Attachment = CONTENTS
Master = ALL