Jump to content

xline to always be red????


MikeP

Recommended Posts

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 comment
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 comment
Share on other sites

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

  • Like 1
Link to comment
Share on other sites

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 comment
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 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...