BrianTFC Posted February 2, 2012 Posted February 2, 2012 Hi all, i need some help with this lisp, i managed to modify it to do a triangle but i don't know what to write to make the 3 line to be a different color or layer. if some one could help i would appreciate it. Thanks, Brian Tab Corner.lsp ;;function (myline mypt1 mypt2 mypt3) draw three lines ;;the first line goes from mypt1 to the y of mypt1 and the x of mypt2 ;;the 2nd line goes from the y of mypt1 and the x of mypt2 to mypt2 ;;the 3nd line goes from the x of mypt2 and the x of mypt2 to mypt1 ;;the function dose not ask for the point so it can be called ;;from other programs (defun myline (mypt1 mypt2 mypt3 / mypt4 acadObject acadDocument mSpace myobject) (setq acadObject (vlax-get-acad-object)) (setq acadDocument (vla-get-ActiveDocument acadObject)) (setq mSpace (vla-get-ModelSpace acadDocument)) ;;set up point three (setq mypt3 (list (car mypt2) (cadr mypt1) (caddr mypt1))) ;;add the first line (setq myobject (vla-addline mspace (vlax-3d-point mypt2) (vlax-3d-point mypt3) ) ;_ end of vla-addline ) ;_ end of setq ;;if you need to set properties such as Layers, Linetypes, and Groups for ;;line one do it here ;;add the 2nd line (setq myobject (vla-addline mspace (vlax-3d-point mypt3) (vlax-3d-point mypt1) ) ;_ end of vla-addline ) ;_ end of setq ;;if you need to set properties such as Layers, Linetypes, and Groups for ;;line two do it here ;;add the 3nd line (setq myobject (vla-addline mspace (vlax-3d-point mypt1) (vlax-3d-point mypt2) ) ;_ end of vla-addline ) ;_ end of setq ;;if you need to set properties such as Layers, Linetypes, and Groups for ;;line three do it here ) ;_ end of defun ;;command tbc ;;Ask for the two line point and call myline (defun c:tbc (/ mypt1 mypt2 mypt3) (setq mypt2 (getpoint "Enter First Point")) (setq mypt1 (getpoint "Enter 2ND Point" mypt2)) (myline mypt1 mypt2 mypt3) ) ;_ end of defun Quote
BIGAL Posted February 2, 2012 Posted February 2, 2012 Maybe just throw a (setvar "clayer" layer3) in to the code before drawing the 3rd line, also why would you not draw lines 1 & 2 in one go rather than have two goes at it ? line pt1 pt2 pt3 "" You can do setvars at any time between commands osnaps on/off, layers, colours, layouttabs, radius Quote
Recommended Posts
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.