NEED DIMENSIONS FOR 2 FACES OF RECTUNGULAR.....

NEED DIMENSIONS FOR 2 FACES OF RECTUNGULAR.....

archana96
Enthusiast Enthusiast
2,020 Views
22 Replies
Message 1 of 23

NEED DIMENSIONS FOR 2 FACES OF RECTUNGULAR.....

archana96
Enthusiast
Enthusiast

HI I NEED A LISP FOR DIMENSION FOR 2 FACES OF OBJECT (IF A RECTANGLE HAS 4 FACES BUT NEEDS 1 HORIZONTAL AND ANOTHER VERTICAL DIMENSION.) I HAVE MANY RECTANGULAR-SHAPED OBJECTS SO IT TAKES MORE TIME TO ADD DIMENSIONS.

FOR REFERENCE I ATTACHED AN IMAGE 

 

@Ajohnson0

0 Likes
Accepted solutions (1)
2,021 Views
22 Replies
Replies (22)
Message 2 of 23

Kent1Cooper
Consultant
Consultant

Are they always and only orthogonally oriented as in your image?  Or might some of them sometimes be something like this?

Kent1Cooper_0-1728393630800.png

 

Kent Cooper, AIA
Message 3 of 23

archana96
Enthusiast
Enthusiast

yes, it also sometimes needs.

give me 2 types of orientation

0 Likes
Message 4 of 23

Kent1Cooper
Consultant
Consultant

And I should also have asked before:  What are the "objects"?  Are they closed 4-vertex Polylines?  Rectangular-shaped Blocks?  Made up of just Lines?  Something else?  Not always the same?

Kent Cooper, AIA
0 Likes
Message 5 of 23

archana96
Enthusiast
Enthusiast

ITS RECTANGULAR ONLY..

0 Likes
Message 6 of 23

Kent1Cooper
Consultant
Consultant

That doesn't answer my questions.

Kent Cooper, AIA
0 Likes
Message 7 of 23

archana96
Enthusiast
Enthusiast

THE OBJECTS ARE ITS closed 4-vertex Polylines AND ITS RECTANGULAR-SHAPED ( BUT ITS NOT BLOCK ) (ITS JUST CREATE BY CAMMOND OF RE-RECTANGULAR) 

0 Likes
Message 8 of 23

Kent1Cooper
Consultant
Consultant

The more I think about it, the more questions I find....

 

For an orthogonal rectangle, do you want always the left and top edges dimensioned as in the image?  If at other angles, what should be the criteria for which two adjacent edges are dimensioned?

 

What should be the distance of the dimension lines from the rectangle edges?  That varies significantly in your image -- is there some reason for the differences?

 

Should it simply use whatever the current Dimension Style and Layer are, or should settings of those things be built in?

 

Meanwhile, there are routines out there that will do all edges, such as DimPoly.lsp, >here<, which defines a DPO command to do them on the Outside.  It might be easier to just adjust that to do only two edges, but that could depend on the answers to the questions.

Kent Cooper, AIA
0 Likes
Message 9 of 23

baksconstructor
Advocate
Advocate

Why do you need so many sizes? Maybe just look at the width and height in the properties?

0 Likes
Message 10 of 23

Kent1Cooper
Consultant
Consultant

@baksconstructor wrote:

.... Maybe just look at the width and height in the properties?


The Properties palette does not show the width and height of a Polyline rectangle, nor does the LIST command.  At least not in Acad2020 that I have here [I can check 2025 elsewhere later].  Is that something included in newer versions, or do you have some kind of customized Properties reporting tool?

 

[If these were 1-drawing-unit-square Blocks whose size was their scale factors, you could see those using either approach.]

Kent Cooper, AIA
0 Likes
Message 11 of 23

baksconstructor
Advocate
Advocate

@Kent1Cooper wrote:

Is that something included in newer versions, or do you have some kind of customized Properties reporting tool?

This is it - MyPropertiesCAD 

 

my.PNG

0 Likes
Message 12 of 23

Kent1Cooper
Consultant
Consultant

So it is an add-on.  I assume that's bounding-box based, since for a non-rectangular one it presumably still reports only the three axis-direction size numbers.  If so, the same rectangle if rotated at some non-orthogonal angle would show size numbers that are not edge lengths, which I think would not serve the OP's purpose.  @archana96 can confirm whether that would do what they need.

Kent Cooper, AIA
0 Likes
Message 13 of 23

