Jump to content

xline to always be red????


Recommended Posts

how can I set the construction lines to always come out as red. what do I need to enter in the macro in the CUI to do this?

Link to post
Share on other sites

You would have to put your construction lines on a layer (Construction?) that has its layer color set to red as the default.

Link to post
Share on other sites
You would have to put your construction lines on a layer (Construction?) that has its layer color set to red as the default.

 

 

how do I do that?

Link to post
Share on other sites
Lee Mac

You could always use a reactor to automatically switch to the correct layer when you use xline command:

 

(vl-load-com)
(if (not layer:reactor)
 (setq layer:reactor
        (vlr-command-reactor
          nil
          '((:vlr-commandWillstart . sCom)
            (:vlr-commandEnded . eCom)
            (:vlr-commandCancelled . cCom)))))

(or (tblsearch "LAYER" "CONSTRUCTION")
   (vla-put-Color
     (vla-add (vla-get-Layers
                (vla-get-ActiveDocument
                  (vlax-get-acad-object))) "CONSTRUCTION") acRed))

(defun sCom  (Reac Args)
 (setq oldlay (getvar 'CLAYER))
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER "CONSTRUCTION"))
 (princ))

(defun eCom  (Reac Args)
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER oldlay))
 (princ))

(defun cCom  (Reac Args)
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER oldlay))
 (princ))

 

Just put this in your ACADDOC.lsp or Start-up Suite :thumbsup:

 

HTH

 

Lee

Link to post
Share on other sites
Lee Mac

Or, a simpler version to be used - perhaps in a macro button:

 

(or (not (tblsearch "LAYER" "CONSTRUCTION"))
   (setvar "CLAYER" "CONSTRUCTION"))
(command "_xline")
(while (> (getvar "CMDACTIVE") 0)
 (command pause))

Link to post
Share on other sites

this worked just perfect thanks

 

 

You could always use a reactor to automatically switch to the correct layer when you use xline command:

 

(vl-load-com)
(if (not layer:reactor)
 (setq layer:reactor
        (vlr-command-reactor
          nil
          '((:vlr-commandWillstart . sCom)
            (:vlr-commandEnded . eCom)
            (:vlr-commandCancelled . cCom)))))

(or (tblsearch "LAYER" "CONSTRUCTION")
   (vla-put-Color
     (vla-add (vla-get-Layers
                (vla-get-ActiveDocument
                  (vlax-get-acad-object))) "CONSTRUCTION") acRed))

(defun sCom  (Reac Args)
 (setq oldlay (getvar 'CLAYER))
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER "CONSTRUCTION"))
 (princ))

(defun eCom  (Reac Args)
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER oldlay))
 (princ))

(defun cCom  (Reac Args)
 (if (eq "XLINE" (car Args))
   (setvar 'CLAYER oldlay))
 (princ))

Just put this in your ACADDOC.lsp or Start-up Suite :thumbsup:

 

HTH

 

Lee

Link to post
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
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...