PDA

View Full Version : Consistent Text Style


ronsarlo
2009-07-11, 02:41 AM
I come from a very large company that doesn't not seem to have a very strong cad infrastructure. As the local cad lead, I need to create tools for my guys to at least be working in a consistent fashion.

To that end, I have created a palette with a button that calls up creates and writes in a new text style once, then starts the mtext command. This was quite simple.


I am trying to do the same with a dimension style and it seems to be quite a long and painful road.
My approach:
1. Set all the dimXXX system variables.
2. Save the dimension style variables into a dimension style with my chosen name.
3. Restore it.
4. Start my dimension command (dimlin, dimaligned, etc...)

Will this work? What are my alternatives?


thanks again!!!

irneb
2009-07-13, 08:01 AM
Off the top of my head ... create the DimStyle inside a "template" block. Insert the block then erase & purge it. The Dimstyle should then be loaded ... so you can simply set it current using the -DIMSTYLE command.

ronsarlo
2009-07-13, 07:37 PM
That sounds quite similar to a toolbar we already have.

The problem I see is that if the textstyle or the dimension style has been changed in my target file, then that method will not be bringing my definition, but rather will rather start the dimension command with the non-standard style.

Although I know that at some point, user error can over power everything.
As the toolsmith, I feel it is my duty to make my tools idiot proof... :roll:

In this case,it should be each time my palette is used, I think the dimension style definition should be rewritten to my default.

sorry for the trouble!

irneb
2009-07-14, 07:47 AM
Unfortunately it's how it works in ACad ... I think there was some Wishlist Items asking for a way of redefining blocks and styles from another DWG ... but that's not yet given to us.

So you may be stuck with defining each sysvar and then saving the dimstyle. Maybe create a function to save each relevant sysvar's setting to a file, so you don't neet to modify the code each time something changes ... just run the "export" function after a change to the standard dimstyle.

Remember you may also have to look at text styles, since a text style's height overrides the dimstyle's text height. And then also the blocks used for dim arrows and leader arrows.

ronsarlo
2009-07-14, 08:46 PM
irneb, thanks for your continuous help. :beer:

I am prepared to go as far as defining all the system variables.
In fact, I already have them all typed out and in a lisp.
I will define all those system variables into a command.

My palette button will then call up that command, then start the desired dimension command.

Does this make sense?

irneb
2009-07-15, 07:09 AM
What I'm suggesting is create a defun which simply gets hold of each sysvar's value through getvar, then saves these to a file. If you already have the vars typed out, you may even simply load them into a list for this defun to loop through. This way, you setup your dimstyle normally through the dialog, then run this code to "export" the dimstyle's settings to a file.

Then all the toolbar's defun needs to do is load that file into a list and set each of these sysvars accordingly. If you use an associative list (i.e. (list (cons "VARNAME1" Value1) (cons "VARNAME2" Value2) ....)) then you may even add and / or remove sysvars out of this list by simply modifying that file ... no need to redeploy a new version of the toolbar's defun.

And if (for some reason) you need to update the dimstyle, then you simply run that 1st defun again ... saving a new "exported" dimstyle for the toolbar button to read from.

Edit: BTW, Express Tools has something to this effect. It may be a starting place. The problem with DIMEX and DIMIM is that they have not been updated for a while, so some of the new dimstyle sysvars won't get saved.

alanjt
2009-07-23, 06:51 PM
you can easily achieve this by creating the dimension, then placing it in tool palettes, then when you execute it from tool palettes, it will create the dimstyle if it doesn't exist.

another way (what i've been using), is to have all dimstyles created in a file and have them inserted into your drawing everytime you load autocad (acaddoc.lsp)

something like this would work:

(command "_.insert" DRAWINGNAME nil)
(command "_.purge" "_b" DRAWINGNAME "_n")

this will guarantee you that every time you open a drawing, it will have all the needed dimstyles already loaded. in our acaddoc.lsp at work, i use this procedure to make sure i always have all layers, dimstyles, textstyles, multileaderstyles, linetypes, pagesetups etc. each time i open a drawing.

ronsarlo
2009-07-28, 08:56 PM
ok. having considered your suggestion.

i have done as irneb suggested.
i have defun all the system variables, then saved them to a dimension style.
This is all being done via a lisp file my palette calls up.

this way, it will fix any overriding my monkeys may do on our project.

it is working brilliantly!!!

thanks for the input guys :beer: