Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic Dimension

29 REPLIES 29
SOLVED
Reply
Message 1 of 30
Anonymous
17741 Views, 29 Replies

Automatic Dimension

Hi everyone,

I used to have a LISP routine that would place dimension of the height and width of a rectangle, just by selecting the rectangle, or poly line.

I do not have that LISP anymore, and have looked everywhere on the internet for something similar, but cannot find exactly what I used to have. I know alittle about editing or modifying a LISP routine, but don't feel comfortable in editing the ones I have found, that worked somewhat for what I was looking for.

Does anyone know where I could find such a routine, to simply place dimensions for the height and width of any polyline rectangle? Ive attached drawing of what I am looking for. Thanks in advance

29 REPLIES 29
Message 2 of 30
Kent1Cooper
in reply to: Anonymous

You can use DimPoly.lsp, available >>here<<.  It could be adjusted easily enough to do only two sides of a rectangle, if it otherwise does what you want.  See other Posts on that thread for certain possibilities, and other code.  Also consider such things as using a Dimension Style with extension and dimension lines suppressed if all you want to see is the distance text part, etc.

Kent Cooper, AIA
Message 3 of 30
Anonymous
in reply to: Kent1Cooper

Thanks for the quick reply Kent. I liked the LISP you reference to ......it does however, put dimensions on all sides of the rectangle. How could I modify the LISP to remove those two sides, when I only want just the height and width?

Message 4 of 30
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... How could I modify the LISP to remove those two sides, when I only want just the height and width?


If you don't care which  two consecutive edges get dimensioned, and you plan to use it only on rectangles, I think you could just change this line:

 

  (repeat (setq inc (fix (vlax-curve-getEndParam pl)))

 

to this:

 

  (repeat (setq inc 2)

 

It could also be simplified in a lot of other ways, particularly eliminating its accounting for arc segments, coincident vertices, open-vs-closed Polylines, and so on, but those elements won't hurt if left in, even if they're not used.

 

If the particular edges  dimensioned matter, it could probably be made to figure out where it is, and only do whichever you want [for example, the left and bottom edges].  But that raises the question of whether the rectangles are always orthogonally oriented.  If not, there would need to be some criterion developed for which two edges to do, when a rectangle is at some oddball angle.

Kent Cooper, AIA
Message 5 of 30
Anonymous
in reply to: Kent1Cooper

That worked great!

I noticed when I the dimension was placed, it was placed very close to the rectangle (3/16"), almost overlapping it. How could I go about modifying the LISP routine to make that distance further?

Message 6 of 30
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

... it was placed very close to the rectangle (3/16"), almost overlapping it. How could I go about modifying the LISP routine to make that distance further?


That's determined as a proportion of the text height, by this line:

 

(* styht 1.5); distance

 

so if you change that 1.5 to something larger, they'll be farther away.

Kent Cooper, AIA
Message 7 of 30
Anonymous
in reply to: Kent1Cooper

Thanks so much for all your help!

I plan on educating myself in writing LISP routines this year. They are such a great thing for AutoCAD

Message 8 of 30
Kyle.Pederson
in reply to: Anonymous

how could I alter the Code so I could use this for general Squares and rectangles and still use DPO/DPI for tougher shapes?

Message 9 of 30
jwe03
in reply to: Anonymous

you  can try AutoDim plugin

Message 10 of 30
Anonymous
in reply to: Kent1Cooper

Hi Kentcooper,

Your autolisp very useful, but if i only want to use your autolisp for only dimension line and no need dimension aligned, how i can modify it ? Thank you so muchUntitled.png

Message 11 of 30
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... if i only want to use your autolisp for only dimension line and no need dimension aligned, how i can modify it ? ....


 

That's actually quite a bit more complicated than you might think, but probably possible -- I'll have to think about it.  In the meantime, the QDIM command can do much of what you want, though you'll need to run it four times on each Polyline, and it will make more Dimensions than in your image examples, because [for example] its left-side Dimension string will pick up vertices along the right side.  But if you can [even temporarily, and re-join later] Explode the Polylines into Lines, you could get QDIM to do exactly what you want.  And it has the advantage of not having extension lines overlapping orthogonal edges.

Kent Cooper, AIA
Message 12 of 30
Kent1Cooper
in reply to: Anonymous

Looking at the image again, I have some questions.

 

You have a second overall Dimension on the right end of the bottom right figure, but no other overalls along sides with more than one Dimension.  I assume that's because there's no single  edge on either end of the figure to Dimension that overall height along.  It would be a serious challenge to figure out how to instruct a routine to determine that.  Is the overall Dimension something you would want the routine to draw, rather than putting it in yourself where needed?

 

Many of your strings of multiple Dimensions along the same side are continuous, but some are stepped.  Is that a matter of how crowded the text is between the extension lines on the ones that are stepped?  Again, telling a routine how to figure that out, and what to do about it, would be difficult.

 

Would you ever have a concave  situation such as this?

Concave.PNG

How should that be handled?

 

Not really a routine's problem, but a question of how you draw and how you define your Dimension Style:  I notice that the Polylines are not drawn with precision and the Dimensions are rounded, because [upper-right figure] 377 + 99 does not equal 475.

Kent Cooper, AIA
Message 13 of 30
Anonymous
in reply to: Kent1Cooper

Hi Ken1Cooper,

   Thanks for your advice, actually your autolisp is near my requirement after i surveyed many others. Unfortunaly, I do not know as well as designing a autolisp, only seeking and use. So that when i found your autolisp, i am very happy but it is so useful and more than what i need, though i only need dimension as width and length. Again, great thank to your support.

Message 14 of 30
Anonymous
in reply to: Kent1Cooper

Dear @Kent1Cooper ,

 

I have a question about a way to automatically dimension polyline with coordinate dimensions. Is that possible? If the same dimensions were shown on the right / left and top / bottom, this is not a problem for me, I can simply power-delete some dimensions.

 

An sample :

Sketch.PNG

Many thanks in advance

Message 15 of 30
ВeekeeCZ
in reply to: Anonymous

The values would have to be overwritten.

Do you have dim styles set for both directions?

What is the original shape made from, lines or pline?

 

Post that image as dwg! 

Message 16 of 30
Anonymous
in reply to: ВeekeeCZ

Hi @ВeekeeCZ ,

 

here another example, but the same story 😉

I only use free closed polyline - not just orthogonal version, like e.g. base plate.

My dim style are given - works automatically.

 

 

 

 

 

 

 

Message 17 of 30
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

Dear @Kent1Cooper ,

 

I have a question about a way to automatically dimension polyline with coordinate dimensions. ....


[I defer to your other specific-to-this-question thread.  Not that I have a solution there, but anyway....  And just to be nit-picky, they're called Ordinate (not Coordinate) Dimensions.]

Kent Cooper, AIA
Message 18 of 30
Anonymous
in reply to: Kent1Cooper

you learn something new every day 😁

Message 19 of 30
Sea-Haven
in reply to: Anonymous

Dont double post it makes it confusing that you will get different people trying to solve the same question. 

Message 20 of 30
Anonymous
in reply to: Sea-Haven

I know, I'm sorry, it wasn't my intention, it kind of went wrong, I solve it in a separate thread

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report