Skip to main content
11-Garnet
Sep 27, 2022 4:34 PM UTC
Solved

Customizing the automated file name

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.

sjurajAnswer
15-Moonstone
Sep 28, 2022 5:56 AM UTC

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

}
}

 

6 replies

24-Ruby III
Sep 27, 2022 7:03 PM UTC

@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.

Translate
RPN
18-Opal
Sep 27, 2022 10:51 PM UTC

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.

Translate
Thanus_MR11-GarnetAuthor
11-Garnet
Sep 28, 2022 2:01 AM UTC

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

Translate
sjuraj15-MoonstoneAnswer
15-Moonstone
Sep 28, 2022 5:56 AM UTC

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

}
}

 

Translate
Thanus_MR11-GarnetAuthor
11-Garnet
Sep 28, 2022 12:55 PM UTC

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.

Translate
15-Moonstone
Sep 28, 2022 1:59 PM UTC

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.

Translate