archana96
Enthusiast
Enthusiast

this lisp works only for rectangular shapes objects, but I also need square shape objects, and it needs dimensions only 2 faces but this lisp gives 4 sides 

for your reference, I have added my file 

0 Likes
Message 14 of 23

Kent1Cooper
Consultant
Consultant

@archana96 wrote:

this lisp works only for rectangular shapes objects, but I also need square shape objects, and it needs dimensions only 2 faces but this lisp gives 4 sides .... 


If by "this lisp" you mean DimPoly.lsp [link at Message 8], it works for me on any shape, including squares in your sample drawing.  Can you point out squares on which it doesn't work for you?  And what happens when you try, any error messages, etc.

 

And yes, it does all sides, as I said where I posted the link.  I was suggesting that if it does what you want otherwise, it could be modified to do only two sides.  If that is wanted, does it matter which two sides?

Kent Cooper, AIA
0 Likes
Message 15 of 23

archana96
Enthusiast
Enthusiast

 

need like this 

sample...png

0 Likes
Message 16 of 23

Kent1Cooper
Consultant
Consultant

Please answer the questions in Messages 8 & 14 that you have not yet answered.

Kent Cooper, AIA
0 Likes
Message 17 of 23

CADaSchtroumpf
Advisor
Advisor

@archana96 

With your drawing, you can try this:

(defun c:dim_pedestal ( / ss adoc space n ent dxf_ent l_pt p1 p2 p3)
  (setq ss (ssget "_X" '((0 . "LWPOLYLINE") (8 . "PEDESTAL"))))
  (cond
    (ss
      (setq
        adoc (vla-get-activedocument (vlax-get-acad-object))
        space
        (if (= 1 (getvar "CVPORT"))
          (vla-get-paperspace adoc)
          (vla-get-modelspace adoc)
        )
      )
      (repeat (setq n (sslength ss))
        (setq
          ent (ssname ss (setq n (1- n)))
          dxf_ent (entget ent)
          l_pt (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) dxf_ent))
          p1 (list (eval (cons min (mapcar 'car l_pt))) (eval (cons min (mapcar 'cadr l_pt))))
          p2 (list (eval (cons min (mapcar 'car l_pt))) (eval (cons max (mapcar 'cadr l_pt))))
          p3 (list (eval (cons max (mapcar 'car l_pt))) (eval (cons max (mapcar 'cadr l_pt))))
        )
        (vla-addDimAligned
          space
          (vlax-3d-point p1)
          (vlax-3d-point p2)
          (vlax-3d-point (polar p1 pi (distance p1 p2)))
        )
        (vla-addDimAligned
          space
          (vlax-3d-point p2)
          (vlax-3d-point p3)
          (vlax-3d-point (polar p2 (* 0.5 pi) (distance p2 p3)))
        )
      )
    )
  )
  (prin1)
)
0 Likes
Message 18 of 23

archana96
Enthusiast
Enthusiast

this one is good.
need small changes
1. With Lisp the dimensions come only from the layers that have pedestal layers. that does not look good please change that to any selected objects to provide dimensions.
2. the dimensions offset with this lisp  depends on the size of the rectangular/square (if the size of square/rectangular is 2000mm the dimension offset is 3000mm That is not good so give a minimum offset of 200mm (for refer I attached the image))PLAN.png

0 Likes
Message 19 of 23

CADaSchtroumpf
Advisor
Advisor
Accepted solution

@archana96  a écrit :

this one is good.
need small changes
1. With Lisp the dimensions come only from the layers that have pedestal layers. that does not look good please change that to any selected objects to provide dimensions.
2. the dimensions offset with this lisp  depends on the size of the rectangular/square (if the size of square/rectangular is 2000mm the dimension offset is 3000mm That is not good so give a minimum offset of 200mm (for refer I attached the image))PLAN.png


Change

the line 2 to :

  (setq ss (ssget '((0 . "LWPOLYLINE"))))

the line 26 to:

          (vlax-3d-point (polar p1 pi 300.0))

 and the line 32 to :

          (vlax-3d-point (polar p2 (* 0.5 pi) 300.0))
0 Likes
Message 20 of 23

Kent1Cooper
Consultant
Consultant

@archana96 wrote:

this one is good.
need small changes
....


Another change needed:  It doesn't conform to your answer in Message 3 to my question in Message 2:

Kent1Cooper_0-1729086255209.png

Kent Cooper, AIA
0 Likes