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

Make dimensions parallel to the UCS

1 REPLY 1
Reply
Message 1 of 2
JamesMaeding
696 Views, 1 Reply

Make dimensions parallel to the UCS

I have tools like flatten and toolpac to correct plines and other things to be parallel to the ucs (world), but not for dimensions.

I attached a file with problem dins, does anyone have a tool to get them back to flat?

thanks


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

1 REPLY 1
Message 2 of 2
phanaem
in reply to: JamesMaeding

This will project linear dimension on XY plan (of WCS)

(defun C:TEST (/ ss i e old new n)
  (if
    (setq ss (ssget '((0 . "DIMENSION"))))
     (repeat (setq i (sslength ss))
       (setq e (entget (ssname ss (setq i (1- i))))
             n (cdr (assoc 210 e))
       )
       (if
         (member '(100 . "AcDbAlignedDimension") e)
          (progn
            (setq old (assoc 11 e)
                  new (trans (cdr old) n 0)
                  new (list 11 (car new) (cadr new) 0.0)
                  e   (subst new old e)
            )
            (foreach p '(10 13 14)
              (setq old (assoc p e)
                    new (reverse (cons 0.0 (cdr (reverse old))))
                    e   (subst new old e)
              )
            )
            (setq e (subst '(12 0.0 0.0 0.0) (assoc 12 e) e)
                  e (subst '(210 0.0 0.0 1.0) (assoc 210 e) e)
            )
            (entmod e)
          )
       )
     )
  )
  (princ)
)

 It works on your sample, but, since is a projection, in some other situations, it might lead to undesired results.

For example, if a dimension is aligned to a cube main diagonal, after projection it will measure a diagonal of the base.

In fact, even for your sample the measurements are a bit altered, since it measure 3d points and the normal vector of all your dimensions are different than WCS. So use it on a copy and check if it is OK.

 


EDIT: code changed.

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

Post to forums  

Autodesk Design & Make Report

”Boost