Author Topic: How deletes in (VLR-REACTORS:VLR-Object-Reactor) center to the project which doe  (Read 2937 times)

0 Members and 1 Guest are viewing this topic.

hunterxyz

  • Guest
How deletes in (VLR-REACTORS:VLR-Object-Reactor) center to the project which does not exist?

_$ ((:VLR-Object-Reactor #<VLR-Object-Reactor> #<VLR-Object-Reactor> #<VLR-Object-Reactor>))

LE

  • Guest
I have no idea if this code works or not, give it a try...

Code: [Select]
(defun has-reactor?  (obj)
  (vl-some
    (function (lambda (x) (numberp x)))
    (mapcar (function (lambda (r) (vl-position obj (vlr-owners r))))
    (cdar (vlr-reactors :vlr-object-reactor)))))

(defun attached-to  (obj)
  (vl-remove
    nil
    (mapcar
      (function
(lambda (reactor_type)
  (vl-remove-if-not
    (function
      (lambda (r)
(cond
  ((and (equal reactor_type :vlr-object-reactor)
(vl-position obj (vlr-owners r)))
   r)
  ((and
     (not (equal reactor_type
:vlr-object-reactor))
     (vl-position obj (vlr-data r)))
   r))))
    (cdar (vlr-reactors reactor_type)))))
      (vlr-types))))

(defun rem-reactor  (data)
  (mapcar
    (function
      (lambda (r)
(cond
  ((and (equal (vlr-type r) :vlr-object-reactor)
(not (vl-some 'vlax-erased-p (vlr-owners r))))
   (foreach owner  (vlr-owners r)
     (vlr-owner-remove r owner))
   (vlr-data-set r nil))
  ((and (vlr-added-p r)
(not (equal (vlr-type r)
    :vlr-object-reactor))
(not (vl-some 'vlax-erased-p (vlr-data r))))
   (vlr-data-set r nil)))))
    data))

(defun C:REMREACTOR  (/ ename vla_obj data)
  (if (and (setq ename
  (car
    (entsel "\nSelect object to remove reactor: ")))
   (setq vla_obj (vlax-ename->vla-object ename))
   (has-reactor? vla_obj))

    (progn
      (setq data (apply 'append (attached-to vla_obj)))
      (rem-reactor data)
      (if (not (attached-to vla_obj))
(alert "\nObject is not part of a reactor anymore."))))
  (princ))

LE

  • Guest
Also, I played a lot with vlisp reactors in the past and have posted here some of my samples, they still might have something useful, here is a link:

http://www.theswamp.org/index.php?topic=8889.0

and in the "show your stuff" forum, there are other ones too... look for my initials LE


HTH

hunterxyz

  • Guest
Thank you the explanation.

Asked in addition,
"(VLR-REACTORS :VLR-Object-Reactor)" and
"(vlax-ldata-delete "VL-REACTORS" "$DOC$")"

Whether has the connected relations,
because deletes "VL-REACTORS" the project data,
Also can affect "VLR-REACTORS" the project data.
Did not know "VLR-REACTORS" the project data originates,
whether is comes from "VL-REACTORS"?

Requests master help to answer, thanks ~

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
(vlax-ldata-delete dict key )

"VL-REACTORS"  is the Name of a global dictionary that the person is using.
"$DOC$" is the dictionary key.


looks to me like the person is saving reactor information in a drawing dictionary.



kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
"VL-REACTORS" is the dictionary where the persistant reactors are saved

$ (vlr-pers-dictname)
"VL-REACTORS"

(vlax-ldata-get "VL-REACTORS" "$DOC$") and (vlr-pers-list) return the same

(setq persDict (dictsearch (namedobjdict) (vlr-pers-dictname)))

(sorry, I do not understand your question, I will try to post, a function that cleans the persistant reactors - thinking that's what you are looking for...)
« Last Edit: June 07, 2007, 09:50:30 AM by LE »

GDF

  • Water Moccasin
  • Posts: 2081
How deletes in (VLR-REACTORS:VLR-Object-Reactor) center to the project which does not exist?

_$ ((:VLR-Object-Reactor #<VLR-Object-Reactor> #<VLR-Object-Reactor> #<VLR-Object-Reactor>))


Maybe this?

Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;; Function: CleanReactors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;  Description: This is a general utility function used for cleaning
;;;               up reactors. It can be used during debugging, as     
;;;               well as cleaning up any open reactors before a       
;;;               drawing is closed.
;;;  This file is from the Garden Path tutorial....Util.lsp file
(defun ARCH:CleanReactorsit  ()
  (setq *commandReactor* nil
        *DrawingReactor* nil)
  (mapcar 'vlr-remove-all
          '(:VLR-AcDb-reactor :VLR-Editor-reactor :VLR-Linker-reactor :VLR-Object-reactor
            :VLR-Command-Reactor :VLR-DeepClone-Reactor :VLR-DocManager-Reactor
            :VLR-DWG-Reactor :VLR-DXF-Reactor :VLR-Editor-reactor :VLR-Insert-Reactor
            :VLR-Linker-Reactor :VLR-Lisp-Reactor :VLR-Miscellaneous-Reactor
            :VLR-Mouse-Reactor :VLR-Object-Reactor :VLR-SysVar-Reactor :VLR-Toolbar-Reactor
            :VLR-Undo-Reactor :VLR-Wblock-Reactor :VLR-Window-Reactor :VLR-XREF-Reactor))
  (princ "\n*       Remove All Reactors completed        *\n")
  (princ))
(defun ARCH:CleanReactors  ()
  (setq Result (ARCH:WARNING-5
                 "Clean Reactors"
                 "     This will Remove and UnLoad All Reactors from Arch Program.\n"
                 "     \n\n" "     [ Yes ]\t  to continue on...\n" "     [ No ]\t  to cancel."
                 ""))
  (cond ((= 0 Result) (ARCH:CleanReactorsit))
        ((= 1 Result)
         (princ "\n*** ///////// Program  CANCELLED ///////// ***")))
  (princ))

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64