Jump to content

using layer with xline in lisp


nicolas

Recommended Posts

Hi,

I have some difficulty with the following lisp that I just created:

 

(defun c:xv () (command "-layer" "set" "0" "") (command "xline" "ver" pause "") (command "-layer" "previous")

(princ)

)

 

The aim of that lisp is to create vertical xline in layer 0 and then to turn back to the original layer but the last command ("-layer") is entered in the xline command and the "" seemed not to end the command.

 

Could anybody help me on this?

 

Thanks,

 

Regards

Nicolas.

Link to comment
Share on other sites

There is no "previous" option in the -Layer command

you might want to look into using something similar to this

(setq oldlay (getvar "clayer"))
(setvar "clayer" "0")
[i]CODE[/i]
(setvar "clayer" oldlay)

 

If 2006 has Toolpalettes you might want to try dragging an xline onto a toolpalette, you can set the layer under the tool's properties

Link to comment
Share on other sites

Hi,

 

Thank you very much. I have implemented your code in the little xv command and it is working great. However, there is still a little program inasmuch as I can only draw a vertical xline upon calling xv

 

The program is as follows:

 

(defun c:xv () (setq oldlay (getvar "clayer"))

(setvar "clayer" "0") (command "xline" "ver" pause "") (setvar "clayer" oldlay)

 

(princ)

)

 

 

Could there be any other keywords that may have the ideal response rather than using "pause"?

 

Regards,

 

Nicolas

Link to comment
Share on other sites

You ought to post your code with code tags... and get rid of them friggin smilies

http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines

 

get rid of the "ver"

or

(defun c:test (/ oldlay)
(setq oldlay (getvar "clayer"))
(setvar "clayer" "0") 
(command "xline" )
 (while (= 1 (getvar "cmdactive"))
   (command pause))
(setvar "clayer" oldlay)
 (princ)
 )

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