Jump to content

refedit check


mhupp

Recommended Posts

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)) 

 

 

Link to comment
Share on other sites

In bricscad V14, there does not seem to be a variable. I tested with a reactor running vlr-SysvarChanged and nothing showed

  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

3 hours ago, Roy_043 said:

(getvar 'refeditname)

 

Sweet thank you returns the block name if your in refedit mode "" if not.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by mhupp
had to add "if or" and "if and" logic to get rid of errors
  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...