Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a reactor that watches xrefs being attached. When one is attached, it looks for a layer that is thawed. If so, then set some other layers to certain settings. I can get the reactor to notice the layer, but I cannot figure out how to detect the layer and execute the layer settings if the detected layer is thawed.
Also, I can't get the layer settings to work. When I plug that part into my reactor it says "; error: AutoCAD command rejected: "CPHCurbCallouts"".
So this is the reactor I have at the moment.
(vl-load-com) (or acDoc (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))) ;;;--------------------------------------------------------------------; ;;; Reactors:Start function (defun Reactors:Start () ;; Command reactors (or *Reactors_Command* (setq *Reactors_Command* (vlr-xref-reactor nil '((:VLR-endAttach . Callback:XRefCurbLayerDetected) (:VLR-endRestore . Callback:XRefCurbLayerDetected))))) (princ)) ;;;--------------------------------------------------------------------; ;;; Callback:XRefAttached function (defun Callback:XRefCurbLayerDetected (rea cmd / cmdName n CurNOMUTT CurCMDEcho) (vlax-for l (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (setq n (strcase (vla-get-name l))) "*X_TEXT_GROUPED_CURB_LABEL") (command "CPHCurbCallouts"))) (princ) ) (princ) ;;;--------------------------------------------------------------------; (Reactors:Start) (princ)
This is the CPHCurbCallouts function that is always loaded and ready to go:
(defun c:CPHCurbCallouts (/ CurNOMUTT CurCMDEcho) (setq CurNOMUTT (getvar "nomutt")) (setq CurCMDEcho (getvar "cmdecho")) (setvar "nomutt" 0) (setvar "cmdecho" 0) (command "-layer" "T" "*X_POINTS_TOPO_EOP,*X_POINTS_TOPO_EOP_FREEZE,*X_POINTS_TOPO_CONCRETE,*X_POINTS_TOPO_CONCRETE_FREEZE,*X_POINTS_TOPO_BOC,*X_POINTS_TOPO_BOC_FREEZE,*X_POINTS_TOPO_FLOWLINE,*X_POINTS_TOPO_FLOWLINE_FREEZE" "F" "*GROUPED_CURB_LABEL" "") (command "regenall") (setvar "nomutt" CurNOMUTT) (setvar "cmdecho" CurCMDEcho) (print "All curb callouts are now shown.") (princ) )
Any help would be very much appreciated.
Archie Dodge
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
Applications Expert - Infrastructure Solutions Division
IMAGINiT Technologies
Solved! Go to Solution.