Skip to main content
3-Newcomer
February 7, 2024
Question

Quick open drawing from part

  • February 7, 2024
  • 17 replies
  • 4486 views

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.

17 replies

12-Amethyst
February 8, 2024

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;

 

 

24-Ruby III
February 8, 2024

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.

12-Amethyst
February 8, 2024

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?

Community Manager
August 4, 2026

Any additional feedback on this?

6-Contributor
August 5, 2026

So I recorded a mapkey while opening something from our Commonspace, this is the result:

 

mapkey(continued) ~ Activate `file_open` `wccabinets_pb`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `Products`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `Standardprodukt`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `CAD`;\

This is our internal folder structure (Products - Standardprodukt - CAD). When opening, it now jumps to the common space, but it still opens the part with the lowest number. So there is still something wrong with the command “partnameopen” in the mapkey above, I think.

 

6-Contributor
August 5, 2026

I spent another full working day on this topic today. It works on my machine, but not on a colleague’s. We’re using Creo and Windchill in two different languages, which is probably causing the problem. Is it even possible to handle that within a single mapkey?

I’m also having issues with the sw.pro file: on my system it has now been recreated, but on my colleague’s system it hasn’t. I need the sequence type – del – type, because otherwise the system doesn’t create the file at all. The code is looking like that for now:

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` `wccabinets_pb`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `Products`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `Standardprodukt`;\
mapkey(continued) ~ Activate `file_open` `Ph_list.Filelist` 1 `CAD`;\
mapkey(continued) %partnameopen;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd`;

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

mapkey >partnameopen @MAPKEY_LABELGets partname to open drawing;\
mapkey(continued) @SYSTEMtype nul > sw.pro\n\
mapkey(continued) del sw.pro\n\
mapkey(continued) type nul > sw.pro\n\
mapkey(continued) dir /b *_par.txt>\%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,-8\%\n\
mapkey(continued) echo mapkey partnameopen \~ Update `file_open` `Inputname` `\%FILENAME\%.drw`\;>>sw.pro\n\
mapkey(continued) del *_par.txt;\n\

mapkey >loadconf @MAPKEY_LABELLoad mapkey into session ~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
mapkey(continued) ~ Select `file_open` `Ph_list.Filelist` 1 `sw.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;\
mapkey(continued) ~ Activate `UITools Msg Dialog Future` `no`;

Michael_Bourque
14-Alexandrite
August 5, 2026

I’m going to suggest a PTC add this he capability in the future. It would seem very trivial to do. 

Michael Bourque