Author Topic: Automating Dimension Style  (Read 5591 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Re: Automating Dimension Style
« Reply #15 on: December 12, 2007, 12:36:35 PM »

Notice how my dimension styles change when I insert the border. 


Yeah, and you spent how much time getting it all setup?

Paperspace is a default part of the product.  And I've never had a need for lots of dimstyles that change when a border is inserted.  We have basically four dimstyles total that can be used all the time, at any scale.  Well, at least, that was the "old" way.  Now we also have four more dimstyles, similar to the "old" ones, but Annotative, using the new 2008 Annotative features.

Luke

  • Guest
Re: Automating Dimension Style
« Reply #16 on: December 12, 2007, 01:09:23 PM »
I guess the difference between doing it right and what is considered a quick fix is a matter of opinion.

We do not have and are not planning on getting 2008 any time in the near future so the new annotative feature is not an option.

Setting up the automation did take a while.  Maybe a day.  So it is worth it to me.

The biggest reason we are revamping the way we do it is because our current text style and dimension styles are actually more size appropriate for 24x36 borders (or larger) when you try to detail a product or part on 11x17 or 8-1/2x11 paper our current sizes fill it all up too much and the drawing gets real ugly.  So we are scaling it down and changing how some things look.  So while we do that I'm going to make whatevr other changes make sense.

Again, as I said we understand and use paperspace and viewports in some instance, but the majority of the time Model space is a very approriate method for us.

Still interested in the current discussion but would also appreciate feedback on the original post as to how to read the scale of the blocks and link it to the dimscale.

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #17 on: December 13, 2007, 10:26:32 AM »
Quote
Still interested in the current discussion but would also appreciate feedback on the original post as to how to read the scale of the blocks and link it to the dimscale.

I'm not sure how well you are familiar with Lisp, so I commented, and separated all functionality of this. Note, you will HAVE to select a block for this to work, but it should get you started.


Code: [Select]
(defun get_test_info ()

(setq ats3 (entsel));;;;;;;;;;;;;;;;;;;;;;;;;;;;;select a block

(setq ats4 (car ats3));;;;;;;;;;;;;;;;;;;;;;;;;;;get entity name

(setq ats5 (entget ats4));;;;;;;;;;;;;;;;;;;;;;;;get list of dxf info

(setq dim_scl1 (cdr (assoc 41 ats5)));;;;;;;;;;;;get the group code 41 (scale)

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhh

);;;;;;;;end getinfo

(defun c:pick_dimsc ()

(get_test_info);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call above function

(setvar "dimscale" dim_scl1);;;;;;;;;;;;;;;;;;;;;set the dimscale (see group code 41 above)

(setq dimstr1 (fix dim_scl1));;;;;;;;;;;;;;;;;;;;fix the real number to an integer (i.e. 1.0 to 1)

(setq dimstr2 (itoa dimstr1));;;;;;;;;;;;;;;;;;;;convert integer to a string

(setq dimstr_line
(strcat "Dimscale set to " dimstr2));;;;;set up message string

(alert dimstr_line);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call alert box w/message string

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhh

);;;;;;;;end pick_dimsc

Luke

  • Guest
Re: Automating Dimension Style
« Reply #18 on: December 13, 2007, 11:33:06 AM »
That does exactaly what I asked for thank you.   :-)

So now I'll ask...  how to make it also change the mtext size to the same TEXTSIZE.

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #19 on: December 13, 2007, 11:48:59 AM »
Assuming you use the 0.125 standard, and that you do not define a size in the style:

Code: [Select]
(defun get_test_info ()

(setq ats3 (entsel));;;;;;;;;;;;;;;;;;;;;;;;;;;;;select a block

(setq ats4 (car ats3));;;;;;;;;;;;;;;;;;;;;;;;;;;get entity name

(setq ats5 (entget ats4));;;;;;;;;;;;;;;;;;;;;;;;get list of dxf info

(setq dim_scl1 (cdr (assoc 41 ats5)));;;;;;;;;;;;get the group code 41 (scale)

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhh

);;;;;;;;end getinfo

