Is there an add-on that allows you to dimension a curved line?

Is there an add-on that allows you to dimension a curved line?

efaillaceW9L2E
Contributor Contributor
5,438 Views
10 Replies
Message 1 of 11

Is there an add-on that allows you to dimension a curved line?

efaillaceW9L2E
Contributor
Contributor

I am looking for something that dimensions the overall length of a curved line/polyline rather then gives the point to point distance. 

0 Likes
5,439 Views
10 Replies
Replies (10)
Message 2 of 11

cheryl.buck
Autodesk Support
Autodesk Support

Hi @efaillaceW9L2E,

 

Great question, I was able to find this on how To create an arc length dimension.

 

If a post answered your question or resolved the issue, please click the Accept Solution button.

Likes are always welcome.

 

All the best,

 

Cheryl Buck
Technical Support Specialist



Did a post answer your question or help resolve the issue? Please click the Accept Solution button.
If you find a response helpful, consider Liking the post.

0 Likes
Message 3 of 11

efaillaceW9L2E
Contributor
Contributor

@cheryl.buck thanks but this is not what I am looking for. I work with tubing a lot and majority of the time it is slightly bent. I am looking for an add-on that allows to find the total length of a polyline. The arc length dimension will not work. I have attached an image to clarify. Right now I use the aligned dimension and I drew with pencil what I am looking for. 

0 Likes
Message 4 of 11

pendean
Community Legend
Community Legend
0 Likes
Message 5 of 11

efaillaceW9L2E
Contributor
Contributor

Yes this very helpful. I am not familiar of how lisp works and such, is there a way that it will show dual dimensions. If so please advise how. 

