djw Posted July 5, 2010 Posted July 5, 2010 This works good but, I would like to have the 2 objects rotate clockwise..not Counter clockwise (defun c:90R( / e f p a b c i) (vl-load-com) (setvar "cmdecho" 1) (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: ")))) (setq f (vlax-ename->vla-object (car (entsel "\nSelect object: ")))) (setq p (getpoint "\nSelect rotation point: ")) (setq a 1 ; Number of revolutions b 1 ; Degrees per increment (must be a factor of 90) c 01 ; Delay between incremental rotation i 0) ; (if (= 0 (rem (setq d (/ 90 b)) -1)) (while ( (repeat d (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b)) (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b)) (vl-cmdf "delay" c "regen") ) (setq i (1+ i)) ) ) ) Quote
Cad64 Posted July 5, 2010 Posted July 5, 2010 You will get a better and faster response if you post in the correct area of the forum. Question moved to the Lisp section. Quote
alanjt Posted July 5, 2010 Posted July 5, 2010 Just change your angle to a negative number. Hell, make 180. -180. Quote
asos2000 Posted July 6, 2010 Posted July 6, 2010 djw Try to use # button to paste your code to be readable as a code LIKE THIS Quote
Tharwat Posted July 6, 2010 Posted July 6, 2010 Hi Here it goes, (defun c:90R( / e f p a b c i) (vl-load-com) (setvar "angdir" 1) (setvar "cmdecho" 1) (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: ")))) (setq f (vlax-ename->vla-object (car (entsel "\nSelect object: ")))) (setq p (getpoint "\nSelect rotation point: ")) (setq a 1 ; Number of revolutions b 1 ; Degrees per increment (must be a factor of 90) c 01 ; Delay between incremental rotation i 0) ; (if (= 0 (rem (setq d (/ 90 b)) -1)) (while (< i a) (repeat d (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b)) (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b)) (vl-cmdf "delay" c "regen") ) (setq i (1+ i)) )) (setvar "angdir" 0) ) Regards Tharwat Quote
asos2000 Posted July 6, 2010 Posted July 6, 2010 Check Red code Why did you select object 2 times (e and f) (defun c:90R( / e f p a b c i) (vl-load-com) [color=red](defun *error* (msg)[/color] [color=red] (and uFlag (vla-EndUndoMark doc))[/color] [color=red] (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")[/color] [color=red] (princ (strcat "\n** Error: " msg " **")))[/color] [color=red] (princ)[/color] [color=red])[/color] [color=red](setq OldCMDEcho (getvar "cmdecho") ; Save System Variable[/color] (setvar "cmdecho" 1) (setq e (vlax-ename->vla-object (car (entsel "\nSelect object: "))) f (vlax-ename->vla-object (car (entsel "\nSelect object: "))) p (getpoint "\nSelect rotation point: ") a 1 ; Number of revolutions b 1 ; Degrees per increment (must be a factor of 90) c 01 ; Delay between incremental rotation i 0) ; (if (= 0 (rem (setq d (/ 90 b)) -1)) (while (< i a) (repeat d (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b)) (vla-rotate f (vlax-3d-point p) (* (/ pi 180.0) b)) (vl-cmdf "delay" c "regen") ) (setq i (1+ i)) ) ) [color=red](setvar "cmdecho" OldCMDEcho) ; restore System Variable[/color] [color=#ff0000] (princ)[/color] ) Quote
Lee Mac Posted July 6, 2010 Posted July 6, 2010 Why this? [color=red](and uFlag (vla-EndUndoMark doc))[/color] Or was it just a copy/paste job from my code? Quote
asos2000 Posted July 6, 2010 Posted July 6, 2010 Seems like that but there was a code line I didnt paste. (setq uFlag (vla-EndUndoMark doc)) Any way welcome back Quote
djw Posted July 6, 2010 Author Posted July 6, 2010 Thought I was post’n in the correct place? AutoCAD Forums> AutoCAD Customization> AutoLISP, Visual LISP & DCL Anyhow think U-all for the reply’s.. Alanjt (–180) seems to work, just try’n to learn, could you translate to plane English? (vla-rotate e (vlax-3d-point p) (* (/ pi 180.0) b)) “(vla-rotate e” =Selected object e “(vlax-3d-point p)”=get 3D x y z of Selected object e, what doses the “p” do? “(* (/ pi 180.0) b))”= ???? 180 = Counter clockwise -180 clockwise ?????? ya I know just try’n to learn.. Asos2000, object 2? Rotating two objects @ the same time.. thanks again… Quote
Lee Mac Posted July 6, 2010 Posted July 6, 2010 “(vlax-3d-point p)”=get 3D x y z of Selected object e, what doses the “p” do? Read the help file on vlax-3D-point, it creates a variant ( 3-element array of doubles ) from the point 'p'. Quote
Cad64 Posted July 6, 2010 Posted July 6, 2010 Thought I was post’n in the correct place? AutoCAD Forums> AutoCAD Customization> AutoLISP, Visual LISP & DCL No, that's where the thread is located now, after I moved it. You originally posted it in the 3D section. The re-direct is still there. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.