Skip to main content
11-Garnet
September 27, 2022
Solved

Customizing the automated file name

  • September 27, 2022
  • 3 replies
  • 2650 views

While creating a new part in creo, it's automatically taking prt001. Is there any way to make a unqiue customized name while creating a part, Right now we are trying to implementing this on IPEM creo where its integrated to Teamcenter.

Best answer by sjuraj

we have created jlink api command to automate file name while creating new component in assembly

it basically run macro with variable fileName generated during execution of command 

in your case you can create command:

 

public class AutoName extends DefaultUICommandActionListener {

private final Session session;

public AutoName(Session session) {
this.session = session;
}

@Override
public void OnCommand() throws jxthrowable {
String fileName = somehowGenerateFileName();
session.RunMacro("~ Command `ProCmdModelNew`; "
+ "~ <another creo command to select part and filling input with fileName> ;");
//this commands can be seen in manually created macro or in trail file

}
}

 

3 replies

24-Ruby III
September 27, 2022

@Thanus_MR wrote:

While creating a new part in creo, it's automatically taking prt001. Is there any way to make a unqiue customized name while creating a part, Right now we are trying to implementing this on IPEM creo where its integrated to Teamcenter.


Hi,

Creo does not enable user to set his own standard part name.

RPN
18-Opal
September 27, 2022

Check ProMdl.h. I would use the notifier (*ProMdlCreatePreAction) PRO_MDL_CREATE_PRE, here a ProName can specify the new model name, additional you can lock further rename. With ProMdlObjectdefaultnameGet() your are able to get the next default name by type.

Thanus_MR11-GarnetAuthor
11-Garnet
September 28, 2022

Could you please elaborate how to actually deploy this on my creo, Thanks in advance.

sjuraj15-MoonstoneAnswer
15-Moonstone
September 28, 2022

we have created jlink api command to automate file name while creating new component in assembly

it basically run macro with variable fileName generated during execution of command 

in your case you can create command:

 

public class AutoName extends DefaultUICommandActionListener {

private final Session session;

public AutoName(Session session) {
this.session = session;
}

@Override
public void OnCommand() throws jxthrowable {
String fileName = somehowGenerateFileName();
session.RunMacro("~ Command `ProCmdModelNew`; "
+ "~ <another creo command to select part and filling input with fileName> ;");
//this commands can be seen in manually created macro or in trail file

}
}

 

Thanus_MR11-GarnetAuthor
11-Garnet
September 28, 2022

Hi sjuraj,

   Thanks for your response, and also will this work for the every object? while creating the part, drawing, assembly and so on. Also looking forward from you on how to deploy this on actual creo, since i dont know much about coding, Thanks in advance.

15-Moonstone
September 28, 2022

This works for every object.

If you are not familiar with coding you can hardly deploy this solution. Making only one simple api command is complex task.

API is very powerful way how to customize creo, I suggest everyone to learn coding for Creo.

Eg we have command which will sets all parameter in model base on specific user and project - this can save cca 2 minutes for model. If you have 100 models in asm it can save 200 minutes in one click.