TimSpangler 发表于 2022-7-6 13:27:18

OK Lee.You need something to do in the form of a prank.Make a reactor to move objects away from the cursor so that they can be selected...So when they invoke explode they can get any objects.

Lee Mac 发表于 2022-7-6 13:31:58

Haha, nice idea Tim -
 
But the reactor would need some form of GrRead loop to track the mouse movements - which, combined with a reactor, may cause trouble

lpseifert 发表于 2022-7-6 13:36:35

I defer to your genius Lee... can you incorporate this?

(setq SpV (vlax-create-object "Sapi.SpVoice"))   (vlax-invoke SpV "Speak" "Kaboom" 0)   (vlax-release-object SpV)

Lee Mac 发表于 2022-7-6 13:36:50

I'm no genius Larry
 

(defun c:ExOn () (vl-load-com) (if (not *prank)   (setq *prank   (vlr-command-reactor nil       (list         (cons :vlr-commandWillStart 'prank))))) (princ))(defun prank (Reac Args) (if (eq "EXPLODE" (strcase (car Args)))   (progn   (setq SpV (vlax-create-object "Sapi.SpVoice"))   (vlax-invoke SpV "Speak" "Kaboom" 0)   (vlax-release-object SpV))) (princ))(defun c:ExOff () (if (and *prank (vlr-added-p *prank))   (progn   (vlr-remove *prank)   (setq *prank nil))) (princ))

lpseifert 发表于 2022-7-6 13:41:21

Ha! now it's truly pointless
Not really... reminded me how reactors work- Thx

Lee Mac 发表于 2022-7-6 13:43:23

No probs - Its a fun program

fuccaro 发表于 2022-7-6 13:49:13

And what if the user selects the objects *before* it starts the Explode command?

lpseifert 发表于 2022-7-6 13:51:44

Lee
Since you once offered to explain your stuff...
how about this?

(defun c:ExOff () (if (and *exR (vlr-added-p *exR))   (progn   (vlr-remove *exR)(setq *exR nil)))I've read Help about vlr-added-p, but how is *exR 'made' a VLR object representing the reactor?

Lee Mac 发表于 2022-7-6 13:53:28

I use the variable *exR as a global variable (not localised in any function), and bound the reactor object to it, when the user invokes the top program (ExON).
EDIT!
 
OOPs!Forgot to change it from the last program!
 
**program updated above... nice spot Larry!

lpseifert 发表于 2022-7-6 13:57:41

Oh, OK... Thx
页: 1 [2]
查看完整版本: Another Pointless Program :P