(defun c:pick_dimsc ()

(get_test_info);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call above function

(setvar "dimscale" dim_scl1);;;;;;;;;;;;;;;;;;;;;set the dimscale (see group code 41 above)

[color=red](setq txt_hgt (* 0.125 dim_scl1))
(setvar "textsize" txt_hgt)
[/color]
(setq dimstr1 (fix dim_scl1));;;;;;;;;;;;;;;;;;;;fix the real number to an integer (i.e. 1.0 to 1)

(setq dimstr2 (itoa dimstr1));;;;;;;;;;;;;;;;;;;;convert integer to a string

(setq dimstr_line
(strcat "Dimscale set to " dimstr2));;;;;set up message string

(alert dimstr_line);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call alert box w/message string

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhhh

);;;;;;;;end pick_dimsc

Luke

  • Guest
Re: Automating Dimension Style
« Reply #20 on: December 13, 2007, 12:03:01 PM »
That did it! 

I can sort of disect what the code is saying after I see it but I don't have a clue where to begin from scratch.
Thank you for your help.  Aside from the swamp, is there a good source that sort of breaks down the basics of lisps?

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #21 on: December 13, 2007, 12:09:47 PM »
www.afralisp.net has some good tutorials, and there are many books from good authors, like George O. Head.

AutoCad's Developer Help has some good examples as well.

Luke

  • Guest
Re: Automating Dimension Style
« Reply #22 on: December 21, 2007, 09:45:29 AM »
I've been looking and trying to figure it out on my on but no such luck.

When I convert my borders from Standard to Metric I simply scale them up 25.4 times.  This gives me dim scales with 1 decimal place.  I want to do a true conversion which i beleive this is doing but I also want that number 25.4 or 50.8 or whatever to show up on the alert box rather than display 25 or 51.  can you tell me how to change the code to do that.

Thanks,
Luke

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #23 on: December 21, 2007, 12:26:08 PM »
Red = Changes

Code: [Select]
(defun get_test_info ()

(setq ats3 (entsel));;;;;;;;;;;;;;;;;;;;;;;;;;;;;select a block

(setq ats4 (car ats3));;;;;;;;;;;;;;;;;;;;;;;;;;;get entity name

(setq ats5 (entget ats4));;;;;;;;;;;;;;;;;;;;;;;;get list of dxf info

(setq dim_scl1 (cdr (assoc 41 ats5)));;;;;;;;;;;;get the group code 41 (scale)

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhh

);;;;;;;;end getinfo

(defun c:pick_dimsc ()

(get_test_info);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call above function

(setvar "dimscale" dim_scl1);;;;;;;;;;;;;;;;;;;;;set the dimscale (see group code 41 above)

(setq txt_hgt (* 0.125 dim_scl1))
(setvar "textsize" txt_hgt)

[color=red] ;(setq dimstr1 (fix dim_scl1));;;;;;;;;;;;;;;;;;;;fix the real number to an integer (i.e. 1.0 to 1)

;(setq dimstr2 (itoa dimstr1));;;;;;;;;;;;;;;;;;;;convert integer to a string

(setq dimstr2 (rtos dim_scl1))[/color]

(setq dimstr_line
(strcat "Dimscale set to " dimstr2));;;;;set up message string

(alert dimstr_line);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;call alert box w/message string

(princ);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shhhhhh

);;;;;;;;end pick_dimsc

Ho3

GDF

  • Water Moccasin
  • Posts: 2081
Re: Automating Dimension Style
« Reply #24 on: December 24, 2007, 02:30:29 PM »
Luke

We have one setup in a dialog box for setting all styles, units, ltscale, etc. Maybe the routines enclosed will give you some ideas.

This is not a standalone dialog box routine (requires many more files to run). Just wanted to illustrate by example
how we do things.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64