mhupp Posted June 18, 2021 Posted June 18, 2021 Is their a system variable that I can check for to see if refedit is active. Doesn't seem to respond to ;(while (> (getvar 'cmdactive) 0) (vl-cmdf pause)) Quote
dan20047 Posted June 18, 2021 Posted June 18, 2021 In bricscad V14, there does not seem to be a variable. I tested with a reactor running vlr-SysvarChanged and nothing showed 1 Quote
tombu Posted June 19, 2021 Posted June 19, 2021 To test if REFEDIT is active try: (while (= (getvar "cmdnames") "refedit")(vl-cmdf pause)) 1 Quote
mhupp Posted June 19, 2021 Author Posted June 19, 2021 10 hours ago, tombu said: To test if REFEDIT is active try: (while (= (getvar "cmdnames") "refedit")(vl-cmdf pause)) This didn't seem to work. Quote
mhupp Posted June 19, 2021 Author Posted June 19, 2021 3 hours ago, Roy_043 said: (getvar 'refeditname) Sweet thank you returns the block name if your in refedit mode "" if not. Quote
dan20047 Posted June 19, 2021 Posted June 19, 2021 8 hours ago, Roy_043 said: (getvar 'refeditname) Interesting, in my Bricscad V14 I'm guessing read-only sysvars do not trigger reactors vlr-SysvarWillChange or vlr-SysvarChanged. Quote
mhupp Posted June 20, 2021 Author Posted June 20, 2021 (edited) used this macro that works well if all you want to do is add or remove items from a block. just change the A to an R ;;----------------------------------------------------------------------------;; ;; QUICKLY ADD OBJECTS TO BLOCK (defun C:A2B (/ SS SS1 SS2) (prompt "\nSelect Block") (setq SS (ssget '((0 . "INSERT")))) (foreach blk (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq SS1 (ssadd blk)) (sssetfirst nil SS1) (vl-cmdf "-REFEDIT" "O" "A" "N") (prompt "\nSelect Object to Add to Block") (if (setq SS2 (ssget)) (progn (vl-cmdf "_.Refset" "A" SS2 "") (vl-cmdf "_.Refclose" "S") ) (vl-cmdf "_.Refclose" "S") ) ) ) Wanted to select multiple blocks to cycle thought them like above. But to be able to use multiple commands inside the block to edit it. This is what i have come up with. works kinda backwards, and you have to type the command again once you are done edited the block to switch to the next one on the list. But seems to get the job done. ;;----------------------------------------------------------------------------;; ;; Edit Blocks (defun C:blkedit (/ SS) (if (/= (getvar 'refeditname) "") (vl-cmdf "_.Refclose" "S") ) (if (or (= SS1 nil) (= (sslength SS1) 0)) (progn (prompt "\nSelect Block") (setq SS1 (ssget '((0 . "INSERT")))) ) ) (if (and (/= SS1 nil) (> (sslength SS1) 0)) (progn (setq SS (ssadd (ssname SS1 0))) (sssetfirst nil SS) (vl-cmdf "-REFEDIT" "O" "A" "N") (ssdel (ssname SS1 0) SS1) ) ) (princ) ) Edited June 20, 2021 by mhupp had to add "if or" and "if and" logic to get rid of errors 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.