;; Dimension Curve  -  Lee Mac 2012
(defun c:dimcurve ( / _line _arrow a b cm el en p q pt )

    (defun _line ( a b )
        (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
    )
    
    (defun _arrow ( a b )
        (entmake
            (list
               '(0 . "LWPOLYLINE")
               '(100 . "AcDbEntity")
               '(100 . "AcDbPolyline")
               '(90 . 2)
               '(70 . 0)
                (cons 10 a)
               '(40 . 0.0)
                (cons 41 (/ (distance a b) 3.0))
                (cons 10 b)
            )
        )
    )
    
    (while
        (progn (setvar 'errno 0) (setq en (car (entsel)))
            (cond
                (   (= 7 (getvar 'errno))
                    (princ "\nMissed, try again.")
                )
                (   (eq 'ename (type en))
                    (if (not (wcmatch (cdr (assoc 0 (entget en))) "ARC,CIRCLE,ELLIPSE,LINE,LWPOLYLINE,SPLINE"))
                        (princ "\nInvalid Object Selected.")
                    )
                )
            )
        )
    )
    (if
        (and en
            (setq pt
                (getpoint "\nSpecify Dimension Offset: "
                    (trans
                        (vlax-curve-getpointatparam en
                            (/ (+ (vlax-curve-getendparam en) (vlax-curve-getstartparam en)) 2.0)
                        )
                        0 1
                    )
                )
            )
        )
        (progn
            (setq el (entlast)
                  cm (getvar 'cmdecho)
            )
            (setvar 'cmdecho 0)
            (command "_.offset" "_T" en "_non" pt "")
            (setvar 'cmdecho cm)
            (if (equal el (setq el (entlast)))
                (princ "\nUnable to Create Dimension Line.")
                (progn
                    (setq a (vlax-curve-getstartpoint en)
                          b (vlax-curve-getstartpoint el)
                    )
                    (_line
                        (polar a (angle a b) (/ (distance a b) 6.0))
                        (polar b (angle a b) (/ (distance a b) 6.0))
                    )
                    (setq a (vlax-curve-getendpoint en)
                          b (vlax-curve-getendpoint el)
                    )
                    (_line
                        (polar a (angle a b) (/ (distance a b) 6.0))
                        (polar b (angle a b) (/ (distance a b) 6.0))
                    )
                    (_arrow
                        (vlax-curve-getstartpoint el)
                        (polar (vlax-curve-getstartpoint el)
                            (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv el (vlax-curve-getstartparam el)))
                            (getvar 'dimasz)
                        )
                    )
                    (_arrow
                        (vlax-curve-getendpoint el)
                        (polar (vlax-curve-getendpoint el)
                            (+ pi (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv el (vlax-curve-getendparam el))))
                            (getvar 'dimasz)
                        )
                    )
                    (setq a (vlax-curve-getpointatdist el (/ (vlax-curve-getdistatparam el (vlax-curve-getendparam el)) 2.0))
                          b (angle '(0.0 0.0) (vlax-curve-getfirstderiv el (vlax-curve-getparamatpoint el a)))
                          p (polar a (+ b (/ pi 2.0)) (getvar 'dimtxt))
                          q (polar a (- b (/ pi 2.0)) (getvar 'dimtxt))
                    )
                    (if (< (distance p (vlax-curve-getclosestpointto en p))
                           (distance q (vlax-curve-getclosestpointto en q))
                        )
                        (setq p q)
                    )
                    (entmake
                        (list
                           '(000 . "TEXT")
                            (cons 10 p)
                            (cons 11 p)
                            (cons 40 (getvar 'dimtxt))
                            (cons 01 (rtos (vlax-curve-getdistatparam en (vlax-curve-getendparam en))))
                            (cons 50 (LM:readable b))
                           '(072 . 1)
                           '(073 . 2)
                        )
                    )
                )
            )
        )
    )
    (princ)
)

;; Readable  -  Lee Mac
;; Returns an angle corrected for text readability.
 
(defun LM:readable ( a )
    (   (lambda ( a )
            (if (< a 0.0)
                (LM:readable a)
                (if (and (< (* pi 0.5) a) (<= a (* pi 1.5)))
                    (LM:readable (+ a pi))
                    a
                )
            )
        )
        (rem (+ a pi pi) (+ pi pi))
    )
)

(vl-load-com) (princ)

  

0 Likes
Message 6 of 11

ВeekeeCZ
Consultant
Consultant

I remember the DIMCURVE tool. Video HERE and the file HERE 

Message 7 of 11

Kent1Cooper
Consultant
Consultant

Maybe >LabelLengths.lsp< will work for you.

Kent Cooper, AIA
0 Likes
Message 8 of 11

john.uhden
Mentor
Mentor

Hats off to whoever made that one!

John F. Uhden

Message 9 of 11

efaillaceW9L2E
Contributor
Contributor

@ВeekeeCZ yes this is very similar to what I am looking for but I need to give me dual dimensions. I figured there would be a way to do it in LISP, via convert the number given (which is in inches) to millimeters on a second line. I am just not sure of how because I am not familiar with LISP and using it in AutoCAD. I attached an example of what I would like it to print. Again any help would be appreciated!

0 Likes
Message 10 of 11

Sea-Haven
Mentor
Mentor

If you do your dims in one unit you can via lisp go back and overide the value with 2 values metric and inches. If its decimal inches much easier.

 

This is a very simple eaxmple and may need more control for type of dimension and other dim settings which there are a lot.

 

(defun c:test ( / obj dist1 dist2)
(while (setq obj (entget (car (entsel "\nPick a dim"))))
(setq dist1 (cdr (assoc 42 obj)))
(setq dist2 (* dist1 25.4))
(entmod (subst (cons 1 (strcat (rtos dist1 2 1) "\n" (rtos dist2 2 1))) (assoc 1 obj) obj))
)
)

 

 

 

0 Likes
Message 11 of 11

efaillaceW9L2E
Contributor
Contributor

update: figured out how to add the second line of text needed, but there seems to be a text print issue. I also am not sure why the polyline created for the dimension wont change to the "dims" layer when I have it set to. Everything else goes to the correct layer but the polyline. Would anyone know how to solve these two problems?

 

0 Likes