Author Topic: Revisit Area Reactor  (Read 1693 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Revisit Area Reactor
« on: September 15, 2005, 12:37:20 PM »


I'm still having some problems with my code. Could some of you guys TEST THIS out and let me know how I can refine this code. There still seems to be some minor bugs in it but it does work. Constructive criticism is always welcome.


http://www.theswamp.org/forum/index.php?topic=6813.0#bot
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

LE

  • Guest
Re: Revisit Area Reactor
« Reply #1 on: September 16, 2005, 11:23:54 PM »
Not exactly [maybe] but have a look at this short sample.... I will try to post here one of my commands for this AREATAG

Code: [Select]
(vl-load-com)

(defun commandended
       (reactor params / atts att1 att2 text_att1 text_att2)
  (if modified_list
    (foreach blk  modified_list
      (setq atts
      (reverse (vlax-safearray->list
(vlax-variant-value (vla-getattributes blk))))
    att1      (car atts)
    att2      (cadr atts)
    text_att1 (vla-get-textstring att1)
    text_att2 (vla-get-textstring att2))
      (if (/= text_att2 text_att1)
(vla-put-textstring att1 (vla-get-textstring att2)))))
  (setq modified_list nil))

(defun subobjmodified  (owner reactor params)
  (if (and (not (wcmatch (getvar "cmdnames") "UNDO,U,REDO,OOPS"))
   (not (vl-position owner modified_list)))
    (setq modified_list (cons owner modified_list))))

(defun erased  (owner reactor params)
  (vlr-owner-remove reactor owner)
  (vlr-data-set reactor nil)
  (vlr-remove reactor))

(defun C:TEST  (/ obj obj_reactor)
  (setq obj (vlax-ename->vla-object
      (car (entsel "\nSelect a block with two attributes: "))))

  (if (not editor_reactor)
    (setq editor_reactor
   (vlr-editor-reactor
     "editor"
     '((:vlr-commandended . commandended)))))

  (setq obj_reactor
(vlr-object-reactor
   (list obj)
   (list obj)
   ;;"obj"
   '
    ((:vlr-erased . erased)
     (:vlr-subobjmodified . subobjmodified))))
  (princ))

(princ)