cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How to get the attribute (Modified by and Created by) in CAD Part using API?

WhiteChen
5-Regular Member

How to get the attribute (Modified by and Created by) in CAD Part using API?

I want to get the attribute of (Modified by and Created by) in CAD part, but in EPMDocumentMaster, this attribute is not exist, how can I get them by API?

One more question: Can I get all attributes of one CAD part at one time?

Who can help me?

1.png2.png

1 ACCEPTED SOLUTION

Accepted Solutions
cgadre
4-Participant
(To:WhiteChen)

You can get latest EPMdocument from EPMDocumentMaster and then get the necessary information.

Sample code to get the last version of EPMDocument is as follows-

QuerySpec qs = new QuerySpec(EPMDocumentMaster.class);

          EPMDocumentMaster master = null;

          QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);

          System.out.println("Number of EPM Document Masters: " + qr.size() + "\n\n");

          while (qr.hasMoreElements()) {

               master = (EPMDocumentMaster) qr.nextElement();

               System.out.println("***** Name ->"+ master.getName());

               EPMDocument latest = (EPMDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();

               String versionLatest = wt.vc.VersionControlHelper.getVersionIdentifier(latest).getValue();

               System.out.println("******** Identity -> "+ latest.getIdentity());

              

          }

View solution in original post

4 REPLIES 4
cgadre
4-Participant
(To:WhiteChen)

You can get EPMDocument and from EPMDocument you can get creator and modifier as follows-

sample code is as follows-

EPMDocument epmdoc = ext.Search.searchCADDocByName("fixtureblock.prt");

System.out.println(epmdoc.getCreatorName());

  System.out.println(epmdoc.getModifierName());

WhiteChen
5-Regular Member
(To:cgadre)

Thanks for your reply.

But your mentioned method getCreatorName() and getModifierName() are belonged to EMPDocment, my search result is EMPDocumentMaster, it don't include these methods you mentioned.

How can I get the "Created by" and "Modified by" in EMPDocumentMaster? Thanks for your help.

cgadre
4-Participant
(To:WhiteChen)

You can get latest EPMdocument from EPMDocumentMaster and then get the necessary information.

Sample code to get the last version of EPMDocument is as follows-

QuerySpec qs = new QuerySpec(EPMDocumentMaster.class);

          EPMDocumentMaster master = null;

          QueryResult qr = PersistenceHelper.manager.find((StatementSpec) qs);

          System.out.println("Number of EPM Document Masters: " + qr.size() + "\n\n");

          while (qr.hasMoreElements()) {

               master = (EPMDocumentMaster) qr.nextElement();

               System.out.println("***** Name ->"+ master.getName());

               EPMDocument latest = (EPMDocument)wt.vc.VersionControlHelper.service.allVersionsOf(master).nextElement();

               String versionLatest = wt.vc.VersionControlHelper.getVersionIdentifier(latest).getValue();

               System.out.println("******** Identity -> "+ latest.getIdentity());

              

          }

WhiteChen
5-Regular Member
(To:cgadre)

Thanks a lot for your kindly help.

Top Tags