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
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.
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.
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 !
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`;
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?
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.
@ 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.
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" ...
Unfortunately works only on Creo without Windchill. With Windchill always copies to clipboard sentence "End of Trail File" 😞
That's funny.
I'm responsible for about 200 Creo users who also work with Windchill and none of them has this problem.
I myself also work with Creo plus Windchill and can't reproduce your phenomenon.
Unfortunately still doesn't work. Creo 4.0 with Windchill on Windows 7. On Creo 4.0 without Windchill on Windows 10 works. Thank's.
And what about Creo 4.0 with Windchill on Windows 10?
I would rather suspect Windows 7 as the culprit, but I can't test that because we haven't used Win7 computers for a while.
Only for completed trail files is the text "End of Trail File" at the end. Trail files from running Creo sessions do not have this text inside.
So my tool does not seem to have found the trail file of the running Creo session.
My approach here is to collect the creation date of all trail files trail.txt.* in the trail directory and then determine the trail file with the most recent creation date as the one of the current Creo session.
And here something probably went wrong on your Windows 7 computer.
As a simple solution, can you delete all trail files on your Windows 7 computer and try again?
Really I don't know what are trail.txt files and I don't know if I can delete them without any problems? I found a lot of such files on computer in diffrent location. It's not worry to delete all of them?
Trail files can be safely deleted.
In principle, these are only records of Creo sessions and a new trail file is created with every Creo start.
You can find more detailed information in the Help Center: https://support.ptc.com/help/archive/creo40/creo_pma/usascii/#page/fundamentals%2Ffundamentals%2Ffund_two_sub%2FAbout_Trail_and_Training_Files.html%23
Thank you very much for the advice. I will keep trying.
Great! It’s works! 🙂
In my company the „TrailDir” is called “trials”. Elier I didn’t realize that “TrailDir” is location on existing file. On another computer I pasted "X:\XXX\TrailDir" into mapkey and it worked.
One another question. It is possible for you without any special effort to change a bit the script code to copy to clipboard only name without extensions .prt, .asm,…
Nevertheless, many thanks again for a great job!
Hello,
I have released a new version 1.2.0 of my tool.
With this you can specify an optional second command line parameter /noext after the trail directory.
This will remove file extensions like ".PRT" or ".ASM".
Wow great! I am impressed! This is what I ment. Thank you very much.
I have one more challenge that could make this macro perfect.
When you run a macro on an element on the model, the following features also appear:
Surf: F6 (WALL SURFACE): K181413
Surf: F5 (EXTRUDE_1): K462824
Surf: F5 (IMPORT FEATURE): K239059
If they were removed it would be perfect.