Author Topic: linked/synchronized/ entities and objects  (Read 5659 times)

0 Members and 1 Guest are viewing this topic.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: linked/synchronized/ entities and objects
« Reply #15 on: November 06, 2010, 04:21:52 AM »
Hi,

You can find here:
http://www.theswamp.org/index.php?topic=29339.0
an example of ObjectReactor using.
It shows how to create a new command reactor and lisp reactor within the object reactor callback function and how to remove them within their callbak functions.
It shows too how to store the objects handles in a dictionnary on saving so that the reactors can be re-built if the routine is loaded when the file is re-opened.

And another one here:
http://www.theswamp.org/index.php?topic=28604.0
which dynamically link block attributes values to one or more entities.
« Last Edit: November 06, 2010, 06:11:40 AM by gile »
Speaking English as a French Frog

ozimad

  • Guest
Re: linked/synchronized/ entities and objects
« Reply #16 on: November 08, 2010, 06:04:51 AM »
thats all is too difficult for me  :-(
i simply need to select manually an object and delete it with all the reactor connected to it.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: linked/synchronized/ entities and objects
« Reply #17 on: November 08, 2010, 07:23:10 AM »
Try this:

Code: [Select]
(defun c:EraseAndDisconnect ( / allReactors obj)
  (vl-load-com)
  (setq allReactors (apply 'append (mapcar 'cdr (vlr-reactors))))
  (mapcar 'vlr-remove allReactors) ; temporarily disable all reactors
  (setq obj (vlax-ename->vla-object (car (entsel))))
  (vla-delete obj)
  (mapcar 'vlr-add allReactors)
  ; (mapcar
    ; '(lambda (a)
      ; (vlr-owner-remove a obj)
    ; )
    ; (cdar (vlr-reactors :vlr-object-reactor))
  ; )
  (princ)
)

<edit: code that doesn't work properly has been commented out...>
« Last Edit: November 08, 2010, 08:03:37 AM by roy_043 »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: linked/synchronized/ entities and objects
« Reply #18 on: November 08, 2010, 11:51:20 AM »
Isn't this what the Parametric tools are for?

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: linked/synchronized/ entities and objects
« Reply #19 on: November 08, 2010, 02:37:46 PM »
This version of EraseAndDisconnect is probably better:

Code: [Select]
(defun c:EraseAndDisconnect2 ( / allReactorsLst obj removeLst)
  (vl-load-com)
  (setq obj (vlax-ename->vla-object (car (entsel))))
  (mapcar
    '(lambda (a / ownLst)
      (setq ownLst (vlr-owners a))
      (cond
        ((and (member obj ownLst) (= (length ownLst) 1))
          (vlr-remove a)
        )
        ((member obj ownLst)
          (vlr-owner-remove a obj)
        )
      )
    )
    (apply 'append (mapcar 'cdr (vlr-reactors :vlr-object-reactor)))
  )
  (setq allReactors (apply 'append (mapcar 'cdr (vlr-reactors))))
  (mapcar 'vlr-remove allReactors) ; temporarily disable all reactors
  (vla-delete obj)
  (mapcar 'vlr-add allReactors)
  (princ)
)

ozimad

  • Guest
Re: linked/synchronized/ entities and objects
« Reply #20 on: November 10, 2010, 05:58:46 AM »
Thanks a lot for your help!
ereaseanddisconnect2 work perfect  :wink: