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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Possible to create a mapkey to select all drawing tables? (Or how to change font throughout drawing)

dcokin
13-Aquamarine

Possible to create a mapkey to select all drawing tables? (Or how to change font throughout drawing)

Our team will be upgrading from Creo 2.0 to Creo 4.0 soon, and I'm making various configuration changes as a result.  Among the improvements, is a change to the default font used throughout our drawings.  Years ago, we had decided to standardize on "Arial", so our CAD drawings would have the same look and feel as our MS Office documents.  At the time, Arial was not bundled with Creo, so a config.pro setting was needed to use the Windows font folder, rather than the default font folder ("pro_font_dir C:\Windows\Fonts").  Downside of this was a performance hit when bringing up the text editor (longer font list to load), and compatibility problems when trading data with other sites that didn't have that setting.  With Creo 4.0, I'm hoping to get rid of that customization, as PTC has now started to bundle a version of Arial with Creo.

 

But...  It's not so simple.  The bundled version of Arial is actually Arial WGL, a less expensive version that omits foreign language characters.  So, I need to change our default font from "arial.ttf" to "ar_wgl__.ttf".  This is not a big deal for newly created drawings moving forward.  All I have to do is:

  • in our site-wide standard config.pro, remove the "pro_font_dir" line
  • in our start part template for drawings, update the Detail Option "default_annotation_font" to be "ar_wgl__.ttf"
  • in our *.dtl file (settings for use when creating "empty" drawing without template), update "default_font" line to "ar_wgl__"
  • update the font used in our drawing formats (which entirely consist of tables)
  • confirm all annotation symbols are set to use default font of whatever drawing they're placed in (no change needed for most of them)

 

But...  Legacy drawings are another issue.  These expect to use "arial.ttf", but since it now can't be found, they revert to the old "font.ndx" instead.

 

I was successful in creating a mapkey that updates a drawing's Detail Options to use the new font, which takes care of annotations, dimensions, and most symbols.  But, draw tables are not affected (including page border formats).

 

Once all the tables are selected, all that must be done is select "Text Style" and check "default" next to the font line...  But I can't figure out how to automate this.  Each draw sheet may have a different number of tables, and there is no "select all tables" button.

 

My users are going to have to do this A LOT (whenever a drawing first created prior to Creo 4 update is next edited), so I'd like to make it as quick and easy as possible.  Anyone got any advice?  Would be great if there was a button that could fix an entire drawing, tables included.  Or, at least could fix an entire drawing sheet worth of tables at once, rather than having to select them all individually as a first step.

 

And... if a mapkey could be created to select all tables on a sheet and change the font, would it then be possible to get this to run automatically on all sheets of a drawing, regardless of how many there are, and how they're named?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
dcokin
13-Aquamarine
(To:dcokin)

Okay, hopefully this will be my last update.  New code for a unified mapkey is provided below.  End user just has to run the one mapkey now, which will advance through up to 100 pages.  (User is prompted to continue after each page, and to click cancel after it cycles back around to first page.)

 

Knowing that one mapkey can call another, I had expected a mapkey could call itself to create a loop.  As @dnordin pointed out, and I learned for myself meanwhile, this doesn't work.  If a mapkey has a statement to call itself, it's ignored.  You can't even workaround by create different mapkeys; i.e. if mapkey1 calls mapkey2 which calls mapkey1, then whichever one is farther down in the config.pro file is ignored.  I worked around this by just pasting in 100 calls to the subroutine (I don't think anyone here has ever created a drawing with more than 20 pages on it).

 

@STEVEG - Very clever approach!  Working with batch files is more trouble than I want to spend on this though, as slick as the results might be...

 

Frustrating new issue I found over the course of testing:

I can't tell if this is a Creo Parametric issue, or something inherent to certain fonts?  When changing to these fonts, some special characters get replaced.  In particular, the problem is with the "non-breaking space" (U+00A0) character.  I pasted the updated character into a unicode test webpage, and it was reported as being an "en quad" (U+2000) character.  This ought to also look like a space, but it's showing up on screen in Creo as a rectangle.  Still printing in my PDF's properly at least, even though it's garbled on screen, lol!  And I can fix it on screen if I just manually paste new "non-breaking space" characters in place wherever they're used, but they aren't updating properly when I switch to fonts, at least to certain ones.  Problem occurs with the default "font", "Arial WGL", and "Garamond".  Does not occur with "Arial" or "Times New Roman".  Weird...

 

