Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
Redraiderr2009
Posts: 164
Registered: ‎04-09-2008
Message 1 of 2 (286 Views)

Rotating a table to current UCS

286 Views, 1 Replies
09-12-2012 11:50 AM

Tables do no have a rotation angle. I can find the insert point, but there is no other point to make an angle calculation with. 

 

(setq objTable (vlax-ename->vla-object (car (entsel))))

(vlax-dump-object objTable T)

Valued Contributor
Rtogores
Posts: 84
Registered: ‎02-07-2001
Message 2 of 2 (272 Views)

Re: Rotating a table to current UCS

09-13-2012 02:34 AM in reply to: Redraiderr2009

You may use vla-TransformBy with the UCS's transformation matrix.

To get the UCS transformation matrix it mus be a NAMED UCS.

This is a very simple example, it supposes your UCS is named previously:

(defun align-table  (/ table mtrans)
  (setq table (vlax-ename->vla-object
                (car (entsel "\nSelect Table:"))))
  (setq mtrans
         (vla-GetUCSMatrix
           (vla-get-ActiveUCS
             (vla-get-activedocument (vlax-get-acad-object)))))
  (vla-TransformBy table mtrans))

 Regards,

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.