Community Tip - You can change your system assigned username to something more personal in your community settings. X
I need to create a mapkey to create the name of 2D drawing based on the 3D part but adding some extra strings on it for example,
If the 3D part name is V132000430010, then when I call the mapkey it will create a 2D drawing named DV1320004300100-000
that means I need to add D< Genereted name >0-000.
CREO Version: 8.0.8.0
If you are looking to do this with a mapkey then you will need to use an external script to manipulate the string(s). Mapkeys can only record UI actions in a Creo session. Text editing in this context you are working on is done via pausing for user input to enter text. You can call an external script with a mapkey. You can nest this external script call in other mapkeys.
The syntax to call an external executable is:
@SYSTEM start "path_to_your_script"
Hello @tbraxton,
I'm new to this stuff, so I don't know how to write an external script to manipulate the strings and which Programming language to do so with.
It is always the same
Spend some hours, and Voilà it works😉
Hello @RPN,
I want to know more about the external program to parse this data, so what language will be done with?
This is tuff to answer without getting some members angry 😀
I give you 3 out of hundreds ...
Now be prepared to get more recommendations 🙂
BTW the
Tcl Lib's are in "Common Files\apps\prodview\system\tcl8.6" and tk8.6
is part of the Creo Installation, but the executables "Wish" and "TclSh" are missing.
rcpedit.exe is a Tcl Program, some code is hidden, but this is written TclTk see rcpnew.tcl
some code to view is here
Common Files\apps\prodview\system\rcptools
If you copy/backup the code you can replace the PTC code, and replace the script by your own code 🙂
I use by myself only Tcl/Tk as a script language, because it is damm flexible if you follow the 10 rules..
1.
Create a new mapkey in your config.pro,
For example:
mapkey cdn @MAPKEY_LABELCustomized Drawing Name;\
mapkey(continued) @SYSTEMstart WScript.exe \
mapkey(continued) \\creostart\\vbs\\newdrw.vbs;
2.
Create an empty file “newdrw.vbs” in the “c:\creostart\vbs” folder.
3.
Paste in the vbs-file
'/Customized Drawing Name
Dim WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%ffr"
WScript.Sleep 100
WshShell.SendKeys "^c"
WScript.Sleep 100
WshShell.SendKeys "{ESC}"
WScript.Sleep 100
WshShell.SendKeys "%fn"
WScript.Sleep 100
WshShell.SendKeys "{TAB 2}"
WScript.Sleep 100
WshShell.SendKeys "{DOWN}"
WScript.Sleep 100
WshShell.SendKeys "{TAB 2}"
WScript.Sleep 100
WshShell.SendKeys "{DOWN}"
WScript.Sleep 100
WshShell.SendKeys "{TAB 2}"
WScript.Sleep 100
WshShell.SendKeys "{DOWN}"
WScript.Sleep 100
WshShell.SendKeys "d^v0-000"
WScript.Sleep 100
WshShell.SendKeys "{ENTER}"
WScript.Quit()
You can reduce timeouts in the vb-script ("WScript.Sleep 100" means 100ms timeout).
Also you can call other predefined mapkeys from a vb-script.
It would be something like this: WshShell.SendKeys "mtlset"
where "mtlset" is the name of the mapkey.
4.
Open a model in Creo.
Enter cdn to run the mapkey.