There are two specific cases where I've used these characters to work around Creo limitations:

Oftentimes, we'll have more than one coordinate system in use on a project, and this indicated with a subscript.  For instance, there may be XBUS and XPAYLOAD coordinates.  I created "coordinate balloon" & "coordinate arrow" symbols that have variable text, including some "preset values" with commonly used suffixes that can be selected with a pop-up menu in the symbol placement GUI.  Most often, user wants the suffix to be blank and just say X.  Null value for text isn't allowed.  A space character is allowed, but can't be set as the default value for that pop-up menu.  Non-breaking space looks the same, and can be the default.  Looks like I'll have to edit the master symbols, and users will have to update them separately.

 

Second use is peculiar to our sandwich panel drawings that have a "hole table".  We use the out-of-the-box hole table feature, configured to provide coordinates of all the axes in a special assy, each of which has an ID code manually typed in as the feature name ("A-1", "A-2", etc).  The drawings have a plan view next to the table, where the holes are all labeled for visual reference.  I didn't want to have to manually create and locate all these annotations, or provide an opportunity for typos, so we adjusted things so the 3D axes system tags themselves would show up in the drawing view.  Lead engineer complained that these tags were overlapping with the hole edges and weren't clearly legible.  No easy way to tweak their position, so I decided to just throw some spaces in front of the name to indent the code ("   A-1", "   A-2", etc).  You can't have regular spaces in feature names, but non-breaking spaces work.  Looks like we'll have to re-paste the spaces in front of all these feature names...  I'm baffled why changing the font in the drawing is affecting the character in the assy, but that does seem to be what's happening.

 

<sigh>

 

Here's the mapkey code anyway:

!/ Type "fdf" to Fix Drawing Font, i.e. change default drawing font to
!/ Arial WGL (ar_wgl__.ttf), and then cycle through up to 100 drawing sheets
!/ updating tables to use the default font.  This is useful for upgrading
!/ drawings created with Arial (arial.ttf), which is no longer directly
!/ available with simplified configuration settings after Creo 4 upgrade.
mapkey fdf @MAPKEY_LABELfix drawing font;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdDwgProperties` ;\
mapkey(continued) ~ Activate `mdlprops_dlg` `OPTIONS_lay_Controls.push_Change.lay_instance`;\
mapkey(continued) ~ Input `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ Update `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Input `preferences` `EditPanel` `a`;\
mapkey(continued) ~ Update `preferences` `EditPanel` `ar_wgl__.ttf`;\
mapkey(continued) ~ Activate `preferences` `AddOpt`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `ok`;~ Activate `mdlprops_dlg` `DlgClose_push`;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;

!/ Subroutine for "fdf" mapkey.  Sets all tables on current drawing sheet to use
!/ default font (including page border formats), switches to next drawing sheet, and
!/ pops up a dialog to prompt user if there are more sheets, allowing execution to be halted.
!/ (Note that this creates a temporary layer as a mechanism to select all tables.)
mapkey fdsubroutine @MAPKEY_LABELfix table fonts;\
mapkey(continued) ~ Command `ProCmdMdlTreeSearch` ;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Drawing Table`;\
mapkey(continued) ~ Select `selspecdlg0` `RuleTypes` 1 `All`;\
mapkey(continued) ~ Select `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Close `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Activate `selspecdlg0` `SaveResults`;\
mapkey(continued) ~ Update `save_rules_dlg` `LayNamePanel` `temp_delete_me`;\
mapkey(continued) ~ Activate `save_rules_dlg` `OKBtn`;~ Activate `selspecdlg0` `CancelButton`;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  1;\
!/ next 3 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ Close `layer_dlg_cur` `LayerActionMenu`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_SelectItems` ;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Layout_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgModTextStyle` ;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `chk_usedeffont` 1;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `psh_ok`;\
!/ next 2 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_DelLay` ;~ FocusIn `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_View_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  0;\
mapkey(continued) ~ Command `ProCmdDwgGotoSheet` ;\
mapkey(continued) ~ FocusOut `gotosheet` `InpPagenum`;~ Activate `gotosheet` `Next`;\
mapkey(continued) ~ Activate `gotosheet` `Close`;\
mapkey(continued) @MANUAL_PAUSEIf this is the sheet where you started, click \
mapkey(continued) Cancel.\n\nOtherwise, click Resume to fix this sheet and move on to next.;

