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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How do I get a prt/asm name into a mapkey

GunnarHansen
1-Visitor

How do I get a prt/asm name into a mapkey

Lets say I have a prt named XXX. I want to make a mapkey to easy create a new drawing named XXX without having to type XXX or manually copy/paste XXX. Is that possible?
12 REPLIES 12

Yes, it is a big question. I try to do this mapkey. But, not yet do this.

There may be an easier way, however this will work: 1) Record the mapkey "Tools>Mapkey>New" 2) Save the mapkey to file "Save..." (from the mapkey window) 3) Open the saved file and edit InputPanel1, remove all lines with InputPanel1 except the first line where InputPanel1 appears. Edit the value following InputPanel1 to the drawing name. 4) Copy/Paste into config.pro. 5) Reload the modified config.pro. 6) Run mapkey! Example- Saved file (mapkey name=test drawing name=newdrawing): mapkey test @MAPKEY_LABELtesting;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Activate `new` `OK`;\ mapkey(continued) ~ Activate `dwg_create` `psh_ok`;~ Activate `open_rep` `OK`; mapkey test @MAPKEY_LABELtesting;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Input `new` `InputPanel1` `n`;\ mapkey(continued) ~ Input `new` `InputPanel1` `ne`;~ Input `new` `InputPanel1` `new`;\ mapkey(continued) ~ Input `new` `InputPanel1` `newd`;~ Input `new` `InputPanel1` `newdr`;\ mapkey(continued) ~ Input `new` `InputPanel1` `newdra`;~ Input `new` `InputPanel1` `newdraw`;\ mapkey(continued) ~ Input `new` `InputPanel1` `newdrawi`;\ mapkey(continued) ~ Input `new` `InputPanel1` `newdrawin`;\ mapkey(continued) ~ Input `new` `InputPanel1` `newdrawing`;\ mapkey(continued) ~ Update `new` `InputPanel1` `newdrawing`;~ Activate `new` `InputPanel1`;\ mapkey(continued) ~ Activate `dwg_create` `psh_ok`;~ Activate `open_rep` `OK`; Edited file to be copied to config.pro: mapkey test @MAPKEY_LABELtesting;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Activate `new` `OK`;\ mapkey(continued) ~ Activate `dwg_create` `psh_ok`;~ Activate `open_rep` `OK`; mapkey test @MAPKEY_LABELtesting;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Input `new` `InputPanel1` `newdrawing`;\ mapkey(continued) ~ Update `new` `InputPanel1` `newdrawing`;~ Activate `new` `InputPanel1`;\ mapkey(continued) ~ Activate `dwg_create` `psh_ok`;~ Activate `open_rep` `OK`; Regards-

Try this one: mapkey cgb @MAPKEY_NAMEretrieve model name and create new drawing of that \ mapkey(continued) name;@MAPKEY_LABELtest file;~ FocusIn `main_dlg_cur` `proe_win`;\ mapkey(continued) ~ Command `ProCmdModelRename` ;~ Activate `rename` `Cancel`;\ mapkey(continued) ~ FocusIn `main_dlg_cur` `proe_win`;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;~ Input `new` `InputPanel1` `PART_TEST2`;\ mapkey(continued) ~ Update `new` `InputPanel1` `PART_TEST2`;~ Activate `new` `OK`;\ mapkey(continued) ~ FocusIn `main_dlg_cur` `proe_win`;~ Activate `dwg_create` `psh_ok`;\ mapkey(continued) ~ FocusIn `main_dlg_cur` `proe_win`; Rename it to whatever you want. Basically I recorded a mapkey, selecting "Pause for Keyboard Input". I selectef File\Rename, highlighted the part name and typed ctrl-c, then canceled out of the file rename window. Then did File\New and hit the drawing button. In the file name I did ctrl-v and hit ok, then accepted defaults on the new drawing dialog page and hit ok again. Seems to work out ok. Hope it helps. Chris
Chris Benner
Autodesk ® Expert Elite

Ok, on further testing this didn't work more than once. Second drawing kept pasting the name of the first one I tested on. Sorry. I'll keep trying.
Chris Benner
Autodesk ® Expert Elite

Ok. There seems to be no way to automatically grab and store the model name in a mapkey, without some user interaction. What I've come up with is a mapkey that, when executed, calls up the "File Rename" command and prompts you to highlight the file name and copy it to the clipboard. DO NOT HIT OK after copying, instead select "RESUME" on the user input box. Mapkey will then call the "New Drawing" dialog box and prompt you to paste the filename in the box. Again, DO NOT HIT OK, but hit the "RESUME" button. The mapkey will do the rest and you will have a new drawing file named to the same as the part. This isn't exactly what you wanted, but I think this is the closest we're going to get. It does at least minimize the user interaction, and automates MOST of the process. Here it is: mapkey 1w @MAPKEY_NAMEtest;@MAPKEY_LABELtest;\ mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `File`;\ mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;~ Command `ProCmdModelRename` ;\ mapkey(continued) @MANUAL_PAUSEHighlight Model name, right click and copy.;\ mapkey(continued) ~ Activate `rename` `Cancel`;~ Command `ProCmdModelNew` ;\ mapkey(continued) ~ Select `new` `Type`1 `Drawing`;@MANUAL_PAUSEPaste copied Part name.;\ mapkey(continued) ~ Activate `new` `OK`;~ Activate `dwg_create` `psh_ok`; You can change the mapkey strokes, I used 1W simply because it's what I typed. LOL You can also change the mapkey label which is simply "test" at this point. Hope it works! Chris
Chris Benner
Autodesk ® Expert Elite

I was waiting to see if Chris could over come the grabbing and storing the name, but I had my doubts that would work. I have never run into a case where you could do this without user inputs, but I'm sure the intention by the software people was that some people use different names in there drawings compared to model names; example assy name "526-1", drawing name "526". Hats off to Chris for trying to beat Pro-E into submission.

Gunnar - I missed the fact the part file name was to be passed as the drawing file name. Nice work Chris, I do not see how to pass object values in mapkeys. This task could be done with Pro/Toolkit or the VB API, the code for the task is an example in the WF4.0 User's Guides. So a mapkey could be created that called a program that creates the new drawing with the current part name. Regards-

One thing PTC needs to work on in the future is to make the customization of their products more user freindly and integrated into the base software. For two users, we saw no reason to get any of the programming tools, nor do either of us speak any programming languages. There are probably more of us out there in this boat than there are people who can write outside apps with Pro Program or Toolkit or Jlink or VBA or whatever. For my situation, if I can't do it in a Mapkey... I'm pooched! But I do like a good challenge, and it was a slow day. :)~
Chris Benner
Autodesk ® Expert Elite

Here is a crude javascript zipped HTML file that can be used with the Pro/Web.Link module. It was pasted together from the files in the WF4 weblinkexamples folder. Pro/E and internet options must be set to allow javascript to run in the internal Pro/E browser. Config option web_enable_javascript = on. NT Explorer Security Settings = Scripting>Enable. Referenced from Pro/Web.Link user manual. Create a mapkey to load the html file into the browser. The c_drawing template is from the default Pro/E templates folder. The file will only work from a part or assembly model. The file will not create a drawing from a family table instance. The file worked for WF4 and WinXP-Pro. Regards-

OK fellows, here is a solution I found on www.cad.de: Put this mapkey into your config.pro:

mapkey nd @MAPKEY_LABELnew drw with name from prt/asm

mapkey(continued) ~ Activate `main_dlg_cur` `File.psh_save`;\

mapkey(continued) @SYSTEM\start WScript.exe C:\\ptc_wf3\\nd.vbs

c:\ptcwf3 is my working directory

Then crate a notepad nd.txt file with this tekst:

'script nd.vbs together with pro-e mapkey nd creates new drawing with the same name as active prt/asm
'Sleep times might be adjusted up or down on various PCs

'Option Explizit

WScript.Sleep 300

Dim Fi, Fso

Set Shell = CreateObject("WScript.Shell")
Set WshShell = WScript.CreateObject("WScript.Shell")

Sub sk(Befehl)
'wscript.echo befehl
WshShell.SendKeys(Befehl)
WScript.Sleep 1000 'Time in msec

End Sub

sk "^s"
sk "{TAB 3}"
sk "{BS 4}"
sk "+^{left}"
sk "^c"
'sk "^a"
sk "^n"
sk "^v"
'choose "Drawing":
sk "{TAB 3}"
sk "{DOWN}"
sk "{TAB 3}"
sk "{DOWN}"
sk "{TAB 3}"
sk "{DOWN}"
sk "~"

WScript.Quit()

'After an idea from Marco Taylor: http://ww3.cad.de/foren/ubb/Forum12/HTML/010934-6.shtml

Rename nd.txt to nd.vbs and place the file according to the mapkey you just made. I have it on my working dir. It works with all prts and asms! Enjoy!

PS: You can try to make the Sleep time smaller down to zero.

PPS: If you make it bigger (2000) you can follow the program.

PPPS: It might be needed to adjust the numbers TAB in the nd.vbs file.

See CAD.DE:http://ww3.cad.de/foren/ubb/Forum12/HTML/010934.shtml#000009

Message was edited by: Gunnar Hansen

And one more PS: It works for WF3 Best regards, Gunnar

Hey guys so I have a somewhat work around which allows you to create a new 2D drawing using the same part number.

Because Creo doesn't like pasting what's in your clipboard on the new filename section, the only thing you will have to do is press Ctrl+V and enter. The macro creates a parameter called CAD_NUMBER which is essentially your model_name but allows a place to copy the name, then create new drawing, it then pauses at the filename stage, you press Ctrl+V then enter, and finish your drawing format preferences.

mapkey 2ddwg @MAPKEY_LABELCreate New 2D dwg;~ Command `ProCmdMmRels` ;\
mapkey(continued) ~ Update `relation_dlg` `RelText` 1 27 54 1 `\nCAD_NUMBER=rel_model_name()`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;~ Command `ProCmdMmParams` ;\
mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCAD_NUMBER` `value`;\
mapkey(continued) ~ RButtonArm `relation_dlg` `ParamsPHLay.ParTable` 2 `rowCAD_NUMBER` `value`;\
mapkey(continued) ~ PopupOver `relation_dlg` `ParamsPHLay.ParamUtils` 1 `ParamsPHLay.ParTable`;\
mapkey(continued) ~ Open `relation_dlg` `ParamsPHLay.ParamUtils`;\
mapkey(continued) ~ Close `relation_dlg` `ParamsPHLay.ParamUtils`;\
mapkey(continued) ~ Activate `relation_dlg` `ParamsPHLay.PBCopy`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;~ Command `ProCmdModelNew` ;\
mapkey(continued) ~ Select `new` `Type` 1 `Drawing`;\
mapkey(continued) ~ Activate `new` `chk_use_default_template`0 ;\
mapkey(continued) %partnamenew;\
mapkey(continued) @MANUAL_PAUSEName drawing and Resume.;\
mapkey(continued) ~ Activate `new` `OK`;\
mapkey(continued) ~ Select `dwg_create` `rad_format` 1 `2`;\
mapkey(continued) ~ Activate `dwg_create` `psh_format_browse`;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `shanen_format_a3.frm`;\
mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `PREVIEW_POPUP_TIMER` \
mapkey(continued) `file_open:Ph_list.Filelist:<NULL>`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`;

 

Hope this helps.

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags