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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Need a help during creating a Mapkey of creating a Customized Drawing Name

PA_11027627
3-Newcomer

Need a help during creating a Mapkey of creating a Customized Drawing Name

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

6 REPLIES 6
tbraxton
22-Sapphire I
(To:PA_11027627)

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"

 

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

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. 

 

RPN
17-Peridot
17-Peridot
(To:PA_11027627)

It is always the same

 

  1. The mapkey execute something what you can parse 
  2. Now execute your external program to parse this data
  3. This will prepare a config with a mapkey, which does what you want
  4. load this config file
  5. execute this mapkey

Spend some hours, and Voilà it works😉

 

PA_11027627
3-Newcomer
(To:RPN)

Hello @RPN

 

I want to know more about the external program to parse this data, so what language will be done with? 

RPN
17-Peridot
17-Peridot
(To:PA_11027627)

This is tuff to answer without getting some members angry 😀

 

I give you 3 out of hundreds ...

 

  1. Powershell - you don't need to install, and you can probably run immediately on your machine 
  2. Python - This is the one beloved at this time (Interface builder is done with Tk, integration so ugly in my point of view)
  3. Tcl/Tk - 10 rules, easy string handling and simple, but powerful  GUI Builder, download and start the widget demo, use 'see code' here!

 

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

 

 

 

 

Van_AG
12-Amethyst
(To:PA_11027627)

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.

Announcements


Top Tags