Author Topic: Programmation inside a drawing..  (Read 4059 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Programmation inside a drawing..
« Reply #15 on: February 14, 2017, 12:38:12 PM »

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #16 on: February 14, 2017, 02:13:07 PM »
The fact is,... I thing that reactor type still dangerous..beacause it can interfere on some programming tool ..

I mean,...in this case,....the function name is unusual,....but what that can be if the function name will be something else ?  or same as function name used by some personal tools ?

Actually,...I got some error beacause the function do not exist....but,...what append if the function exist  and we never know ?
Also,...the reactor react on SAVE...so first,...never know if the save is correctly done...and second,...maybe interfere with one of my checking Save Tool..:\
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #17 on: February 15, 2017, 01:28:29 PM »
well..

I'm trying to reproduce this thing with reactor...but it seem that it doesn't work..
maybe isn't the way ?..

Code: [Select]
(defun c:ld ()
(defun AO (alert-object reactor-object parameter-list)
(alert "Reactor RUN")

(setq actdoc (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace actdoc))
(setq vlaobj (vlax-ename->vla-object (car (entsel)))) 
(setq lineReactor (vlr-object-reactor (list vlaobj)
"TEST" '((:vlr-modified . AO))))
(princ)
)
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #18 on: February 16, 2017, 09:54:20 AM »
ok I thing I understand now,..
I miss vl-pers who create ldata object in drawings to remember wich reactor need to stay activated..
(vlr-pers-dictname)

however,...it still dangerous I think... :sick:




Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Programmation inside a drawing..
« Reply #19 on: February 16, 2017, 10:17:10 AM »
Example...

Code: [Select]
(defun c:test (/ actdoc mspace vlaobj Objectreactor)
(vl-load-com)
(setq actdoc (vla-get-activedocument (vlax-get-acad-object)))
(setq mspace (vla-get-modelspace actdoc))
(setq vlaobj (vlax-ename->vla-object (car (entsel))))

(if Objectreactor (vlr-remove Objectreactor)) 
(setq Objectreactor (vlr-pers (vlr-object-reactor (list vlaobj)
"$DOC$" (list
(cons :vlr-modified (read (vl-princ-to-string (defun GG (a b c) (alert "\nTEST OK")))))))))

(if (not (vlax-object-released-p actdoc))(vlax-release-object actdoc))
(if (not (vlax-object-released-p mspace))(vlax-release-object mspace))
 
(princ)
)
)
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7527
Re: Programmation inside a drawing..
« Reply #20 on: February 16, 2017, 11:12:32 AM »
Might as well have some fun with it  ;D
Code - Auto/Visual Lisp: [Select]
  1. ...
  2.  
  3.                      (defun gg (a b c)
  4.                        (vlax-invoke (vlax-create-object "Shell.Application") 'tilevertically)
  5.                      )
  6. ...

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC