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

entmake & ucs

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
489 Views, 3 Replies

entmake & ucs

I currently use an entmake call to make simple blocks
I take of the ucs issue as follows:

(trans pt 10)

(steq angb (angle '( 0.0 0.0 0.0) (getvar "UCSXDIR")))

this works fine if the ucs is a simple rotation around the z axis - the most common use. How do I change the entmake so that it can accommodate UCS's that are not parallel to the ucs world plane?


PJ
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

search this group for c:valve which gives an example of creating a block at
any orientation in space using the arbitrary axis jive...

wrote in message news:5388910@discussion.autodesk.com...
I currently use an entmake call to make simple blocks
I take of the ucs issue as follows:

(trans pt 10)

(steq angb (angle '( 0.0 0.0 0.0) (getvar "UCSXDIR")))

this works fine if the ucs is a simple rotation around the z axis - the most
common use. How do I change the entmake so that it can accommodate UCS's
that are not parallel to the ucs world plane?


PJ
Message 3 of 4
Anonymous
in reply to: Anonymous

Hi Jamie,

Good question. I don't have time for a decent reply right now. Maybe these functions
by Doug will shed some light.

I'm not sure if you mean transform points or objects. But a 4x4 matrix can be used to
transform either one.

Joe Burke

;; by Doug C. Broad, Jr.
;; can be used with vla-transformby to
;; transform objects from the UCS to the WCS
(defun UCS2WCSMatrix ()
(vlax-tmatrix
(append
(mapcar
'(lambda (vector origin)
(append (trans vector 1 0 t) (list origin))
)
(list '(1 0 0) '(0 1 0) '(0 0 1))
(trans '(0 0 0) 0 1)
)
(list '(0 0 0 1))
)
)
)
;; transform objects from the WCS to the UCS
(defun WCS2UCSMatrix ()
(vlax-tmatrix
(append
(mapcar
'(lambda (vector origin)
(append (trans vector 0 1 t) (list origin))
)
(list '(1 0 0) '(0 1 0) '(0 0 1))
(trans '(0 0 0) 1 0)
)
(list '(0 0 0 1))
)
)
)
;; Example: transform an object from the current UCS to
;; WCS. Note, the UCS that the object is drawn in must
;; be current for this to work as expected.
; (defun c:test (/ ent obj)
; (setq ent (car (entsel))
; obj (vlax-ename->vla-object ent))
; (vla-transformby obj (UCS2WCSmatrix))
; (vla-update obj)
; )

wrote in message news:5388910@discussion.autodesk.com...
I currently use an entmake call to make simple blocks
I take of the ucs issue as follows:

(trans pt 10)

(steq angb (angle '( 0.0 0.0 0.0) (getvar "UCSXDIR")))

this works fine if the ucs is a simple rotation around the z axis - the most common
use. How do I change the entmake so that it can accommodate UCS's that are not
parallel to the ucs world plane?


PJ
Message 4 of 4
_gile
in reply to: Anonymous

Hi,

To get the extrusion direction of the current UCS (the normal vector of XY plane) :

(setq ucszdir (trans '(0 0 1) 1 0 T)

Then :

(setq angb (angle '(0.0 0.0 0.0) (trans (getvar "UCSXDIR") 0 ucszdir)))


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

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

Post to forums  

Autodesk Design & Make Report