HELP, i need to make this lisp select multiple object. Rotated dimension to Aligned

HELP, i need to make this lisp select multiple object. Rotated dimension to Aligned

holyhexor0o0
Contributor Contributor
507 Views
2 Replies
Message 1 of 3

HELP, i need to make this lisp select multiple object. Rotated dimension to Aligned

holyhexor0o0
Contributor
Contributor

hello, i found this lisp in the forum. But it only works for a single Dimenion 1 time each.

How do apply to all selected, or select many dimenions.

 

 

Heres the lisp

 

(defun C:R2A (/ dim ddata); = Dimension: Linear to Aligned
(setq
dim (car (entsel "\nSelect Linear Dimension: "))
ddata (entget dim)
); setq
(command "_.dimaligned"
"_none" (cdr (assoc 13 ddata)) "_none" (cdr (assoc 14 ddata)) "_none" (cdr (assoc 11 ddata))
); command
(entdel dim)
(princ)
); defun

0 Likes
Accepted solutions (1)
508 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

Try this:

 

(defun C:R2A (/ ss n dim ddata); = Dimensions: Linear to Aligned
  (if (setq ss (ssget '((0 . "DIMENSION") (-4 . "<NOT") (-4 . "&") (70 . 31) (-4 . "NOT>"))))
    (repeat (setq n (sslength ss)); then
      (setq
        dim (ssname ss (setq n (1- n)))
        ddata (entget dim)
      ); setq
      (command "_.dimaligned"
        "_none" (cdr (assoc 13 ddata)) "_none" (cdr (assoc 14 ddata)) "_none" (cdr (assoc 11 ddata))
      ); command
      (entdel dim)
    ); repeat
  ); if
  (princ)
); defun

 

Minimally tested on the selection part only -- if I got it right, that will allow you to select any number of Dimensions, but it will ignore Aligned, Angular, Radius, Diameter and Ordinate varieties, and "see" only the Rotated kinds [Linear, Rotated, Horizontal, Vertical].

 

HOWEVER, it's up to you to select only those whose dimension-line direction aligns with the direction between their definition points.  On others, you will get an Aligned Dimension that shows something very different from the original:

Kent1Cooper_0-1658749879276.png

[Maybe that's what you want....]  But the routine could be made to check whether the angle between definition points is the same as the dimension-line direction, and proceed only if it is.

Kent Cooper, AIA
Message 3 of 3

holyhexor0o0
Contributor
Contributor
It is perfect. Thank you so much
0 Likes