CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > Data Management

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-02-2022, 04:45 PM
cacciatorino cacciatorino is offline
Registered User
 
Join Date: Dec 2011
Location: Central Italy
Posts: 8
Transfer attibute from CAD to MM

I have read a couple of thread on this argument, but I was not able to solve the issue.


I'm able to write an attribute inside a part or group, and to use it to populate a BOM in annotation, as an example.



I was trying to transfer these attributes to MM when a part is saved to DB, but I'm not able to obtain this: custom defined attributes are simply ignored, even if a dictionary with the same name already exists in MM and it is assigned to MODEL_3D and MASTERDATA.



I have copied and modified a lisp that I found on the internet and it works for assigning custom attributes to a part, but not to write them to MM, may be somebody would have a look to undestand where I fail?


I'm using Modeling and MM 20.0.
Attached Files
File Type: lsp PROPIETA.lsp (19.4 KB, 1093 views)
Reply With Quote
  #2  
Old 11-06-2022, 09:41 PM
cacciatorino cacciatorino is offline
Registered User
 
Join Date: Dec 2011
Location: Central Italy
Posts: 8
Re: Transfer attibute from CAD to MM

I made some improvements to my lisp based on the study of the integration kit and web searchs, but it still not works.


One more problem is that my XML file is a little mess, due to the fact that I cannot cancel or modify some dictionary<-->attribute association, because the contextual menu in MM (Administrator mode) does not show anything needed to redefine or delete these associatons, while it works for default associations already presents in the standard installation of MM.
Attached Files
File Type: lsp PROPIETA-REV2.lsp (19.8 KB, 971 views)
File Type: zip STI-WM.xml.zip (834 Bytes, 975 views)
Reply With Quote
  #3  
Old 11-09-2022, 10:19 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 756
Red face Re: Transfer attibute from CAD to MM

Quote:
Originally Posted by cacciatorino View Post
I made some improvements to my lisp based
I am sorry to say I currently do not really find the time to compose a detailed answer.. but this topic is still on my list. I did not forget about it!
Reply With Quote
  #4  
Old 11-09-2022, 10:14 PM
cacciatorino cacciatorino is offline
Registered User
 
Join Date: Dec 2011
Location: Central Italy
Posts: 8
Re: Transfer attibute from CAD to MM

Quote:
Originally Posted by Wolfgang View Post
I am sorry to say I currently do not really find the time to compose a detailed answer.. but this topic is still on my list. I did not forget about it!

No problem at all, this a users forum and not an help-desk!
Reply With Quote
  #5  
Old 11-20-2022, 06:25 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 756
Lightbulb Re: Transfer attibute from CAD to MM

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.

Last edited by Wolfgang; 11-20-2022 at 06:45 AM.
Reply With Quote
  #6  
Old 11-20-2022, 06:41 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 756
Arrow Re: Transfer attibute from CAD to MM

Quote:
Originally Posted by cacciatorino View Post
I made some improvements to my lisp based on the study of the integration kit and web searches, but it still not works.
I have attached a LISP snipped matching your original BOM utility (which is still fine for it's own!! 👍 ).

Instead of coding each and every detail for all of you 12 Attributes, I defined one Generic function and do call it 12 times with the attribute name as parameter. This saves you (in your original approach) around 120 lines of code to be maintained over time. It was shrinked to just 17 lines.

May be this gives you a little inspiration in addition. 😏
Attached Files
File Type: lsp cadde-216-000319_simplified_snippet.lsp (1.7 KB, 1038 views)
Reply With Quote
  #7  
Old 11-22-2022, 01:15 PM
cacciatorino cacciatorino is offline
Registered User
 
Join Date: Dec 2011
Location: Central Italy
Posts: 8
Re: Transfer attibute from CAD to MM

Quote:
Originally Posted by Wolfgang View Post
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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:29 PM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.