Author Topic: Automating Dimension Style  (Read 5592 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
Automating Dimension Style
« on: December 12, 2007, 10:57:36 AM »
Not sure if this is the best place to post but I try here for starters.

Using Full Version Vanilla 2006.

I am trying to setup new templates, borders, text and dimension styles.

For the most part the way we draw is we do almost everything in model space. I draw my cabinet at 1:1.  Then I bring in my 11x17 title block (11x17).  I scale my title block up X times according to the necessary "Scale Factor".  

So if I need it to fit as 3/4" = 1' then I scale up my 1:1 Border 16 times.  I have created automation to insert my border and scale it up per the CAD Scale. 

In the past I created a Dimension style for each scale so that it showed up in the correct proportion to the scaled up or down border.  So that meant I had 15 different dimension styles to choose from. :-(  It was automated to also set the correct dim style when the border was inserted. 

So now we are trying to revamp what and how we are doing things.  I was thinking of creating 1 dimension style that would be at the same scale factor as my 1:1 border.  Then I could just adjust the dimscale to correspond with the CAD Scale to show up the same proportion.  I can also automate that so it happens when the border is inserted.  And I can create buttons to change to any dimscale at any time.

My question is this...  Can somebody tell me if it is possible (and maybe how to do it) but is it possible to do something like click a button to start the dimscale command, then click on the title block I want to work inside of, at which point it would read how many times that block has been scaled up and set the dimscale to match that scale factor.  What I'm trying to to is make it so my guys do not have to think about dimscale or scale factor or anything.  All they have to do is move to the title block they want to add dimensions or notes to and click on it and poof everything is set.

Am I making too much out of this?  Is there an easier or better way to do this. 

Thanks,
Luke

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Automating Dimension Style
« Reply #1 on: December 12, 2007, 11:07:29 AM »
IMO..If you are revamping what you are doing there, I would recommend looking into paperspace\viewports for your titleblock setup.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #2 on: December 12, 2007, 11:12:37 AM »
Yes this is possible and has been done. There are companies in this world that do not use Pspace due to legacy data, as well as other reasons. I had to deal with this for a fairly large corp. and used the title blocks scale factor to determine the dimscale factor. This can be done through Lisp, or any other flavor. The problems I found I needed to deal with were uniform/standard scaling of the titleblock, and multiple insertions of the titleblock. Since you have suggested creating something in which the user selects the titleblock for input, the multiple insertion problem won't be an isssue. There are other applications to this sort of data retrieval as well, such as automation of text scaling, symbol insertion, etc.

How familiar are you with Lisp?

Luke

  • Guest
Re: Automating Dimension Style
« Reply #3 on: December 12, 2007, 11:14:31 AM »
We use paper space and viewports when and as it is applicable and Necessary. 99% of our drawing is 2D.  No xrefs, nothing crazy.  We draw cabinetry.  More times than not the drawing has a part (maybe a cabinet door) drawn.  That is the only thing in the drawing.  using psper space and viewports is not effieient for some things like that.  Input noted and appreciated.  Mor interested in how to make these dimension styles and scales work right now.  And actually whatver I do here would be applicable to Paper Space also.

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #4 on: December 12, 2007, 11:21:21 AM »
For starters you'll need the DXF group 41 code for the block you are going to be selecting.

Luke

  • Guest
Re: Automating Dimension Style
« Reply #5 on: December 12, 2007, 11:22:52 AM »
Quote
The problems I found I needed to deal with were uniform/standard scaling of the titleblock, and multiple insertions of the titleblock
We will also have instances where we have multiple title blocks scaled at different sizes in 1 drawing (model space).  Will this be a problem?

Quote
Since you have suggested creating something in which the user selects the titleblock for input, the multiple insertion problem won't be an isssue
 Is there a better way to automate this than what I'm suggesting?

Quote
How familiar are you with Lisp?
No super.  Maybe enough to be dangerous or less.  I've created custom pull downs, I've created custom buttons, including the macros or scripts to make them work not just the image.  But I have done very little lisping and no AutoLisping.  This will be somewhat foreign to me so if there is a better way than Lisp t do it I'm open.

quamper

  • Guest
Re: Automating Dimension Style
« Reply #6 on: December 12, 2007, 11:26:41 AM »
"using psper space and viewports is not effieient for some things like that"

yet you have to do all of this:

Quote
Then I bring in my 11x17 title block (11x17).  I scale my title block up X times according to the necessary "Scale Factor". 

So if I need it to fit as 3/4" = 1' then I scale up my 1:1 Border 16 times.  I have created automation to insert my border and scale it up per the CAD Scale.

Wow that would drive me crazy.

Is it not possible for you to continue to draw your cabinets at 1:1 dimension and everything in there. Then simply switch to paper space and set your scale factor to whatever you want it printed at? Unless I'm misunderstanding what your doing, it seems like its completely round about.

"Mor interested in how to make these dimension styles and scales work right now"

It's completely related if you do the process I'm talking about. I'd be happy to privately share a sample drawing with you that you can look at and see my dimension styles/paper space layout etc so that it makes more sense if you're interested.

Luke

  • Guest
Re: Automating Dimension Style
« Reply #7 on: December 12, 2007, 11:39:48 AM »
Quamper,
your are right, the process I describes sounds like a lot (on paper) but it is all automated.  I click a pulldown and it does everything else for me.  However, I'm not opposed to learning or trying new things.  I do not know it all. 

Yes I would be interested in a private share.  How do we do that?

Another issue here is that I'm trying not to change things too much from how we currently do them or else my guys will complain, fight the process and not do it.

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #8 on: December 12, 2007, 11:42:30 AM »
I guess the question here would be, do you want a quick fix, or a do you have the time/resources to do it "The right way".

quamper

  • Guest
Re: Automating Dimension Style
« Reply #9 on: December 12, 2007, 11:45:41 AM »
How do we do that?

I'll pm you with the details and explain anything that you want me to clarify :D

sinc

  • Guest
Re: Automating Dimension Style
« Reply #10 on: December 12, 2007, 11:47:43 AM »
There are companies in this world that do not use Pspace due to legacy data, as well as other reasons.

Can't use paperspace because of "legacy data"?  That's a good one.

From what I've seen, most people who claim to have no use for paperspace could simplify their lives immensely if they used it.  The only exception I've seen is people who use Autocad to machine parts, and send their design straight to a fabrication machine, rather than print them.  But if you print ANYTHING, paperspace is a wonderful tool.

It really gets better with 2008 and the introduction of Annotative Scales.  That whole functionality is still new and has some problems, but with 2008, Autocad is finally starting to work the way it always should have.  And it only took, what, 25 years or so?   :-D

Luke

  • Guest
Re: Automating Dimension Style
« Reply #11 on: December 12, 2007, 11:54:13 AM »
I do not disagree with the perks of paerspace but the way we operate here modelspace is a very efficient way for us to draw.

See attached video to see partially how our setup currently works (it needs a lot of tweaking) but you get the picture right...

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

We draw 2d parts for our CNC.

quamper

  • Guest
Re: Automating Dimension Style
« Reply #12 on: December 12, 2007, 11:59:45 AM »
"We draw 2d parts for our CNC."

I do too :D

Josh Nieman

  • Guest
Re: Automating Dimension Style
« Reply #13 on: December 12, 2007, 12:05:17 PM »
"We draw 2d parts for our CNC."

I do too :D

Same here, the last job I had, and I found it so much easier to be able to export a dxf of everything in model space, if I had paperspace setup properly.  Having only the linework of the part in model space made it easier to export to our various machine programs for code generation.  Machining, NC Punching, lasering, everything.

But sorry, I guess I don't actually have anything to add about the OP :( ...sounds like you had a good thing going for you before the decision to revamp it.

deegeecees

  • Guest
Re: Automating Dimension Style
« Reply #14 on: December 12, 2007, 12:27:55 PM »
Can't use paperspace because of "legacy data"?  That's a good one.

A large corporation with literally millions of drawings with data dating from pre-pspace era (as well as mutiiple Cad platforms, and raster data), and a Cad Mgr that wasn't familiar with it either. Most of the data was line work for substation development (Power Eng). I jumped aboard right in the middle of an already over budget project, so doing it the right way would not have been in the best interest of the project at hand.

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