Jump to content

Recommended Posts

Posted

I am trying to write a routine that will activate anytime someone tries to move specific entities around by their grips.

 

Does anyone have any good ideas where to start?

 

Thanks.

Posted

You can to use couple of Command and AcDb reactors. For example turn reactors by GRON command and make grip rotation for some object (GROFF to turn off):

 

(defun c:gron()
 (vl-load-com)
 (if(not grip:reactor)
   (setq grip:reactor
   (vlr-Command-Reactor nil
     '((:vlr-CommandEnded . GripReaction))
     ); end vlr-Command-Reactor
  ); end setq
   ); end if
 (if(not acdb:reactor)
   (setq acdb:reactor
   (vlr-AcDb-Reactor nil
     '((:vlr-objectModified . GripModified))
     ); end vlr-Command-Reactor
  ); end setq
   ); end if
 (princ)
 ); end of c:gron


(defun c:groff()
 (if grip:reactor
   (progn
     (vlr-remove grip:reactor)
     (setq grip:reactor nil)
     (vlr-remove acdb:reactor)
     (setq acdb:reactor nil)
     ); end progn
   ); end if
 (princ)
 ); end of c:groff


(defun GripModified(Reac Args / lEnt)
 (setq lEnt(vlax-ename->vla-object(cadr Args))
gron:lastent(strcat(vla-get-ObjectName lEnt)
		   " ID: "(itoa(vla-get-ObjectID lEnt)))
); end setq
 (princ)
 ); end of GripModified


(defun GripReaction(Reac Args)
 (if(equal "GRIP_ROTATE"(car Args))
   (if gron:lastent
     (alert
(strcat "You have just rotated:\n" gron:lastent))
     ); end if
   ); end if
 (princ)
 ); end of GripReaction

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...