+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 22
  1. #1
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default Searching for a Lisp draws lines in each layer

    Registered forum members do not see this ad.

    Is there a lisp draw a line in each layer and adding a text with the layer name?

    Attached an image showing my request
    Attached Images

  2. #2
    Super Member
    Using
    Architecture 2009
    Join Date
    Apr 2008
    Location
    London, (sunny UK)
    Posts
    686

    Default

    Could do it in vba, or even vb.net if that is acceptable.
    If you specifically want lisp then you will have to wait for someone else.

    Cheers

  3. #3
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Both are ok

    can that file be ocx im trying to avoid loading the macro

    thanx LCE

  4. #4
    Full Member Arch_Eric's Avatar
    Using
    ADT 2006
    Join Date
    May 2008
    Location
    Texas
    Posts
    25

    Default

    Try this...
    Code:
    Code in post below
    Last edited by Arch_Eric; 9th Jun 2008 at 04:31 pm.

  5. #5
    Super Member
    Using
    Architecture 2009
    Join Date
    Apr 2008
    Location
    London, (sunny UK)
    Posts
    686

    Default

    Extract attached zip.
    in acad type -vbarun
    then enter "directory\DrawLays.dvb!DrawLays"
    where directory is the directory to which you extracted the dvb

    Let me know if you have any problems.

    I haven't added any error handling yet so if you cancel it will give an error.

    Cheers
    Last edited by LCE; 9th Jun 2008 at 04:27 pm.

  6. #6
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Arch_Eric

    i didn't get it

    is it an AutoCAD command, or what

  7. #7
    Full Member Arch_Eric's Avatar
    Using
    ADT 2006
    Join Date
    May 2008
    Location
    Texas
    Posts
    25

    Default

    I screwed something up in my code...here's the revised version...
    Code:
    (defun c:layerlegend (/ osm ortho clayer celtype cecolor start-point line-length text-height *error*)
     (defun *error* (msg)
      (setvar "osmode" osm)
      (setvar "orthomode" ortho)
      (setvar "clayer" clayer)
      (setvar "celtype" celtype)
      (setvar "cecolor" cecolor)
      (princ msg)
     )
    
     (defun mfp (pt pa) (list (+ (car pt) (car pa)) (+ (cadr pt) (cadr pa)) (+ (caddr pt) (caddr pa))))
     
     (setq osm (getvar "osmode"))
     (setq ortho (getvar "orthomode"))
     (setq clayer (getvar "clayer"))
     (setq celtype (getvar "celtype"))
     (setq cecolor (getvar "cecolor"))
     (setq start-point (getpoint "\nSelect point to start legend: "))
     (setvar "orthomode" 1)
     (setq line-length (getdist start-point "\nEnter length of line or click end point: "))
     (setq text-height (cdr (assoc 40 (tblsearch "style" (getvar "textstyle")))))
     (setvar "osmode" 0)
     (setvar "clayer" (cdr (assoc 2 (tblnext "Layer" T))))
     (setvar "celtype" "ByLayer")
     (setvar "cecolor" "ByLayer")
     (command "_line" start-point (mfp start-point (list line-length 0 0)) "")
     (command "-text" (mfp start-point (list 0 1 0)) "0" (getvar "clayer"))
     (while (setq layer (tblnext "Layer"))
      (setvar "clayer" (cdr (assoc 2 layer)))
      (setq start-point (mfp start-point (list 0 (- 0 (+ text-height 4)) 0)))
      (command "_line" start-point (mfp start-point (list line-length 0 0)) "")
      (command "-text" (mfp start-point (list 0 1 0)) "0" (getvar "clayer"))
     )
     (setvar "osmode" osm)
     (setvar "orthomode" ortho)
     (setvar "clayer" clayer)
     (setvar "celtype" celtype)
     (setvar "cecolor" cecolor)
    )
    Last edited by Arch_Eric; 9th Jun 2008 at 04:31 pm.

  8. #8
    Full Member Arch_Eric's Avatar
    Using
    ADT 2006
    Join Date
    May 2008
    Location
    Texas
    Posts
    25

    Default

    Code assumes you have a default text height in your style.

  9. #9
    Super Member
    Using
    Architecture 2009
    Join Date
    Apr 2008
    Location
    London, (sunny UK)
    Posts
    686

    Default

    See attached.
    Error handling added with a few other tweaks.
    Last edited by LCE; 10th Jun 2008 at 10:03 am.

  10. #10
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    573

    Default

    Registered forum members do not see this ad.

    Thanx Mr. LCE that what I am locking for.

    Arch_Eric at first Sorry for miss understand, my mother tongue is Arabic
    second thanx for the lisp
    The lisp is OK, but its effected for current layer only not for all layers

Similar Threads

  1. Searching for a lisp replacing two groups of objects
    By asos2000 in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 20th May 2008, 03:18 pm
  2. Lisp for T lines
    By Impala62 in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 18th Jan 2008, 09:55 pm
  3. Selecting lines by colour when on 1 layer
    By khyber in forum AutoCAD Drawing Management & Output
    Replies: 21
    Last Post: 8th Oct 2007, 04:04 pm
  4. lisp for layer vis?
    By Hickoz_bro in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 31st May 2007, 11:30 pm
  5. Layer colors for lines
    By jgarner in forum AutoCAD General
    Replies: 5
    Last Post: 30th Oct 2006, 02:53 pm

Bookmarks

Posting Permissions

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