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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

Quick open drawing from part

BH_10112168
3-Newcomer

Quick open drawing from part

Hello Team,

-Creo 9 with Windchill.

I'm looking to create a mapkey to quickly open a drawing of a room that's already open.

I've done a lot of research and i can never find a working solution. please don't redirect me to an alternative solution.


I know that a part can have several drawings or be included in other drawings. However, in my case, 90% of the parts created have only one drawing, which has exactly the same name as the part, with .drw instead of .prt.
I've created a relationship: DRAWING = PART_ID+ ".DRW".
I now have a parameter with the right value.
Since copy and paste doesn't work in mapkey commands, is there a line of OS script code that you could put in a mapkey to say, open "parametre drawing"?
I work in a company that doesn't allow third-party applications to be installed.

Thank in advance.

8 REPLIES 8

Hello,

I made this mapkey many years ago, not sure if it is still working these days. Try putting it in you config.pro and calling mapkey X.

 

mapkey x @MAPKEY_NAMEOpen drawing;@MAPKEY_LABELDrawing;\
mapkey(continued) %>partname; %load;\
mapkey(continued) ~ Command `ProCmdModelOpen` ;\
mapkey(continued) ~ Select `file_open` `Type` 1 `db_4`; %partname;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`;
!!!!!!!!!!!!!!!!!!!!!!!!
mapkey >partname @MAPKEY_NAMEGets partname;\
mapkey(continued) ~ Command `ProCmdModelSaveAs` ;~ Select `file_saveas` `type_option` 1 `db_129`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;~ Activate `UI Message Dialog` `ok`;\
mapkey(continued) @SYSTEMdel sw.pro\ndir /b *.pic>filename.txt\nset /p \
mapkey(continued) VAR1=<filename.txt\ndel filename.txt\nSET FILENAME=\%VAR1:\~0,-4\%\necho mapk\
mapkey(continued) ey partname \~ Input `file_open` `EMBED_BROWSER_SEARCH_IP` `%FILENAME%`\\
mapkey(continued) ;>>sw.pro\ndel *.pic;
!!!!!!!!!!!!!!!!!!!!!!!!
mapkey load @MAPKEY_NAMEload mapkey;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg` ;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
mapkey(continued) ~ Select `ribbon_options_dialog` `ConfigLayout.ImportExportBtn`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `sw.pro`;\
mapkey(continued) ~ Update `file_open` `Inputname` `sw.pro`;~ Activate `file_open` `Inputname`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`; @SYSTEMDel sw.pro;

 

 

Hi,

OP uses Creo 9 with Windchill. Therefore I am curious where partname.pic will be saved by your mapkey. Maybe it will be necessary to modify the mapkey a little bit to save partname.pic into specific directory.


Martin Hanák

Yes, you are correct. I don´t use Windchill and all this is done on working directory.

Maybe someone windchill can tweak the mapkey a little to meet the requirements?

Hi,

 

For Creo with Windchill, you could use this lhoogeveen's mapkey

 

It works in creo8, I hope it will work also in Creo9...

Hi @Trebla 

Thank you for your reply.

 

I assume you're referring to this one?

 

mapkey odrw @MAPKEY_NAMEOpen drawing with same name as active model or selected assembly part;\
mapkey(continued) @MAPKEY_LABELOpen Drawing w/ Same Name (odrw);\
mapkey(continued) ~ Command `ProCmdOpenModel@PopupMenuGraphicWinStack`;\
mapkey(continued) ~ Activate `open_instance` `open`;\
mapkey(continued) %>storetmpfile;%>partnameopen;%>loadconf;\
mapkey(continued) ~ Command `ProCmdModelOpen`;\
mapkey(continued) ~ Activate `file_open` `workspace_pb`;\
mapkey(continued) %partnameopen;\
mapkey(continued) ~ Activate `file_open` `Inputname`;


How does this mapkeys work?
When I try to create one in Creo, I am limited by the number of characters I can enter in the OS script tab.

BH_10112168_0-1710940017938.png

This is probably not the right way to do it.
Can you help?

Thanks

Hi BH,

 

Yes this is the mapkey, but it is a nested mapkey, so you need also: storetmpfile mapkey, partnameopen mapkey, loadconf mapkey...

If you take only a piece, it will never work.

sorry I do not know the tricks about OS mapkeys , I can tell you that this one works fine:

 

mapkey odrw @MAPKEY_NAMEOpen drawing with same name as active model or selected assembly part;\
mapkey(continued) @MAPKEY_LABELOpen Drawing w/ Same Name (odrw);\
mapkey(continued) ~ Command `ProCmdOpenModel@PopupMenuGraphicWinStack`;\
mapkey(continued) ~ Activate `open_instance` `open`;\
mapkey(continued) %>storetmpfile;%>partnameopen;%>loadconf;\
mapkey(continued) ~ Command `ProCmdModelOpen`;\
mapkey(continued) ~ Activate `file_open` `workspace_pb`;\
mapkey(continued) %partnameopen;\
mapkey(continued) ~ Activate `file_open` `Inputname`;

!======================
mapkey >storetmpfile @@MAPKEY_LABELStore model name to temp file;
mapkey(continued) ~ Command `ProCmdModelSaveAs` ;\
mapkey(continued) #CURRENT VALS;\
mapkey(continued) ~ Activate `storage_conflicts` `Close_PushButton`;\
mapkey(continued) ~ Select `file_saveas` `type_option` 1 `db_129`;\
mapkey(continued) ~ Activate `file_saveas` `check_is_secondary` 0;\
mapkey(continued) ~ Activate `file_saveas` `Current Dir`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;\
mapkey(continued) ~ Activate `UI Message Dialog` `ok`;

mapkey >partnameopen @MAPKEY_LABELGets partname to open drawing;\
mapkey(continued) @SYSTEMdel sw.pro\n\
mapkey(continued) dir /b *.pic>\%temp\%\\filename.txt\n\
mapkey(continued) set /p VAR1=<\%temp\%\\filename.txt\n\
mapkey(continued) del \%temp\%\\filename.txt\n\
mapkey(continued) set FILENAME=\%VAR1:\~0,-4\%\n\
mapkey(continued) echo mapkey partnameopen \~ Update `file_open` \
mapkey(continued) `Inputname` `\%FILENAME\%.drw`\;>>sw.pro\n\
mapkey(continued) del *.pic;
mapkey >partnamenew @MAPKEY_LABELGets partname for new part;\
mapkey(continued) @SYSTEMdel sw.pro\n\
mapkey(continued) dir /b *.pic>\%temp\%\\filename.txt\n\
mapkey(continued) set /p VAR1=<\%temp\%\\filename.txt\n\
mapkey(continued) del \%temp\%\\filename.txt\n\
mapkey(continued) set FILENAME=\%VAR1:\~0,-4\%\n\
mapkey(continued) echo mapkey partnamenew \~ Input `new` \
mapkey(continued) `InputPanel1` `\%FILENAME\%`\;>>sw.pro\n\
mapkey(continued) del *.pic;

mapkey >loadconf @MAPKEY_LABELLoad mapkey into session;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg`;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Update `file_open` `Inputname` `sw.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen@context_dlg_open_cmd`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;\
mapkey(continued) ~ Activate `UITools Msg Dialog Future` `no`;\
mapkey(continued) @SYSTEMDel sw.pro;
!======================

