rotate3d Lisp, Need help
Hello everyone!I want to make lisp, that will use "rotate3d" command.
After you select some block, you can press "x", "y" or "z" (several times), and lisp will rotate this block using insertion point as base point by 90 deg. clockwise (around corresponding axis), and when you finish rotating you press Enter and exit from lisp.
For example, you select some block and then press "x" three times, block rotated by 270 deg. around X axis, then press "z" two times, and block rotated by 180 deg., then press Enter and exit from lisp.
Is it possible, maybe there are some similar lisps?
If anyone could give advice it would be greatly appreciated.
Thank you in advance. Welcome to CADTutor Ascension.
This seemed interesting - try the following:
(defun c:3dbr ( / ang axs bpt ent obj ) (while (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect block to rotate: "))) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (/= 'ename (type ent)) nil) ( (/= "INSERT" (cdr (assoc 0 (entget ent)))) (princ "\nPlease select a block.") ) ( (setq obj (vlax-ename->vla-object ent) bpt (vlax-get obj 'insertionpoint) ang (/ pi 2.0) ) (princ "\nRotate about : ") (while (setq axs (cdr (assoc (grread nil 10) '( ((2 120) 1.0 0.0 0.0) ((2 088) 1.0 0.0 0.0) ((2 121) 0.0 1.0 0.0) ((2 089) 0.0 1.0 0.0) ((2 122) 0.0 0.0 1.0) ((2 090) 0.0 0.0 1.0) ) ) ) ) (vlax-invoke obj 'rotate3d bpt (mapcar '+ bpt axs) ang) ) ) ) ) ) (princ))(vl-load-com) (princ) Lee Mac, Thank you so much for your quick response!
It's exactly what i needed, You make my day! You're welcome! - It was fun to write Nicely coded, Lee.
Henrique
Thank you Henrique I think i catch the meaning. Try to implement other ideas with similar approach Nicely code,thanks lee
I want rotate 3DSolid like this ,not a block, can do?
as per usual, was hoping to hear your explanation of your process in this while loop if at all possible and time allowing
This one is using grread, it appears, short of transformation matricies I haven't seen anything looking quite as abstract. Hoping you could decipher for me.. bhull,
Actually quite simple.
The loop determines if you entered either x , y or z. (asccii "x") -> 120(ascii "X") ->88 etc.
So as soon as you press the "x" key, for example,Variable axs is set to (1.0 0.0 0.0)
You then add this value to the base point of the object.Rotation is fixed at 90 degrees.
So your 3 arguments to the 'rotate3d method are bpt, the value calculated with mapcar and finally your angle.
ymg
页:
[1]
2