PDA

View Full Version : Textstyle lisp for Vports


BCrouse
2005-06-03, 11:51 PM
Is there a lisp routine out there in Augi world that will set the text style , dim styles and leaders per vport scale?

Example: You have a vport scale factor of 3/16" = 1'. The text style, dim styles and leaders adjust per the vport scale factor.


Thank you,

Brad

lance.81922
2005-06-04, 01:14 AM
Is there one? I've never seen it. Can it be done? Yes, I think so. To adjust the system variables controlling text, based on viewport scale, can be done, BUT do you want the variables to update any time you change the scale (requires setting up reactors to fire when the scale changes, at which time they would change the variables and probably regen the viewport), or do you want to simply manually run the program once for each viewport and then maybe again later after you set the viewport scale to what you want?

BCrouse
2005-06-04, 01:23 AM
Is there one? I've never seen it. Can it be done? Yes, I think so. To adjust the system variables controlling text, based on viewport scale, can be done, BUT do you want the variables to update any time you change the scale (requires setting up reactors to fire when the scale changes, at which time they would change the variables and probably regen the viewport), or do you want to simply manually run the program once for each viewport and then maybe again later after you set the viewport scale to what you want?

Hey Lance, how have you been? I have been been busy trying to work with just one hand for the time being. But I am now using both of my hand now. I broke my arm last month and that put a little snag for me at work. It is kind of hard to draft with the other hand and training to do the same work.

To answer your question. The ability to have the reactors to fire would be great. But what ever would be the easiest would be fine.

pnorman
2005-06-04, 04:27 AM
Here is what I use. It has reactors for all view ports, PS and MS and will set dimstyle and text style. You will have to make adjustments for imperial ltscale and text height and also change dim and text style names etc. Also remove the ";" in some places. At least it might give you some clues. I use the attached .lsp in conjunction with the enclosed c:ds command



