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

working "copy name" mapkey!

bp
Regular Member

working "copy name" mapkey!

When you want to add a part to an assembly, you can browse for it or fill in this part's name.

The problem with this is that you must know what you are looking for. In my experience in many cases its easier to place the name of a part to the clipboard when it's still open and use this when adding this part to an assembly etc.

 

When you want to create a simple mapkey which copies the name of a part/asm you have open, you are going to fail because for some reason this doesnt work.

 

I overcome the "copy name" problem by creating a mapkey which does the following:

 

first create a log-file which contains the name of the current part in the working directory.

Then a batch file with DOS script copies this name to memory and then the log-file is deleted.

 

Im sure you can do this even more efficient with Pro/Toolkit but I'm not familiar with and I dont know why PTC does not just program these mapkeys themselves.

 

 

Do the following steps:

 

1.

find the path of your working directory (in this case I used "C:\working-directory") and open config.pro with notepad (right mouseclick --> open with..)

 

2.

paste the following lines in config.pro, replace "C:\working-directory\" with your own path and save.

 

mapkey cc ~ Command `ProCmdInfoAuditTrail` ;#FILE;\

mapkey(continued) @SYSTEMC:\\working-directory\\clipboard.bat;\

mapkey(continued) @SYSTEMdel C:\\working-directory\\modiflist.inf.*;

 

3.

paste clipboard.bat in your working directory. Open clipboard.bat with notepad (right mouseclick --> EDIT) and replace "C:\working-directory\" with your own path and save.

 

4. restart CREO 2.0. The mapkey is activated by pressing "cc" or you can add an Icon that activates the mapkey.

 

Works like a charm on my system, but I cant guarantee that is works on other machines.

7 REPLIES 7

Re: working "copy name" mapkey!

Any good way to use a global variable that will read the current working directory and use that for the path.  My working directory is not always the same, it changes throughout the day depending on what project I am working on.

Good work though.  I have used the PTC support to try to do something similar.  I wanted to read the mdoel name, create a new drawing and have Creo use the model name for the drawing name all on a make drawing map key.  They did know how to do it and I never had time to sit down and figure it out.

Re: working "copy name" mapkey!

I'm going to try this, it's exactly what we need : most models (parts in particular) have no drawing, except the drawings that are created for helping the production department to actually build the part. Then, we manually type the filename for the drawing to correspond with the filename of the model. Not really fail-safe, I can tell...

I'll keep you posted !

Re: working "copy name" mapkey!

This thread hasn't been used for some time. But there has been some progress

 

My colleague found a part of the solution. Since copy paste doesn't work, and we can not use the Bat file mentioned above (because of changing working directory) we have found a lite work aroud for the copy filename part.

this mapkey copies the filename of the activated part / assembly

- Go to relations >

- button "provide the value..." (questionmark symbol)" 

- copy "rel_model_name" in the expression window

- push evaluate

- push "I" info button next to result window
- choose "edit" and check "edit mode"

- now select the bottom line with your mouse

- choose "edit" and copy.

 close > close > ok en stop the mapkey

 

I don't see where I can upload a file as an attachment: (video or pictures are ok, but no files)

 



the config code: in summary to save space

 

mapkey cf @MAPKEY_LABELcopy filename;~ Command `ProCmdMmRels` ;\
mapkey(continued) ~ Activate `relation_dlg` `TBEvaluate`;\
mapkey(continued) ~ Trail `relation_dlg` `RelText` `activate_Evaluate` ``;\
mapkey(continued) ~ Input `evaluate_expression` `Expression` `rel_model_name`;\
mapkey(continued) ~ Update `evaluate_expression` `Expression` `rel_model_name`;\
mapkey(continued) ~ Activate `evaluate_expression` `Evaluate`;\
mapkey(continued) ~ Activate `evaluate_expression` `PBInfo`;\
mapkey(continued) ~ Select `texttool` `MenuBar` 1 `EditMenu`;~ Close `texttool` `MenuBar`;\
mapkey(continued) ~ Activate `texttool` `EditModeCB` 1;\
mapkey(continued) ~ LButtonArm `texttool` `textPH.TextArea` 3 2 107 0;\
mapkey(continued) ~ Move `texttool` `textPH.TextArea` 3 3 107 0;\
mapkey(continued) ~ Move `texttool` `textPH.TextArea` 3 4 107 0;\

 

missing lines here to keep post short; create lines from 4 to 256 yourself

 

 

mapkey(continued) ~ Move `texttool` `textPH.TextArea` 3 256 111 0;\
mapkey(continued) ~ LButtonDisarm `texttool` `textPH.TextArea` 3 256 111 0;\
mapkey(continued) ~ LButtonActivate `texttool` `textPH.TextArea` 3 256 111 0;\
mapkey(continued) ~ Select `texttool` `MenuBar` 1 `EditMenu`;~ Close `texttool` `MenuBar`;\
mapkey(continued) ~ Activate `texttool` `CopyPushButton`;~ Activate `texttool` `CloseButton`;\
mapkey(continued) ~ Activate `evaluate_expression` `Close`;~ Activate `relation_dlg` `PB_OK`;

Re: working "copy name" mapkey!

I tried your method of Relation editor, but the problem is when I run the mapkey on another model, the file name that was copied while creating the mapkey is still in the clipboard, and Iam not able to use the current model name.

When I check the .pro file I see that the model name that I copied appear in the mapkey lines.

Is there anything that Iam missing?

Re: working "copy name" mapkey!

I would just go with AutoIt or create a VBA macro that generates a mapkey on the fly. Trying to outguess the limitations in mapkey recording and the recordable parts of the interface is an endless chore. Some features are only reachable via mapkey, but they can be incorporated into externally managed software.

Re: working "copy name" mapkey!

manjunathrv. It's always hard to search for an error; like dschenken pointed out.

however, since yesterday the mapkey has improved. It already worked yesterday, but the code is simplified and for as far as I can tell it is faster.

 

The mapkey now uses a .bat file tot copy the filename: which it temporary stores in directory c:\pro_engineer\

 

copy this into your config.pro

 

mapkey cf @MAPKEY_LABELcopy filename;\
mapkey(continued)~ Command `ProCmdMmRels` ;\
mapkey(continued) ~ Activate `relation_dlg` `TBEvaluate`;\
mapkey(continued) ~ Trail `relation_dlg` `RelText` `activate_Evaluate` ``;\
mapkey(continued) ~ Input `evaluate_expression` `Expression` \
mapkey(continued) `rel_model_name`;\
mapkey(continued) ~ Update `evaluate_expression` `Expression` \
mapkey(continued) `rel_model_name`;\
mapkey(continued) ~ Activate `evaluate_expression` `Evaluate`;\
mapkey(continued) ~ Activate `evaluate_expression` `PBInfo`;\
mapkey(continued) ~ Select `texttool` `MenuBar` 1 `FileMenu`;~ Close `texttool` `MenuBar`;\
mapkey(continued) ~ Activate `texttool` `SaveAsPushButton`;\
mapkey(continued) ~ Update `file_saveas` `Inputname` `C:\\pro_engineer\\step.txt`;\
mapkey(continued) ~ Activate `file_saveas` `Inputname`;~ FocusIn `texttool` `textPH.TextArea`;\
mapkey(continued) ~ Activate `texttool` `CloseButton`;~ Activate `evaluate_expression` `Close`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_Cancel`;~ Activate `0_std_confirm` `OK`;\
mapkey(continued) @SYSTEMW:\\creo4\\msdos\\clipboard.bat;\
mapkey(continued) @SYSTEMdel c:\\pro_engineer\\step.txt.*;

 

 

create a file named clipboard.bat in w:\ creo4\ msdos\ 

 

copy this code into the bat file

 

@echo on

COPY /Y NUL C:\pro_engineer\clipboard.txt


for /f "skip=6" %%s in (C:\pro_engineer\step.txt.1) do echo %%s>>C:\pro_engineer\clipboard.txt

clip < C:\pro_engineer\clipboard.txt

 

 

Obviously you need to change the directory's .
We now use several mapkeys based on this one. 

- to save a step file including revision in de the filename

- to start a new drawing; we copy the filename change the first charcter "p" into a "d" etc.

- to open the drawing that belongs to a opened part,

  for all of the above: we stil have to paste manually. So the routine is > run mapkey > ctrl-v and continue. 

Re: working "copy name" mapkey!

Maybe my tool "Copy Model Tree Element Name To Clipboard" is helpful for you too?!

If you want, please have a look at my topic "Copy name of model tree element to clipboard" ...