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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

How to Create Custom Parameters for Auto-naming in Creo Parametric?

ENGINEERINGXYZ
8-Gravel

How to Create Custom Parameters for Auto-naming in Creo Parametric?

Hello everyone,

I'm currently working on implementing an auto-naming system for parts and assemblies in Creo Parametric. My goal is to have the name generated based on a combination of a unique identifier and the type of part (Mechanical, Electrical, etc.). The idea is to have a function like this:

 

 

new_name = "PART_" + TYPE_SELECTION + "_" + UNIQUE_ID

 

 

For the TYPE_SELECTION, I want to create a dropdown list of options, and for UNIQUE_ID, I'm looking for a way to make it increment by 1 automatically each time a new part is created.

I was able to add basic parameters via Tools > Parameters, but I'm not quite sure how to make TYPE_SELECTION a list of predefined options or how to auto-increment UNIQUE_ID.

Does anyone have experience setting up something similar? Any guidance or tips would be greatly appreciated!

 

3 REPLIES 3

Hi,

from my point of view auto-naming system for parts and assemblies is system which assign names to files. If you want to implement this functionality, you have to develop Toolkit application which calls generator and them creates part or assembly.


Martin Hanák

I have done it, but not actually use it.

To make a drop down list of options, there are two methods.
1. Using .lst file 

Example:


ND_ParamDefArr_K01 = {
{ Name = Maker
Type = string
Default = 'ミスミ'
Enum = { 'ミスミ', 'SMC', 'キーエンス', 'CKD', 'IAI', 'オリエンタル', 'オムロン', 'コガネイ', 'THK', 'CSS', 'SUS', 'ユーザ入力'}
}
}


2. Using user interface

Hidetaka_0-1695791267250.png

Hidetaka_1-1695791376960.png




Automatic numbering can be achieved with Creo API, or automation script (eg. python).
You should use what you are familiar with.

In my case, I used Autohotkey.

 

placeComponent(argument2)
{ ; this function take argument from command line to place a stock part to an assembly. User need to rename the part later. The method used here guarantee that even if the user forgots to rename, there will be no pairs of same name part.
source := "O:\Free\FA_data\治具_creo\STD_\Sunpou**bleep**ei\" . argument2 . ".prt.1"
 
FileReadLine, partNumber, D:\partNumber.txt, 1 
newPartName := A_ComputerName . "_" . partNumber . ".prt.1" 
wdir := getWorkingDirectory_v1()
destination := wdir . newPartName
 
FileCopy, %source%, %destination%, 1
If ErrorLevel
{
Msgbox,64,, Error copying %source%, 1
return
}
sendInput aa ; mapkey to assemble
setClipBoard(newPartName)
If (language = "japanese")
title := "開く"
else ; If (language = "english")
title := "Open"
 
 
Winwait, %title%,, 5 ; wait for the open window to appear
WinActivate
SendInput ^v ; paste part name to the search field
SendInput {Enter}
 
; increase partNumber so that the next stock part will have a different name
partNumber += 1
file := FileOpen("D:\partNumber.txt", "w")
file.write(partNumber)
file.close()
 
WinWaitNotActive, %title%,, 2
containingFolder := getContainingFolder()
if (wdir != containingFolder)
{
Msgbox,64, アセンブリは作業フォルダにありません, %newPartName%は作業フォルダ%wdir%に保存されていますが`n親アセンブリは%containingFolder%にあります。,20
}
 
return
}




Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags