Jump to content

Search the Community

Showing results for tags 'reactors'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 9 results

  1. I am creating a program to generate mill slots and to update (using reactors) if a centerline is modified. The only thing I can't figure out is how to handle the reactors for the secondary entities linked to the one being modified. I am currently approaching the problem like so: Each centerline has xdata that contains the handle of the outline followed by the handles of the other linked centerlines. When the magenta line is modified, the outline will be deleted and a new outline will be generated based on the linked items, but that means a new handle needs to be added to the two other lines. (I will have a similar and more complex problem when a new line crosses/interacts with the polylines) I've tried modifying xdata once before and it ended up stuck in a loop. I thought that by modifying the xdata my object modified reactor would trigger but it didn't seem to. I don't have any working code ready to post yet, but what I really could use is some advice or guidance on the logic to trigger my reactors on secondary objects. Thanks for looking!
  2. So I have a 'bad' tendency to use the ESC key instead of the space bar to end a command. Now that I am starting to use reactors this will likely become a problem, and rather than changing my behavior I'd like to bend my program to my will. Currently one of my reactors changes the color of text in a dimension and the other strips xdata from copied geometry, except, of course, when I use the escape key -- even though the dimension text was modified or object copied. Can anyone recommend a work around? Should I call a different reactor event? These are the 2 relevant dimension modification functions (the copy functions are similar enough). (defun wp:dimtext:modify:callback (owner reactor params / data) (if (not (member (setq data (list owner reactor)) {wp:data})) (setq {wp:data} (cons data {wp:data})) ) (vlr-command-reactor (list wp:app) (list (cons :vlr-commandended 'wp:dimtext:modify) (cons :vlr-commandcancelled 'wp:dimtext:modify:commandcancelled) (cons :vlr-commandfailed 'wp:dimtext:modify:commandcancelled) ) ) (vlr-remove reactor) (princ) ) (defun wp:dimtext:modify:commandcancelled (reactor params / data) (vlr-remove reactor) (if (and (listp {wp:data}) (setq data (car {wp:data})) ) (vlr-add (cadr data)) ) (setq {wp:data} (cdr {wp:data})) (princ) )
  3. In the phases of learning something new, the most frustrating thing to me is when the examples make total sense, but you lack just enough understanding to implement it yourself. I can read through Lee Mac's AssociativeCenterlines lisp, and it all makes sense, but I am missing something in my code (and thinking) to make these reactors fully work. Below is the function where I attach the reactors to the objects and all of the reactor code I'm using. The erase reactor seems to work fine, though I wonder about reattaching the reactors afterwards. I assumed doing that would help with the use of the UNDO command. Please correct me if I am wrong or if there is a better way. The modification callback just seems to do nothing. What am I missing? Do I need a reactor for commandended too? (defun SUB:Generate_Dims (circ pt1 pta ptb / ctr dim circe dime) (setq ctr (vlax-get circ 'center) circe (entget (vlax-vla-object->ename circ))) (setq dim (vla-adddimdiametric {MODELSPACE} (vlax-3d-point pta) (vlax-3d-point ptb) pt1 ) dime (entget (vlax-vla-object->ename dim))) (vla-put-textoverride dim (strcat "{\\C5;N.NNNN\\P}<>")) (entmod (list (assoc -1 circe) (list -3 (list wp:app (cons 1002 "{") (cons 1005 (vla-get-handle dim)) (cons 1002 "}") ) ) ) ) (entmod (list (assoc -1 dime) (list -3 (list wp:app (cons 1002 "{") (cons 1005 (vla-get-handle circ)) (cons 1002 "}") ) ) ) ) (vlr-object-reactor (list circ) (list wp:app (vla-get-handle dim)) (list (cons :vlr-erased 'wp:erase:callback) ) ) (vlr-object-reactor (list dim) (list wp:app (vla-get-handle circ)) (list (cons :vlr-modified 'wp:text:callback) (cons :vlr-erased 'wp:erase:callback) ) ) ) ;;; ==== REACTOR FUNCTIONS ==== (defun wp:erase:callback (owner reactor params / h en xR) (if (and (vlax-erased-p owner) (entget (setq en (handent (setq h (cadr (vlr-data reactor)))))) ) (progn (setq xR (vl-remove-if-not (function (lambda (x) (and (eq h (cadr (vlr-data x))) (eq wp:app (car (vlr-data x))) (equal '(:vlr-erased . wp:erase:callback) (car (vlr-reactions x))) ) ) ) (cdar (vlr-reactors :vlr-object-reactor)) ) ) (mapcar 'vlr-remove (cons reactor xR)) (entdel en) (mapcar 'vlr-add (cons reactor xR)) ) ) (princ) ) (defun wp:text:callback (owner reactor params) (setq {data} (list owner reactor)) (vlr-command-reactor (list wp:app) (list (cons :vlr-commandended 'wp:text:modify) (cons :vlr-commandcancelled 'wp:text:cancelled) (cons :vlr-commandfailed 'wp:text:cancelled) ) ) (vlr-remove reactor) (princ) ) (defun wp:text:modify (reactor params / val mm c %) (vlr-remove reactor) (if (and {data} (not (vlax-erased-p (car {data}))) (vlax-read-enabled-p (car {data})) (vlax-write-enabled-p (car {data})) (vlax-property-available-p (car {data}) 'TextOverride) ) (progn (setq val (atof (substr (vl-string-right-trim "\\P}<>" (vla-get-textoverride (car {data}))) 6)) mm (vla-get-measurement (car {data})) % (abs (/ (apply '- (list mm val)) (if (zerop mm) '0.001 mm))) c (cond ((or (zerop val) (>= % '1.0)) "7") ((<= % '0.075) "3") ((and (> % '0.075) (<= % '0.1)) "2") ((> % '0.1) "1") (T "7") ) ) (vla-put-textoverride (car {data}) (strcat "{\\C" c ";" (rtos val 2 3) "\\P}<>")) (vlr-add (cadr {data})) (setq {data} nil) ) ) (princ) ) (defun wp:text:cancelled (reactor params) (vlr-remove reactor) (if {data} (progn (vlr-add (cadr {data})) (setq {data} nil) ) ) (princ) ) ;;; ==== RESTORE REACTOR ASSOCIATION ==== (if (and wp:app (or (tblsearch "APPID" wp:app) (regapp wp:app))) ((lambda (/ ent obj rX dt ss i xtyp xval) (foreach rX (cdar (vlr-reactors :vlr-object-reactor)) (if (and (setq dX (vlr-data rX)) (listp dX) (eq wp:app (car dX)) ) (vlr-remove rX) ) ) (if (setq ss (ssget "_X" (list '(0 . "DIMENSION") (list -3 (list wp:app))))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i))) obj (vlax-ename->vla-object ent) xval (caddr (mapcar 'vlax-variant-value (vlax-safearray->list (progn (vla-getxdata obj wp:app 'xtyp 'xval) xval))))) (vlr-object-reactor (list obj) (list wp:app xval) (list (cons :vlr-modified 'wp:text:callback) (cons :vlr-erased 'wp:erase:callback) ) ) ) ) (if (setq ss (ssget "_X" (list '(0 . "CIRCLE") (list -3 (list wp:app))))) (repeat (setq i (sslength ss)) (setq ent (ssname ss (setq i (1- i))) obj (vlax-ename->vla-object ent) xval (caddr (mapcar 'vlax-variant-value (vlax-safearray->list (progn (vla-getxdata obj wp:app 'xtyp 'xval) xval))))) (vlr-object-reactor (list obj) (list wp:app xval) (list (cons :vlr-erased 'wp:erase:callback) ) ) ) ) )) ) As always, any help/tips/recommendations are greatly appreciated!
  4. I am struggling to put all the pieces together when it comes to using reactors and I was wondering if someone could write me a "simple" (in the sense of being minimal) program that I can study and expand to my fit my needs. In the drawing I've attached, I would need to COPY, MOVE, DELETE, and UNDO any geometry I bring into the staging area. However, the only thing important to me to understanding this is applying those reactors to the threaded hole marked E and propagating them to Plates A & B. I apologize if I am forgetting any needed information and would greatly appreciate any help you can provide. reactor-help.dxf
  5. Hi All, I am experimenting with contextual ribbon menus based on some drawing properties and I am trying to find if it is possible to setup a reactor that will detect when you change drawings either using Switch Windows or clicking on the drawing tab. Any and all input on this issue greatly appreciated :-) Colin Holloway Brisbane, Queensland, Australia.
  6. Lee Chu Chu

    ESC User Input

    Is there anyway to check to see if the user has inputted into the command line and using a lisp, to tell that as soon as the user has pressed esc to not only cancel the command but to also set quantities?
  7. I wrote a sub-routine to update drawing borders. There is a command in CADWorx called IGO which creates isometric drawings. I wanted have this command call my function which updates the borders. But my code doesn't work. (defun c:igo ( / ) (setvar "cmdecho" 0) (command "igo") (setvar "cmdecho" 1) (runisoborderupdate) (princ) )
  8. Hi everyone, I'm making quantity tables from entities in a drawing and I need to add "flagging system" which will alert the user when any kind of modification has been made in a specific layer (I'm talking about the content of the layer = entities, not layer definitions like color and so). I've already looked for many solutions, but it seems that the way to go is to add a reactor to a layer (or to each layer ???) I just started AutoLisp and I'm not feeling ready to dive into reactors w/o being crushed Theoretically I need something like ("myreactor" "catchanychangetocontent" "LayerName") -> return T if there's been a change (like a new entity etc etc) I really need help on this one, Tks !
  9. KrazyMann225

    Reacting to Reactors

    I thinking about dabbling more into Reactors but before I plunge too deep I was wondering if someone would be able to clarify a few things for me. To help explain I will setup an example. I have a reactor set to a line, whenever the line is modified it modifies the two lines offset on each side. With that said I would also like to have the reactor set to be persistent so when i open the drawing the next day I can still have the reactor working. I can have it do that no problem, the problem is that is the callback isn't loaded it gives warnings every time the line is modified. So I guess the question really is, is it possible to have these warnings disabled so if I make this "magic" line then someone else opens the drawing it doesn't "slow" them down with all the warnings.:wink: Sorry for the little novella. Thanks in advance for any assistance.
×
×
  • Create New...