(defun c:ds ( / SC#)

(initget 4)

(if (setq SC# (getreal (strcat "\nEnter new value for drawing scale <" (rtos (getvar "dimscale")) ">: ")))

(progn

(setq SC SC#)

(if (zerop SC) (setq SC 1))

)

(progn

(setq SC (getvar "dimscale") SC# SC)

(if (zerop SC) (setq SC 1))

)

)

(setvar "ltscale" (* SC 10))

(command "_.style" "ppn" "arial" (* 2.20 SC) "1" "10" "_n" "_n")

(command "_.dim" "_restore" "ppn" "dimscale" SC# "e")

(if (= (getvar "tilemode") 1) (setvar "userr1" SC#))

(princ)

)

BCrouse
2005-06-08, 12:37 AM
Here is what I use. It has reactors for all view ports, PS and MS and will set dimstyle and text style. You will have to make adjustments for imperial ltscale and text height and also change dim and text style names etc. Also remove the ";" in some places. At least it might give you some clues. I use the attached .lsp in conjunction with the enclosed c:ds command



(defun c:ds ( / SC#)

(initget 4)

(if (setq SC# (getreal (strcat "\nEnter new value for drawing scale <" (rtos (getvar "dimscale")) ">: ")))

(progn

(setq SC SC#)

(if (zerop SC) (setq SC 1))

)

(progn

(setq SC (getvar "dimscale") SC# SC)

(if (zerop SC) (setq SC 1))

)

)

(setvar "ltscale" (* SC 10))

(command "_.style" "ppn" "arial" (* 2.20 SC) "1" "10" "_n" "_n")

(command "_.dim" "_restore" "ppn" "dimscale" SC# "e")

(if (= (getvar "tilemode") 1) (setvar "userr1" SC#))

(princ)

)




PNorman,

When you this DS.lsp. This gets set in Model Space correct. Does this automatically enlarges or reduce the size of the text that you input in the scale factor? Do you use the other lisp in Paper Space when you select a VP? Now, what is the function command for the other lisp?

Thank you,

Brad

pnorman
2005-06-08, 12:56 AM
Yes DS is designed to be used in model space and I always have paper space set to 1:1.
You can also use DS in paper space if you want but it there is nothing in the code to remember the Paper Space scale as I always assume it to be 1:1!

When you use DS in model space the scale is stored in the system variable "USERR1" and the default text style and dimension style are reset to the scale factor you type in.

The other file "reactors.lsp" does not have a function command. You need to load it into each drawing. To do this automatically, copy the file reactors.lsp to your "support" folder and add (load "reactors.lsp") to your acaddoc.lsp file.

Before it will work you will need to change the name of the text and dim styles "ppn" to your text and dim style names!

The reactors will fire automatically whenever you change from PS to MS or layout to layout or viewport to viewport.....you don't need to enter a command for this to work.

Regards
Phill

BCrouse
2005-06-08, 01:00 AM
Yes DS is designed to be used in model space and I always have paper space set to 1:1.
You can also use DS in paper space if you want but it there is nothing in the code to remember the Paper Space scale as I always assume it to be 1:1!

When you use DS in model space the scale is stored in the system variable "USERR1" and the default text style and dimension style are reset to the scale factor you type in.

The other file "reactors.lsp" does not have a function command. You need to load it into each drawing. To do this automatically, copy the file reactors.lsp to your "support" folder and add (load "reactors.lsp") to your acaddoc.lsp file.

Before it will work you will need to change the name of the text and dim styles "ppn" to your text and dim style names!

The reactors will fire automatically whenever you change from PS to MS or layout to layout or viewport to viewport.....you don't need to enter a command for this to work.

Regards
Phill


Thank you very much!

Brad

pnorman
2005-06-08, 01:10 AM
Anyone watching this thread who has downloaded the file "reactors.lsp" can they please download the new version (without the copyright notice) and delete any copies of the previous version.

Thanks
P

jack.foster
2005-06-08, 07:22 AM
I may be way off base with my reply but this somewhat sounds like a dimension setup program might help. If so I just created a small program that does a dimension setup that when it runs it gets the viewports scale and then it adjust several dimension variables. You could always comment out or remove what you didn't want. The program creates a dimstyle when it is finished that adds the viewport scale value as part of the name. It is crude compared to a Robert Bell or Peter Jamtgaard program but it works. Needed this for the somewhat backwards company I just started working for and happened to see this post. Thanks to AUGI for the forums for sure. Jack Foster.

pnorman
2005-06-08, 04:25 PM
I may be way off base with my reply but this somewhat sounds like a dimension setup program might help. If so I just created a small program that does a dimension setup that when it runs it gets the viewports scale and then it adjust several dimension variables.
I know some people do their dimension styles this way ie one for each scale but I find it to be completely unnecessary. I only have one dim style and by using the DS function posted earlier I can do dimensions at any scale (all in model space!!). But whether I am dimensioning in model or paper space I still only need one dim style! After all I think thats what "dimscale" is for?!?

Cheers
P

kennet.sjoberg
2005-06-08, 04:50 PM
..."dimscale" is for?!? Cheers
You will have a lot of "dimoverides" in Your drawing if You not change to different dimstyles for different scales , dimscale.
If You run AUDIT on a dwg with proper dimstyles and simultaneous on a dwg with a lot of dimoverides
the regeneration time can be different in hours !

: ) Happy Computing !

kennet

pnorman
2005-06-08, 05:08 PM
You will have a lot of "dimoverides" in Your drawing if You not change to different dimstyles for different scales , dimscale.
If You run AUDIT on a dwg with proper dimstyles and simultaneous on a dwg with a lot of dimoverides
the regeneration time can be different in hours !
kennet
I would say that every dimension, in every drawing, I have ever done for the last 8 years has dimension overrides. I have only ever used 1 dim style and have never had any problems. Both audit and regen are almost instantaneous!! I cannot imagine how annoying it would be to have to change dim styles for every scale I wanted to use in a drawing! So I think you should be lookng for another cause for large regen times?! And the same goes for text styles. I have only a few and I change the height using command DS!
Dimension text style height is set to 0 and "DIMTXT" is set to 2.2mm

As a cad manager, imagine a world where you or none of your drafters ever have to use the commands "DDIM" or "STYLE"!

jack.foster
2005-06-08, 06:17 PM
I will have to take a look at the reactors.lsp program that you posted. I am a little fearful of reactors as you can see from a post I did a few days before this one about garbage in a drawing. A purchased program, Bentley Structural Steel, is randomly throwing 90,000+ dictionary items into drawings that can't be purged. Fortunately Peter Jamtgaard wrote a short sweet program that takes all the garbage to the electronic landfill and reduces 5 meg slow drawings back to less than half a meg as they should be. Thanks a bunch, Jack.

pnorman
2005-06-08, 06:30 PM
No worries Jack, reactors.lsp does not add any data to the drawing! It is designed to be loaded once per drawing and creates two reactors, that's all!

Regards
P

kennet.sjoberg
2005-06-08, 08:04 PM
...Both audit and regen are almost instantaneous!!..
hmmm.. it can not be easy to compare just one solution.
...So I think you should be lookng for another cause for large regen times?!.. it is not necessary.
As a cad manager, imagine a world where you or ....
OK, good for you.

I have only a shortcut and a toolbar button to activate the scale function,
with or without a dialog box. That function investigates if my model is in metric M or in metric mm.
Depending of my scale input (the program check if it is a legal scale) it adjust variables like DIMSCALE, LTSCALE, HPSCALE, HPSPACE, TEXTSIZE and DIMLFAC all of them scale dependent. After that it creates a layer for dimension, if it not already exists, and load company text and line font’s standard if it is necessary. After that it create a dimension style for Parent, leader $7, Diameter $3, Radial $4, Angular $2 with a name associated to the dimscale and database unit, like DIM_1-100MM or DIM_1-50M all that faster than your eye can catch. This turned out after an investigation in R14/R2002 that showed us that something slowed down the start-up process off our drawings. We use a sledgehammer in our start-up routine that purge and audit all useless garbage in drawings to save server space and of course to get faster drawings. The reason to the slowdown was dimoveride created dimensions. We killed the old dimoverride routine like yours and created the above. We also always use the dimscale variable in our routines when we insert scale dependent blocks. We do newer have to care about text size, dimension scales or block scales not even layer handling.
And now we are very happy with it, me as a programmer and the 103 employers that share all the AutoCAD licenses that run our own AutoCAD application that saw the dawn about 8 years ago.

: ) Happy Computing !

kennet

pnorman
2005-06-08, 08:14 PM
Thanks Kennet,

I appreciate the insight into your environment. I have had the luxury over the years of working in a relatively simple environment (Australia and NZ) where everything is always metric mm.
I have to admit I can count the number of imperial drawings I have done on one hand: 1 :shock:

Cheers
P


PS I am no longer downunder!

BCrouse
2005-06-08, 11:56 PM
Here is the modified version of reactor.lsp. Got stuck when needed to add textstyles to the lisp. The textstyles are NOTES, RMNAMES, DWGTITLES.

Thank you,

Brad

pnorman
2005-06-09, 12:23 AM
Here is the modified version of reactor.lsp. Got stuck when needed to add textstyles to the lisp. The textstyles are NOTES, RMNAMES, DWGTITLES.

Thank you,

Brad
Try this file.
(Note: it will always set the current style to "notes" whenever you change space or layout. If that is no good then let me know and I will make it remember current style)

pnorman
2005-06-09, 12:51 AM
Here is the modified version of reactor.lsp. Got stuck when needed to add textstyles to the lisp. The textstyles are NOTES, RMNAMES, DWGTITLES.

Thank you,

Brad
Oh and you will need this too:
Cut and paste the contents to your acaddoc.lsp

BCrouse
2005-06-09, 12:53 AM
Oh and you will need this too:
Cut and paste the contents to your acaddoc.lsp

Thank you very much,

Brad