Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi all,
I'm currently trying to create a mapkey for drawings that does a number of things, but I'm having trouble with just one part.
I'm making a mapkey that, when activated, will first ask the user to select a view on the drawing, and when you resume, it will set that model to be used in the tree, and then edit the definition, go to the scale settings and set the scale to default for view (I have to do this particular set of actions for a lot of company drawings as many have been set up to use custom scales which is no longer desirable).
The last part of the mapkey is to go to the bottom left corner of the screen, where it says "SCALE," and open the prompt and allow the user to type a scale in.
This is the part where it goes wrong- I can't seem to get it to open the prompt right away so that all I have to do is just type a scale in, hit the green check, and then the mapkey is finished. I've tried different prompting options but none of them give the optimal effect, as I'd like to make this a company wide mapkey. The screenshot attached is what I'd essentially like the last part of the mapkey to bring up.
Any assistance would be greatly appreciated. Running on Creo 8.0.8.0.
Solved! Go to Solution.
This is one way to generate the mapkey you need.
As a test case for your issue, do the following:
Add a note to the drawing displaying the dwg scale parameter using the exact syntax shown below (&scale).
Test this mapkey which will prompt the user to enter a value for the drawing scale.
mapkey $F7 @MAPKEY_LABELEDIT DWG SCALE;\
mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\
mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;\
mapkey(continued) ~ Trail `MiniToolbar` `MiniToolbar` `UIT_TRANSLUCENT` `NEED_TO_CLOSE`;\
mapkey(continued) ~ Command `ProCmdDwgEditValue@PopupMenuGraphicWinStack`;
This video shows it working in Creo 7.09.
Try preselecting the scale parameter before running the mapkey to change the value.
There is a drawing system parameter that sets the drawing scale. This may be a better way to set it rather than mouse picks in the graphics area and UI.
I would suggest creating a mapkey that sets the scale parameter vis user input and nesting this within the mapkey sequence you are attempting to create.
See this link for drawing parameters: System Parameters for Drawings (ptc.com)
How would I go about setting the parameter manually in a map key as opposed to a mouse click?
Review this thread for some examples.
Solved: Mapkey: set a parameter based on a condition? - PTC Community
I'm not sure I can locate what I'm looking for in that thread, or it just doesn't really make sense to me. Is there an official PTC guide as far as how to do this?
This is one way to generate the mapkey you need.
As a test case for your issue, do the following:
Add a note to the drawing displaying the dwg scale parameter using the exact syntax shown below (&scale).
Test this mapkey which will prompt the user to enter a value for the drawing scale.
mapkey $F7 @MAPKEY_LABELEDIT DWG SCALE;\
mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\
mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;\
mapkey(continued) ~ Trail `MiniToolbar` `MiniToolbar` `UIT_TRANSLUCENT` `NEED_TO_CLOSE`;\
mapkey(continued) ~ Command `ProCmdDwgEditValue@PopupMenuGraphicWinStack`;
This video shows it working in Creo 7.09.
That does work for me, but there's only one problem in that it requires the parameter of scale to be pre-selected in order to run the mapkey. This is the same mapkey I was creating prior to this thread, I was hoping there was a way to just make it adjust the scale regardless of what is selected. It works perfectly fine, but I would prefer if it could also include a way to actually select the scale parameter and change it, instead of prompting the user to select a value to modify. Thank you for your help however.
In my first response above I mentioned preselection of the parameter. You made no comment on that until now.
"...I would prefer if it could also include a way to actually select the scale parameter and change it...."
Create a separate mapkey that selects the scale parameter. Then create a nested mapkey that calls the selection mapkey first and then the edit scale mapkey. You can use the search tool functionality in mapkeys.
Selection and editing of the value using a nested mapkey.
Selection is done using the name of the note.
Nested mapkey (F6) building on the previous example:
mapkey $F6 %.idds;%$F7;
mapkey .idds ~ Command `ProCmdMdlTreeSearch` ;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Annotation`;\
mapkey(continued) ~ Update `selspecdlg0` `ExtRulesLayout.ExtBasicNameLayout.BasicNameList` \
mapkey(continued) `NOTE_DWG_SCALE`;~ Activate `selspecdlg0` `EvaluateBtn`;\
mapkey(continued) ~ Activate `selspecdlg0` `ApplyBtn`;~ Activate `selspecdlg0` `CancelButton`;
mapkey $F7 @MAPKEY_LABELEDIT DWG SCALE;\
mapkey(continued) ~ Timer `UI Desktop` `UI Desktop` `popupMenuRMBTimerCB`;\
mapkey(continued) ~ Close `rmb_popup` `PopupMenu`;\
mapkey(continued) ~ Trail `MiniToolbar` `MiniToolbar` `UIT_TRANSLUCENT` `NEED_TO_CLOSE`;\
mapkey(continued) ~ Command `ProCmdDwgEditValue@PopupMenuGraphicWinStack`;
Apologies for not being more specific as to what I was looking for.
So there isn't a solution that doesn't involve adding a note? The problem with that is that there is a scale note built in to the drawing table, and it doesn't appear on the drawing tree on the left, so there is no way for me to select it through that means.
In addition to that, each drawing view has it's own scale when it is used in the tree. I don't believe the scale variable that is demonstrated in the bottom right of the drawing actually affects the independent scale of the different model views anyhow, which I suppose could be a bit problematic.
I think I am going to leave this where it is. Your solution was greatly appreciated and still helpful.
There may be a way to do this without adding the note but in the context of what you are doing it is fit for purpose. Assuming you are reworking legacy drawings just use the mapkey sequence to add the note and then delete it when the mapkey drawing scale modifications are done. Once you have the mapkey sequence working it will yield your desired result based on your problem statement.
Actually, after some experiementing, I figured out I could mapkey to create a note at (0,0), then using the command "insert field" I was able to insert the default scale of whatever view I have set as the model in the tree, and then prompt the user to input a scale, and as soon as that input is cleared, delete the note. I then inserted that mapkey into my larger mapkey that configures the scale to use the default value, and it worked. Thank you for the suggestion to use a note.