Jump to content

Recommended Posts

Posted

Hey guys,

I'm trying to rotate an object by using 3 points and I'm wondering could you solve this problem -

 

; Rotate Reference Test
(defun C:test ( / o bp sp dp )
 (and 
   (setq o (car (entsel "\nSelect object to rotate: ")))
   (setq o (vlax-ename->vla-object o))
   (setq bp (getpoint "\nSpecify base point for rotation: "))
   (setq sp (getpoint "\nSpecify source point: " bp))
   (not (grdraw bp sp 2 1))
   (setq dp (getpoint "\nSpecify dest point: " bp))
   ; (vlax-invoke o 'Rotate ..?)
 )
 (princ)
)

Posted
; Rotate Reference Test
(defun C:test ( / o bp sp dp )
 (and 
   (setq o (car (entsel "\nSelect object to rotate: ")))
   (setq o (vlax-ename->vla-object o))
   (setq bp (getpoint "\nSpecify base point for rotation: "))
   (setq sp (getpoint "\nSpecify source point: " bp))
   (not (grdraw bp sp 2 1))
   (setq dp (getpoint "\nSpecify dest point: " bp))
   (vla-Rotate o (vlax-3D-point bp) (- (angle bp dp) (angle bp sp)))
 )
 (princ)
)

Posted

Thanks Lee!

I was trying to simulate align, by having 4 points which define 2 segments and an object to be moved and rotated.

Now it works! :)

Posted

You're welcome!

 

This option is already available as part of the standard ROTATE command however...

 

Command: rotate
Current positive angle in UCS:  ANGDIR=counterclockwise  ANGBASE=0
Select objects: 1 found
Specify base point:
Specify rotation angle or [Copy/[color=red]Reference[/color]] <0>:

Posted

Yes, I know - I'm just trying to switch some command calls to activex (revising old routines). ;)

Posted

Just a hint: The base point for the Rotate method is expressed in the WCS.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...