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

kskatun
10-Marble

Mapkey

Hi,

I have a mapkey which takes the current model and save it as igs,step and 3dpdf and puts it in c:\temp.

 

The problem is that these files needs to be moved to a spesfic folder, this folder name is the same as the workspace/winchill folder name and is located at : Z:Project/%PROJ_NO/Files

 

 

I tried to launch this OS script: start excel Z:\Dokumentstyring\Parameters.xlsm \e\%PROJ_NO, but it seems like i cant pass parameters from creo to the script, is that correct?


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.

ACCEPTED SOLUTION

Accepted Solutions
kskatun
10-Marble
(To:kskatun)

I solved it,I figured out I could launch several mapkeys :

mapkey _del @MAPKEY_LABELDelete Files;@SYSTEMc:\\Temp\\Creo\\delete.bat;

mapkey _start @MAPKEY_LABELStart Files;@SYSTEMc:\\Temp\\Creo\\start.bat;

mapkey <g @MAPKEY_LABELGenerate Files;%Delete Files;%Create Jpeg File;%Create Step File;%Create Iges file;%Create 3DPdf File;%Start Files;

View solution in original post

9 REPLIES 9
Chris3
21-Topaz I
(To:kskatun)

You can pass variables. I am not exactly sure what you are doing, but I have passed variables like this before:

mapkey(continued) @SYSTEMZ:\\folder\\subfolder\\script.VBS variable ;\

Where "variable" is the variable that you are passing. Note that the "variable" in the mapkey is going to be static - that is to say it will not change. Mapkeys are not a programming language in that you can not place variables that change with in them. They are just a recording of what functions you call and what you type with in Creo. If you need something that is dynamic you will have to do some outside processing or use one of the APIs.

kskatun
10-Marble
(To:Chris3)

Well what i ment was that i want to pass model number, project number etc to my script. Pretty much like u said mapkey(continued) @SYSTEMZ:\\folder\\subfolder\\script.VBS variable

However the variable should be model name/number, so if i run my mapkey with part 1234.prt as active it will be @SYSTEMZ:\\folder\\subfolder\\script.VBS 1234

and if then 2345.prt is active it will be @SYSTEMZ:\\folder\\subfolder\\script.VBS 2345

In table in drawing mode/relations etc you use %PTC_MODELNUMBER but i am unable to get this to work in mapkey.

So basically what I want to do, what I now do manually outside creo is:

I have finished making a part, I then want to let our project leader know about this as well as our drawing expert(it also add it to the list of parts to be produced,etc..). So my nice excel script do all this, but i need to type in the filename manually, and i would like to avoid this step.

ReinhardN
12-Amethyst
(To:kskatun)

Kim,

see Gunnar Hansen in MCAD Central Opening drawing of active part

He uses a VBS script to walk through the Creo dialog, copies the filename to clipboard and pastes it into the dialog.

Comment sign in VBS is ' so comment all steps out and recall them one by one to see it working.

I think you could use this method.

Reinhard

More information here: Mapkey: Zeichnung öffnen vom Part (PTC Engineering Solutions/Pro ENGINEER) - Lösung vorhanden! - Foren auf CAD.de

(in German)

Chris3
21-Topaz I
(To:kskatun)

The only way to do what you are looking for is to do some post processing with an outside script or with one of the APIs (which are very criptic and requires higher level programming)

Another way to do what Reinhard is suggesting above is to dump the info you want to a text file and then post process that with VBA or other external processing lang. For instance if they were all pramaters, you could export all of your parameters to a text file. Another way is to create a new blank page in the drawing and then save that as a text file and post process that for the information I want.

You may also want to examine using mapkeys to export the model data/information before running your script, and have your script read the information from the file(s) instead of trying to place a variable on the script line.

For example, you can export the model tree to a .txt file via a mapkey, and have your VBS script read the model file name from the tree.txt file.  You can also export the parameters, relations, etc. to various file types (.csv, .txt, etc.) and have your script get information from those files.

You may want to look at AutoIt for automated interaction with Creo dialogs (and Windows dialogs in general).  https://www.autoitscript.com/site/

Regards,

Kim,

if you tell me from where do you get %PROJ_NO (this means workspace/winchill folder name) then I can prepare AutoHotkey script for you.

Martin Hanak


Martin Hanák

Hi,

We store the information in parameters in the model. I started to look autohotkey, seems promissing:)

Screenshot_3.png

Thanks heaps

kskatun
10-Marble
(To:kskatun)

I solved it,I figured out I could launch several mapkeys :

mapkey _del @MAPKEY_LABELDelete Files;@SYSTEMc:\\Temp\\Creo\\delete.bat;

mapkey _start @MAPKEY_LABELStart Files;@SYSTEMc:\\Temp\\Creo\\start.bat;

mapkey <g @MAPKEY_LABELGenerate Files;%Delete Files;%Create Jpeg File;%Create Step File;%Create Iges file;%Create 3DPdf File;%Start Files;

Dale_Rosema
23-Emerald III
(To:kskatun)

Don't forget to mark your answer as correct for those who may search on this topic.

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags