Skip to main content
1-Visitor
July 31, 2018
Question

Renaming parts with jlink

  • July 31, 2018
  • 2 replies
  • 1887 views

Hello

 

I am trying to rename some parts using jlink.

Has anyone already done that? Or any suggestion on how to do it?

 

Thank you

 

Regards

2 replies

15-Moonstone
September 26, 2018

Hi, it's quite easy. It depends on your skill. If you are familiar with java then you need to learn how to develop and run jlink in creo. If you are not, you need first learn at least basics of java.

Considering first option the guide for jlink is located in <creo_load_point>/Common Files/jlink/jlinkug.pdf

I have post setup guide last year, but i can't find it know. There are all steps to achieve jlink running in creo.

Once you run jlink, you just need to get model object and call rename method on it. Eg:

 

Session session = pfcGlobal.GetProESession();

Model model = session.getCurrentModel();

model.rename("newawesomename");

 

If you have any questions, feel free to ask. Good luck.

1-Visitor
October 4, 2018

Dear vjoer ,

I have tried the below method ,Its worked for me .

 

//Get the Session
Session session = pfcGlobal.GetProESession();
//Get the Active Model
Model mod=session.GetCurrentModel();
//Rename the Model in Session //Rename (String NewName, /*optional*/ Boolean RenameFilesToo)  from Jlink Doc mod.Rename(NewFileName,false);

Note from PTC

If the models are retrieved from a directory other than the current working directory the Models are renamed only in the session and not on disk

 

Thanks Regards,

Dhini