Jump to content

Need a LISP function to draw an XLine on a certain layer..


f700es

Recommended Posts

I need a LISP to draw an Xline on a specific layer when I envoke the XL command. I am a total noob on this but is there a way to do this?

TIA

 

Sean

Link to comment
Share on other sites

Ok, maybe help me write one.

 

I know I will use..

(command "xline")

somewhere. I will also set the layer somewhere in the code. Just not sure how or in what order.

Link to comment
Share on other sites

^C^C-la;set;enter layer name;;_xline

 

Sweet! Now can this be envoked from a command or a button? I prefer just typing in a few keys like "XL" and hitting enter.

Thanks

Link to comment
Share on other sites

Put this in your acaddoc.lsp file

(defun c:xl ()
(command "-layer" "s" "LAYERNAME" "")
(command "xline")
);defun

 

This will return you to the original layer (xline behaves a little different)

(defun c:xl (/ p1 p2)
(setq cl (getvar "clayer"))
(command "-layer" "s" "LAYERNAME" "")
(setq p1 (getpoint "Specify a point: ")
       p2 (getpoint "Specify through point: " p1))
(command "xline" p1 p2 "")
(setvar "clayer" cl)
);defun

Link to comment
Share on other sites

  • 2 years later...

I know this is an old thread, but I'm wanting some very similar. An addition to the code to specify the layer according by the axis plane in 3d. This way each of my xl lines are a given color in the given plane

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