Commenting on here, since Creo 11 does not support mapkey loading as it used to, so the >loadconf mapkey fails. I've updated the script to work again and renamed to "dw" since it is easier to type it with one hand on the keyboard:

 

mapkey dw @MAPKEY_NAMEOpen drawing with same name as active model or selected assembly part;\
mapkey(continued) @MAPKEY_LABELOpen Drawing w/ Same Name (dw);\
mapkey(continued) ~ Command `ProCmdOpenModel@PopupMenuGraphicWinStack`;\
mapkey(continued) ~ Activate `open_instance` `open`;\
mapkey(continued) %>storetmpfile;%>partnameopen;%>loadconf;\
mapkey(continued) ~ Command `ProCmdModelOpen`;\
mapkey(continued) ~ Activate `file_open` `workspace_pb`;\
mapkey(continued) %partnameopen;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`;

!====================== Background mapkeys used by other mapkey dw
mapkey >storetmpfile @MAPKEY_LABELStore model name to temp file;\
mapkey(continued) ~ Command `ProCmdModelSaveAs` ;\
mapkey(continued) #CURRENT VALS;\
mapkey(continued) ~ Activate `storage_conflicts` `Close_PushButton`;\
mapkey(continued) ~ Select `file_saveas` `type_option` 1 `db_129`;\
mapkey(continued) ~ Activate `file_saveas` `check_is_secondary` 0;\
mapkey(continued) ~ Activate `file_saveas` `Current Dir`;\
mapkey(continued) ~ Activate `file_saveas` `OK`;\
mapkey(continued) ~ Activate `UI Message Dialog` `ok`;

mapkey >partnameopen @MAPKEY_LABELGets partname to open drawing;\
mapkey(continued) @SYSTEMdel sw.pro\n\
mapkey(continued) dir /b *.pic>\%temp\%\\filename.txt\n\
mapkey(continued) set /p VAR1=<\%temp\%\\filename.txt\n\
mapkey(continued) del \%temp\%\\filename.txt\n\
mapkey(continued) set FILENAME=\%VAR1:\~0,-4\%\n\
mapkey(continued) echo mapkey partnameopen \~ Update `file_open` \
mapkey(continued) `Inputname` `\%FILENAME\%.drw`\;>>sw.pro\n\
mapkey(continued) del *.pic;

mapkey >loadconf @MAPKEY_LABELLoad mapkey into session ~ Update `main_dlg_cur` `search_panel_pholder.search_panel_input_panel` `mapk`;\
mapkey(continued) ~ Trigger `search_panel_list_of_main_dlg_cur` `search_panel_list` `` `commands_group`;\
mapkey(continued) ~ Trigger `search_panel_list_of_main_dlg_cur` `search_panel_list` `ProCmdUtilMacros`;\
mapkey(continued) ~ Select `search_panel_list_of_main_dlg_cur` `search_panel_list` 1 `ProCmdUtilMacros`;\
mapkey(continued) ~ Command `ProCmdUtilMacros` ;\
mapkey(continued) ~ Trigger `search_panel_list_of_main_dlg_cur` `search_panel_list` ``;\
mapkey(continued) ~ Select `mapkey_main` `ImpExpCascButton`;\
mapkey(continued) ~ Close `mapkey_main` `ImpExpCascButton`;\
mapkey(continued) ~ Activate `mapkey_main` `psh_import`;\
mapkey(continued) ~ Activate `file_open` `Current Dir`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `sw.pro`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `sw.pro`;\
mapkey(continued) ~ Activate `mapkey_main` `CloseButton`;\
mapkey(continued) ~ FocusIn `unsaved_mapkeys` `yes`;\
mapkey(continued) ~ Activate `unsaved_mapkeys` `yes`;\
mapkey(continued) @SYSTEMDel sw.pro;
!======================

 

N-Pyn
15-Moonstone
(To:TC_9543675)

Hi,
We noticed a bit of a problem with this old mapkey trick if Creo is connected to Windchill and automatic number generation is on. It uses Save As dialog to get the current part filename, so every time the mapkey is used, it wastes one number from the sequence.

I modified the >storetmpfile and >partnameopen mapkeys to use parameter export instead:

mapkey >storetmpfile @MAPKEY_LABELStore model name to temp file;\
@SYSTEMdel *_par.txt\n;\
~ Command `ProCmdMmParams` ;\
~ Activate `relation_dlg` `PBExportTXT`;\
~ Activate `file_open` `Current Dir`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
~ Activate `relation_dlg` `PB_Cancel`;

mapkey >partnameopen @MAPKEY_LABELGets partname to open drawing;\
@SYSTEMdel sw.pro\n\
dir /b *_par.txt>\%temp\%\\filename.txt\n\
set /p VAR1=<\%temp\%\\filename.txt\n\
del \%temp\%\\filename.txt\n\
set FILENAME=\%VAR1:\~0,-8\%\n\
echo mapkey partnameopen \~ Update `file_open` \
`Inputname` `\%FILENAME\%.drw`\;>>sw.pro\n\
del *_par.txt;

 
Otherwise the combined mapkey should work as before, so you can just replace these two mapkeys regardless of whether you use the "old" mapkeys or the Creo 11 compatible one made by TC_9543675 (catchy name btw).

 

It would be nice if PTC created a proper way to open a related drawing LIKE EVERY OTHER CAD IN EXISTENCE so we wouldn't have to keep using this 20 year old hack.

 

And yes, I know that you can have multiple drawings of one model, but then you could have a dialog listing those drawings and ask the user which one they want to open.

Announcements
NEW Creo+ Topics: Real-time Collaboration

Top Tags