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

Rotate3D 90°/-90°

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Lukasvop1
517 Views, 6 Replies

Rotate3D 90°/-90°

Hi guys, one more tool I need.

This lisp "R90" rotate selected object(s) around axis (define by 2 points) 90° clockwise or counterclockwise.


Direction of rotation is defined by 3-rd point.
Option 1.If it's 3-rd point under rotate object(s) 90° clockwise (90)
Option 2.If it's 3-rd point above rotate object(s) 90° counterclockwise (-90)

 

 

@komondormrex

6 REPLIES 6
Message 2 of 7
hak_vz
in reply to: Lukasvop1

Command rotate3d do this!

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 3 of 7
CodeDing
in reply to: Lukasvop1

There's also a (rotate3d ...) lisp that works with the SAME inputs as the ROTATE3D command.

 

https://help.autodesk.com/view/OARX/2024/ENU/?guid=GUID-95ECADE6-B791-4B9A-8FAE-CD981F803689 

 

Best,


Need AutoLisp help? Try my custom GPT 'AutoLISP Ace':
https://chat.openai.com/g/g-Zt0xFNpOH-autolisp-ace
Message 4 of 7
Lukasvop1
in reply to: hak_vz


@hak_vz wrote:

Command rotate3d do this!


I know, I used it to create this video, which demonstrate required lisp.
I want simplify task, rotate object(s) around axis (defined by 2 points) +90°/-90°.  
Eliminate the need enter an angle value.
Like "quick rotate".

Message 5 of 7
hak_vz
in reply to: Lukasvop1

@Lukasvop1 

 

It is a simple two liner code using ssgget and autolisp command on rotate3d

Try to write it and ask help if needed.

Sorry, currently have no time to write it for you!

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 6 of 7
komondormrex
in reply to: Lukasvop1

hey there,

check the code below. uses grread mouse's buttons though to rotate  CCW or CW.

(defun c:rotate_3d_90 (/ target raxis_point_1 raxis_point_2 grread_data total)
	(setq target (vlax-ename->vla-object (car (entsel "\nPick object to rotate: ")))
		  raxis_point_1 (getpoint "\nPick 1st point of rotation axis: ")
		  raxis_point_2 (getpoint raxis_point_1 "\nPick 2nd point of rotation axis: ")
		  total 0
	)
	(while (not (equal '(2 32) (setq grread_data (grread t 12 0))))
		(princ (strcat "\r<LMB> rotate +90 (CCW), <RMB> rotate -90 (CW). Total: " (itoa total) " degrees " (cond ((minusp total) "CW") ((zerop total) "") (t "CCW"))))
		(cond
			((or (= 25 (car grread_data)) (= 11 (car grread_data)))
				(vla-rotate3d target (vlax-3d-point raxis_point_1) (vlax-3d-point raxis_point_2) (* +0.5 pi))
				(if (>= (setq total (+ +90 total)) +360) (setq total (- total 360)))
			)
			((= 3 (car grread_data))
				(vla-rotate3d target (vlax-3d-point raxis_point_1) (vlax-3d-point raxis_point_2) (* -0.5 pi))
				(if (<= (setq total (+ -90 total)) -360) (setq total (+ total 360)))
			)
			(t)
		)
	)
	(princ)
)

 

Message 7 of 7
Lukasvop1
in reply to: komondormrex

Absolute perfect, thank you.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report