View solution in original post

16 REPLIES 16
Chris3
20-Turquoise
(To:dcokin)

I haven't tried all of the steps to fix your exact problem, but you can select all tables using the find (CTRL-F) tool. You can create a mapkey that searches for and selects all of the tables using the find tool. Beyond that I haven't tried it so I don't know if you can go the rest of the way to solve your specific problem.

dcokin
13-Aquamarine
(To:Chris3)


@Chris3 wrote:

...you can select all tables using the find (CTRL-F) tool.

Okay, now I feel foolish; thank you.  I looked there, but I couldn't find how to do it.  I must have scrolled right past "Drawing Table" while I was searching for "Table", "Text", "Annotation", etc.

 

Hmm... Okay, now I have a new problem though.  This will find all the tables, but there still isn't a "select all" button, so looks like it's still not going to be so easy to make a mapkey that automates this.  (Also, it finds all the tables on the entire drawing, but will only let you select the ones on the current sheet.)

 

EDIT:  Okay, it's convoluted, but there may be a path with this route.  A search like this can be saved as a layer, and the items in a layer can be selected en masse.  So, the mapkey would have to perform the search, save it as a layer with a temporary name, select the contents of the layer, fix the font, and then delete the layer.  If I'm able to get this working reliably I'll edit this response again, and mark it as the solution.

 

EDIT 2:  Minor progress.  I have a mapkey that works, so long as the user is configured to use the "floating layer tree" option.  And another version that works only without "floating layer tree".  No joy in combining them as of yet.  (Most of my users do use the floating tree, as I made it the site default, but I know of at least one who doesn't like that, and has overridden the setting...)

 

EDIT 3:  Added a first step of making the layer tree floating, so the later steps don't fail if the user had a non-floating layer tree.  This will aggravate at least one user, but they can always switch it right back...

 

Here is the code, for anyone interested.  Developed & tested in Creo 4.0 M040.  The first one one changes the default font, and must be run once per drawing.  The second one sets all the tables to use the default font, and must be run once per drawing sheet.  If anyone knows how to get a mapkey repeat automatically for each sheet, please let me know!

 

!/ Type "fdf" to Fix Drawing Font, i.e. change default font to Arial WGL (ar_wgl__.ttf)
!/ This is useful for upgrading drawings created with Arial (arial.ttf), which is no
!/ longer directly available with simplified configuration settings after Creo 4 upgrade.
mapkey fdf @MAPKEY_LABELfix drawing font;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdDwgProperties` ;\
mapkey(continued) ~ Activate `mdlprops_dlg` `OPTIONS_lay_Controls.push_Change.lay_instance`;\
mapkey(continued) ~ Input `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ Update `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Input `preferences` `EditPanel` `a`;\
mapkey(continued) ~ Update `preferences` `EditPanel` `ar_wgl__.ttf`;\
mapkey(continued) ~ Activate `preferences` `AddOpt`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `ok`;~ Activate `mdlprops_dlg` `DlgClose_push`;\
mapkey(continued) ~ Command `ProCmdViewRepaint`;

!/ Type "ftf" to Fix Table Fonts, i.e. set all tables on current drawing sheet to use
!/ default font (including page border formats).  Note, this will set layer tree
!/ to floating, if it wasn't already. (Layers are used as temporary mechanism to
!/ enable script to select all tables.)
mapkey ftf @MAPKEY_LABELfix table fonts;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg` ;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `ConfigLayout.AddOpt`;\
mapkey(continued) ~ Input `add_opt` `InputOpt` `floating_layer_tree`;\
mapkey(continued) ~ Update `add_opt` `InputOpt` `floating_layer_tree`;\
mapkey(continued) ~ FocusOut `add_opt` `InputOpt`;~ Open `add_opt` `EditPanel`;\
mapkey(continued) ~ Close `add_opt` `EditPanel`;~ Select `add_opt` `EditPanel` 1 `yes`;\
mapkey(continued) ~ FocusOut `add_opt` `EditPanel`;~ Activate `add_opt` `AddOpt`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;\
mapkey(continued) ~ FocusIn `UITools Msg Dialog Future` `no`;\
mapkey(continued) ~ Activate `UITools Msg Dialog Future` `no`;\
mapkey(continued) ~ Command `ProCmdMdlTreeSearch` ;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Drawing Table`;\
mapkey(continued) ~ Select `selspecdlg0` `RuleTypes` 1 `All`;\
mapkey(continued) ~ Select `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Close `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Activate `selspecdlg0` `SaveResults`;\
mapkey(continued) ~ Update `save_rules_dlg` `LayNamePanel` `temp_delete_me`;\
mapkey(continued) ~ Activate `save_rules_dlg` `OKBtn`;~ Activate `selspecdlg0` `CancelButton`;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  1;\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ Close `layer_dlg_cur` `LayerActionMenu`;\
mapkey(continued) ~ Command `ProCmdLayer_SelectItems` ;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Layout_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgModTextStyle` ;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `chk_usedeffont` 1;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `psh_ok`;\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ Command `ProCmdLayer_DelLay` ;~ FocusIn `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_View_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  0;

 

Chris3
20-Turquoise
(To:dcokin)


@dcokin wrote:

  If anyone knows how to get a mapkey repeat automatically for each sheet, please let me know!

 


It is not possible for a mapkey to figure out how many sheets there are. That being said you could write a mapkey to switch to designated sheets (1,2,3,4,5, etc) and run the same procedure. You would have to test this because sometimes writing a mapkey to perform operations for things that are not there simply causes the mapkey to continue and sometimes it causes Creo to crash. You may want to add a pause at the beginning of the mapkey telling your users to save everything prior to running the mapkey.

 

The switch pages command is not in the ribbon:

Capture.PNGCapture2.PNG

 

Mapkey code (where "1" is the page number):

 

mapkey(continued)  ~ Input `gotosheet` `InpPagenum` `1`;\
mapkey(continued) ~ Update `gotosheet` `InpPagenum` `1`;~ FocusOut `gotosheet` `InpPagenum`;\
mapkey(continued) ~ Activate `gotosheet` `Goto`;~ Activate `gotosheet` `Close`;

After this you could paste your working code, and then iterate by changing the number to "2" and pasting your code again and on and on until you felt you covered enough sheets. Again I highly recommend testing this on a few drawings with the expectation that Creo may crash.

STEVEG
21-Topaz I
(To:Chris3)

@Chris3 @dcokin

There actually is a way to figure out how many pages a drawing has.  But it requires some batch programming.  I did this and still have the mapkey to replace formats on a drawing.  This is in Creo 4 but I originally wrote in for Creo 2.

Copy the text: &total_sheets

On the Annotate tab select the down arrow for Note and select Unattached Note.

I use the Select a point using absolute coordinates button.  Select OK.

Use the Ctrl+v to paste the text in Creo.

Select at the bottom of the tab Text > Save to File.

I put it in the working directory.

Switch to the Annotate tab and select the Delete icon. (The note with the &total_sheets is still highlighted so this will delete the note)

Then you can use the batch file to get the number of sheets there are.

Chris3
20-Turquoise
(To:STEVEG)

@STEVEG Thanks for the idea! I actually do the same thing. My mapkeys current create a new blank sheet paste in the &total_sheets  and &format and the save the whole sheet as a cleartext CGM. I then have a script that reads that file and finds the right text.

 

Your solution is more elegant and I will definitely consider it the next time I have to revise the mapkeys.

 

I didn't mention this before because external scripting sounded out of the scope of the solution that the OP was looking for.

STEVEG
21-Topaz I
(To:Chris3)

There is one thing to be aware of when dealing with sheets.  When there is only 1 sheet in a drawing, the lines are this:

mapkey(continued) ~ Arm `pagesetup` `TblFormats` 2 `0` `fmt`;\

mapkey(continued) ~ Select `pagesetup` `TblFormats` 2 `0` `fmt`;\

 

If there are multiple sheets then the first page is listed as:

mapkey(continued) ~ Arm `pagesetup` `TblFormats` 2 `1` `fmt`;\

mapkey(continued) ~ Select `pagesetup` `TblFormats` 2 `1` `fmt`;\

 

I have no idea why they do that.

 

But to do the loop in a batch file I replace the 0 with a variable.  And using the ">>C:\temp\nos.pro echo" will output the rest of that line (mapkey(continued) ~ Arm...) to the nos.pro file.

set /A PN1=0

>>C:\temp\nos.pro echo mapkey(continued) ~ Arm `pagesetup` `TblFormats` 2 `%PN1%` `fmt`;\

>>C:\temp\nos.pro echo mapkey(continued) ~ Select `pagesetup` `TblFormats` 2 `%PN1%` `fmt`;\

 

Then this line will iterate the variable by 1.  It keeps looping those two lines out until another variable hits the number of sheets:

set /A PN1+=1

 

TomU
23-Emerald IV
(To:dcokin)

Maybe take a different approach.  Instead of trying to select tables, select "Individual Text".  You can change the smart filter to this, window select everything, and then change the font for everything in one fell swoop.

 

I don't see anyway to select all individual text with via search...  (This is probably necessary to create a mapkey.)

dcokin
13-Aquamarine
(To:TomU)


@TomU wrote:

Instead of trying to select tables, select "Individual Text".  You can change the smart filter to this, window select everything...


Selecting "Individual Text" doesn't work, because this also includes some symbols (company's logo is in the corner), so the "Text Style" option isn't available after window selecting everything this way.

 

But...  It might be viable to do something like that, since the smart filter does have a "Tables" option.  I tried making a mapkey using that approach yesterday, but I was having trouble with the "window select" step.  Can that be made into a mapkey consistently?  I did a refit as the first, and then dragged across the window.  Didn't work when I played it back.  I didn't spend much time troubleshooting it, because I figured even if I did get it to work on my screen, it would probably fail if a user had a different screen resolution, or didn't have the model tree attached on the left, or anything that changed the location and size of the graphics area...  Can dragging all the way across the window actually be automated without regard for all that?

GabrielZaha
12-Amethyst
(To:dcokin)

I think there is an easier way to accomplish what you want.

In Creo 4 the default font.ndx file (...\CommonFiles\text\usascii\font.ndx) looks like this:

ascii.fnt
special.fnt
latin_1.fnt

Change your file to this:

sys/arial.ttf
special.fnt

The text style will still show "font" but the actual body used for text will be Arial

 

dcokin
13-Aquamarine
(To:GabrielZaha)


@GabrielZaha wrote:

I think there is an easier way to accomplish what you want.

<...>

The text style will still show "font" but the actual body used for text will be Arial


Fiendishly clever idea; I like it!  There are a couple reasons it wouldn't be the best approach for us though.  Remember, my initial goal was to get rid of a customization, and increase compatibility with other sites.

 

Users need administrative permissions in Windows to edit things in C:\Program File, so making this change for everyone would be complicated by that.  

 

Also, our colleagues at another [larger] site also use Creo, but with a different configuration, and they actually do use the old font.ndx font.  So, if we made this change, their drawings would start looking wrong on our machines.  And users that bounce between assignments would need totally separate Creo installations over this issue, even if both sites started using the same version of Creo again...

 

It sure would be swell if there was a way (config setting, trail file, or...??) to actually change what font Creo uses if the assigned font isn't available.  I.e. if I could get it to load ar_wgl__.ttf instead of font.ndx whenever it can't find arial.ttf...

dcokin
13-Aquamarine
(To:dcokin)

Oy, this forum system sucks.  For some reason, it's not letting me edit my previous replies any more.  I would have made an "EDIT 4" to the comment I had initially marked as a solution, but it won't let me.  Is there a timer or something?  Like a 2 day window for edits?  Or maybe once you've marked a solution, things get locked down?  Anyway, it did let me remove that comment as a solution; I guess I'll make this one the solution instead...

 

UPDATE on the mapkey code.  Cue major eye roll.  Did you know comment lines in mapkeys work differently than comment lines in the rest of a config.pro file?  (Which is already different from how comments work in relations, drawing programs, etc.)  I did not know this until I had an issue with another mapkey I was working on yesterday.  Turns out, it's not enough to just have a "!" at the beginning of the line to designate it's a comment, you also need a "\" at the end of the line.  So THAT is why I wasn't able to integrate the version of the mapkey for users with a floating layer tree and the version for users without a floating tree.  I had comment lines identifying the redundant sections, and that is what broke it  The redundant lines themselves are actually ignored, as I had initially hoped and expected they would be.  Update of the code below.  Again, the first mapkey changes the default font, and must be run once per drawing.  The second one sets all the tables to use the default font, and must be run once per drawing sheet.

 

@Chris3 last comment pointed me to the "Go to Page" function, which I did not know about.  That has a "Next page" button, which gives me an idea.  Stay tuned for a further enhancement.  (I'll edit this comment if allowed, or create another if necessary.)  Idea is to create a compound mapkey, that combines these two, so user only has one step.  Mapkey would update the overall drawing font, fix the table fonts on the current sheet, and then switch to the next sheet, pause and pop up a user dialog (I saw the instructions on that somewhere on this forum yesterday).  Dialog would ask user "If this is not the last sheet, click resume".  If the user resumes, then it repeats, going to the next sheet, fixing the table fonts, and popping up the dialog again.  User would just have to keep clicking through those dialogs until they're back on the page where they started, and then click cancel to exit the mapkey.  Ought to work I think, I'll give it a try in a bit.

 

!/ Type "fdf" to Fix Drawing Font, i.e. change default font to Arial WGL (ar_wgl__.ttf)
!/ This is useful for upgrading drawings created with Arial (arial.ttf), which is no
!/ longer directly available with simplified configuration settings after Creo 4 upgrade.
mapkey fdf @MAPKEY_LABELfix drawing font;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdDwgProperties` ;\
mapkey(continued) ~ Activate `mdlprops_dlg` `OPTIONS_lay_Controls.push_Change.lay_instance`;\
mapkey(continued) ~ Input `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ Update `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Input `preferences` `EditPanel` `a`;\
mapkey(continued) ~ Update `preferences` `EditPanel` `ar_wgl__.ttf`;\
mapkey(continued) ~ Activate `preferences` `AddOpt`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `ok`;~ Activate `mdlprops_dlg` `DlgClose_push`;\
mapkey(continued) ~ Command `ProCmdViewRepaint`;

!/ Type "ftf" to Fix Table Fonts, i.e. set all tables on current drawing sheet to use
!/ default font (including page border formats).
mapkey ftf @MAPKEY_LABELfix table fonts;~ Command `ProCmdMdlTreeSearch` ;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Drawing Table`;\
mapkey(continued) ~ Select `selspecdlg0` `RuleTypes` 1 `All`;\
mapkey(continued) ~ Select `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Close `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Activate `selspecdlg0` `SaveResults`;\
mapkey(continued) ~ Update `save_rules_dlg` `LayNamePanel` `temp_delete_me`;\
mapkey(continued) ~ Activate `save_rules_dlg` `OKBtn`;~ Activate `selspecdlg0` `CancelButton`;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  1;\
!/ next 3 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ Close `layer_dlg_cur` `LayerActionMenu`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_SelectItems` ;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Layout_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgModTextStyle` ;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `chk_usedeffont` 1;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `psh_ok`;\
!/ next 2 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_DelLay` ;~ FocusIn `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_View_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  0;
Chris3
20-Turquoise
(To:dcokin)

If you haven't read through it before, @lhoogeveen wrote a good post on editing mapkeys at the link below:

 

https://community.ptc.com/t5/System-Administration/Mapkey-Writing-Editing-Tips/td-p/443729

dnordin
15-Moonstone
(To:dcokin)

DCokin,

The method you're suggesting would require that your mapkey account for a large number of sheets already built into the mapkey because mapkeys don't have any method of looping or conditional statements.

 

It would be simpler to create two icons in the drawing menu to run your mapkeys, one for the overall font change, and the other for the update of the table font and switching to the next sheet.  The user would then simply have to run the second menu item for each sheet (instead of hitting resume for every sheet).  The mapkey would remain small and the interaction from the user is the same (one click per sheet).

 

Running a mapkey repeatedly without interaction is possible with an AutoIT program.  AutoIT programs can interact with other program windows.  We use AutoIT programs for a variety of things in Creo Parametric many of which include running multiple mapkeys.  The tricky part of the AutoIT program is getting feedback from Creo Parametric to determine when the mapkey and the resulting actions are completed.  We've had to modify some of our mapkeys to perform "bogus" or unnecessary actions to allow the AutoIT program to capture when the mapkey is completed.

 

To automate the entire process, you'd need to capture the number of sheets for the loop in AutoIT.  You could ask the user (easy), or get the information from a ModelCHECK report on NUM_DRAW_SHEETS or possibly SHEET_SIZE_INFO (more difficult) [there may be other methods of getting the mumber of sheets as well].

 

Regards,

Dan N.

STEVEG
21-Topaz I
(To:dnordin)

I accounted for that.

I create a mapkey that does what I want and save it.

Then my batch file creates a xxx.pro file to create a mapkey.

My batch file finds out how many pages it has and does the loop.

Then I bring in the temp mapkey and run it.

It took a little doing but it definitely works.

The lines I use removes the existing formats by selecting the Std B format.:

mapkey(continued) ~ Arm `pagesetup` `TblFormats` 2 `1` `fmt`;\

mapkey(continued) ~ Select `pagesetup` `TblFormats` 2 `1` `fmt`;\

mapkey(continued) ~ Open `pagesetup` `TblFormats_INPUT`;~ Close `pagesetup` `TblFormats_INPUT`;\

mapkey(continued) ~ Select `pagesetup` `TblFormats_INPUT` 1 `Std B`;\

 

The batch file has these lines in it and will loop the output out to the temp.pro file.

Then I do the same thing for the response from Creo about Remove All > Yes.  The batch file loops that out too.

STEVEG
21-Topaz I
(To:dnordin)

Sorry.  Didn't see you responded to someone else.

dcokin
13-Aquamarine
(To:dcokin)

Okay, hopefully this will be my last update.  New code for a unified mapkey is provided below.  End user just has to run the one mapkey now, which will advance through up to 100 pages.  (User is prompted to continue after each page, and to click cancel after it cycles back around to first page.)

 

Knowing that one mapkey can call another, I had expected a mapkey could call itself to create a loop.  As @dnordin pointed out, and I learned for myself meanwhile, this doesn't work.  If a mapkey has a statement to call itself, it's ignored.  You can't even workaround by create different mapkeys; i.e. if mapkey1 calls mapkey2 which calls mapkey1, then whichever one is farther down in the config.pro file is ignored.  I worked around this by just pasting in 100 calls to the subroutine (I don't think anyone here has ever created a drawing with more than 20 pages on it).

 

@STEVEG - Very clever approach!  Working with batch files is more trouble than I want to spend on this though, as slick as the results might be...

 

Frustrating new issue I found over the course of testing:

I can't tell if this is a Creo Parametric issue, or something inherent to certain fonts?  When changing to these fonts, some special characters get replaced.  In particular, the problem is with the "non-breaking space" (U+00A0) character.  I pasted the updated character into a unicode test webpage, and it was reported as being an "en quad" (U+2000) character.  This ought to also look like a space, but it's showing up on screen in Creo as a rectangle.  Still printing in my PDF's properly at least, even though it's garbled on screen, lol!  And I can fix it on screen if I just manually paste new "non-breaking space" characters in place wherever they're used, but they aren't updating properly when I switch to fonts, at least to certain ones.  Problem occurs with the default "font", "Arial WGL", and "Garamond".  Does not occur with "Arial" or "Times New Roman".  Weird...

 

There are two specific cases where I've used these characters to work around Creo limitations:

Oftentimes, we'll have more than one coordinate system in use on a project, and this indicated with a subscript.  For instance, there may be XBUS and XPAYLOAD coordinates.  I created "coordinate balloon" & "coordinate arrow" symbols that have variable text, including some "preset values" with commonly used suffixes that can be selected with a pop-up menu in the symbol placement GUI.  Most often, user wants the suffix to be blank and just say X.  Null value for text isn't allowed.  A space character is allowed, but can't be set as the default value for that pop-up menu.  Non-breaking space looks the same, and can be the default.  Looks like I'll have to edit the master symbols, and users will have to update them separately.

 

Second use is peculiar to our sandwich panel drawings that have a "hole table".  We use the out-of-the-box hole table feature, configured to provide coordinates of all the axes in a special assy, each of which has an ID code manually typed in as the feature name ("A-1", "A-2", etc).  The drawings have a plan view next to the table, where the holes are all labeled for visual reference.  I didn't want to have to manually create and locate all these annotations, or provide an opportunity for typos, so we adjusted things so the 3D axes system tags themselves would show up in the drawing view.  Lead engineer complained that these tags were overlapping with the hole edges and weren't clearly legible.  No easy way to tweak their position, so I decided to just throw some spaces in front of the name to indent the code ("   A-1", "   A-2", etc).  You can't have regular spaces in feature names, but non-breaking spaces work.  Looks like we'll have to re-paste the spaces in front of all these feature names...  I'm baffled why changing the font in the drawing is affecting the character in the assy, but that does seem to be what's happening.

 

<sigh>

 

Here's the mapkey code anyway:

!/ Type "fdf" to Fix Drawing Font, i.e. change default drawing font to
!/ Arial WGL (ar_wgl__.ttf), and then cycle through up to 100 drawing sheets
!/ updating tables to use the default font.  This is useful for upgrading
!/ drawings created with Arial (arial.ttf), which is no longer directly
!/ available with simplified configuration settings after Creo 4 upgrade.
mapkey fdf @MAPKEY_LABELfix drawing font;~ Close `main_dlg_cur` `appl_casc`;\
mapkey(continued) ~ Command `ProCmdDwgProperties` ;\
mapkey(continued) ~ Activate `mdlprops_dlg` `OPTIONS_lay_Controls.push_Change.lay_instance`;\
mapkey(continued) ~ Input `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ Update `preferences` `InputOpt` `default_annotation_font`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Input `preferences` `EditPanel` `a`;\
mapkey(continued) ~ Update `preferences` `EditPanel` `ar_wgl__.ttf`;\
mapkey(continued) ~ Activate `preferences` `AddOpt`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `ok`;~ Activate `mdlprops_dlg` `DlgClose_push`;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;\
mapkey(continued) %fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;%fdsubroutine;

!/ Subroutine for "fdf" mapkey.  Sets all tables on current drawing sheet to use
!/ default font (including page border formats), switches to next drawing sheet, and
!/ pops up a dialog to prompt user if there are more sheets, allowing execution to be halted.
!/ (Note that this creates a temporary layer as a mechanism to select all tables.)
mapkey fdsubroutine @MAPKEY_LABELfix table fonts;\
mapkey(continued) ~ Command `ProCmdMdlTreeSearch` ;\
mapkey(continued) ~ Open `selspecdlg0` `SelOptionRadio`;~ Close `selspecdlg0` `SelOptionRadio`;\
mapkey(continued) ~ Select `selspecdlg0` `SelOptionRadio` 1 `Drawing Table`;\
mapkey(continued) ~ Select `selspecdlg0` `RuleTypes` 1 `All`;\
mapkey(continued) ~ Select `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Close `selspecdlg0` `CascadeButton1`;\
mapkey(continued) ~ Activate `selspecdlg0` `SaveResults`;\
mapkey(continued) ~ Update `save_rules_dlg` `LayNamePanel` `temp_delete_me`;\
mapkey(continued) ~ Activate `save_rules_dlg` `OKBtn`;~ Activate `selspecdlg0` `CancelButton`;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  1;\
!/ next 3 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ Close `layer_dlg_cur` `LayerActionMenu`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_SelectItems` ;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_Layout_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdDwgModTextStyle` ;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `chk_usedeffont` 1;\
mapkey(continued) ~ Activate `dial_txt_sty_asynch` `psh_ok`;\
!/ next 2 lines for users with floating layer tree\
mapkey(continued) ~ Select `layer_dlg_cur` `PHLayerUI.AssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `layer_dlg_cur` `PHLayerUI.AssyTree` `node0:TEMP_DELETE_ME`;\
!/ next 2 lines alternate version for users without floating layer tree\
mapkey(continued) ~ Select `main_dlg_cur` `LayersAssyTree` 1 `node0:TEMP_DELETE_ME`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `LayersAssyTree` `node0:TEMP_DELETE_ME`;\
!/ common section\
mapkey(continued) ~ Command `ProCmdLayer_DelLay` ;~ FocusIn `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `UI Message Dialog` `yes`;\
mapkey(continued) ~ Activate `main_dlg_cur` `page_View_control_btn` 1;\
mapkey(continued) ~ Command `ProCmdViewLyrs`  0;\
mapkey(continued) ~ Command `ProCmdDwgGotoSheet` ;\
mapkey(continued) ~ FocusOut `gotosheet` `InpPagenum`;~ Activate `gotosheet` `Next`;\
mapkey(continued) ~ Activate `gotosheet` `Close`;\
mapkey(continued) @MANUAL_PAUSEIf this is the sheet where you started, click \
mapkey(continued) Cancel.\n\nOtherwise, click Resume to fix this sheet and move on to next.;
Top Tags