Results 1 to 2 of 2

Thread: Add layer command line to a lisp routine

  1. #1
    Member
    Join Date
    2012-01
    Posts
    11
    Login to Give a bone
    0

    Default Add layer command line to a lisp routine

    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

    Code:
    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

  2. #2
    Woo! Hoo! my 1st post
    Join Date
    2012-02
    Posts
    1
    Login to Give a bone
    0

    Default Re: Add layer command line to a lisp routine

    Code:
    (setq myobject (vla-addline      mspace      (vlax-3d-point mypt2)      (vlax-3d-point mypt3) ) ;_ end of vla-addline ) ;_ end of setq
    (vlax-put-property myobject 'Color 1)
    ;;This line above will add color 1 to the myobject the same way you can set the layers and linetypes.
    Last edited by rkmcswain; 2012-12-05 at 03:05 PM. Reason: added [CODE] tags

Similar Threads

  1. Replies: 3
    Last Post: 2014-04-04, 08:17 PM
  2. Help with a lisp routine to add a 12" line to this routine
    By Orbytal.edge341183 in forum AutoLISP
    Replies: 3
    Last Post: 2012-11-14, 10:33 PM
  3. Replies: 6
    Last Post: 2007-04-23, 01:40 AM
  4. Lisp routine to list line length and line ID
    By hlecates in forum AutoLISP
    Replies: 6
    Last Post: 2007-03-21, 04:03 PM
  5. Replies: 4
    Last Post: 2006-05-09, 08:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •