Results 1 to 4 of 4

Thread: Looking for a LISP routine to draw a ZigZag line that is a 2 inch wide Polyline

  1. #1
    Member
    Join Date
    2005-02
    Posts
    46
    Login to Give a bone
    0

    Default Looking for a LISP routine to draw a ZigZag line that is a 2 inch wide Polyline

    I am looking for a lisp routine that will draw a zigzag line that is a 2" polyline. It needs to be two inches thick no matter what the scale. I would like to use for single line flex. I am posting my flex routine below if you would like to use it. this routine draw a single line and then splines it, you then have the option to touch it and turn it into double line flex. I would like the single line to draw the zigzag and then have the option to go double line after that. You can make any block you like for you double line flex. This routine was written by Joe Healy about 10 years ago and still works great. Thanks for any help.

    Code:
    ;routine to draw FLEX ONLY FLEXONLY.LSP
    (defun c:FLEX2 ()
     (setq CLAY (getvar "clayer")
           ss1 (ssadd)
         )
    (setq SIZET (ureal 1 "" "Enter flex size" SIZET))
    
    
    (cond 
    ((= SIZET 6.0)  (setq DSIZE   "J6"))
    ((= SIZET 8.0)  (setq DSIZE   "J8"))
    ((= SIZET 10.0)(setq DSIZE "J10"))
    ((= SIZET 12.0)(setq DSIZE "J12"))
    ((= SIZET 14.0)(setq DSIZE "J14"))
    ((= SIZET 16.0)(setq DSIZE "J16"))
    ((= SIZET  18.0)(setq DSIZE "J18"))
    (T nil)
    )
    
    
    
     (command "layer" "m" "M-DUCT-FLEX" "c" "12" "" "")
    
       (initget 1)
       (setq PT1 (getpoint "\nFrom point: "))
       (setq PTb pt1)
    
       (while (/= nil (setq PT2 (getpoint PT1 "\nTo point: ")))
      (command "line" PT1 PT2 "")
       ;   (IF (/= NIL PT1) (SETQ PTB PT1))
      (setq ss1 (ssadd (cdr (assoc -1 (entget (entlast)))) ss1)
       PT1 PT2
      )
    
        )
    (flatten ss1)
    (command "pedit" "l" "y" "j" ss1 "" "s" "lt" "on" "")
    (setq enjunk (entlast))
    (command "measure" pAUSE "b" dsize "y" "3.5")
    (command "erase" enjunk "")
    (command "layer" "s" CLAY "")
    (princ)
    );
    (defun flatten (lss)
       (setq hite (getvar "elevation")
        flatcnt 0)
       (repeat (sslength lss)
         (setq len (entget (ssname lss flatcnt))
          ose (caddr (cdr (assoc 10 len)))
          oee (caddr (cdr (assoc 11 len)))
          nsp (subst hite ose (cdr (assoc 10 len)))
          nep (subst hite oee (cdr (assoc 11 len)))
          len (subst (cons 10 nsp) (assoc 10 len) len)
          len (subst (cons 11 nep) (assoc 11 len) len)
          );setq
          (entmod len)
          (setq flatcnt (1+ flatcnt))
       );repeat
    (princ)
     );defun flat
    [ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]
    Last edited by Mike.Perry; 2007-05-23 at 04:54 AM. Reason: [CODE] tags added.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Lightbulb Re: Looking for a LISP routine to draw a ZigZag line that is a 2 inch wide Polyline

    Quote Originally Posted by gab.83408
    I am looking for a lisp routine that will draw a zigzag line that is a 2" polyline. It needs to be two inches thick no matter what the scale.
    Define the "zig-zag". What is the ratio of the width of the "zig-zag" compared to it's length?
    Do you mean something like the attached?
    Attached Images Attached Images
    R.K. McSwain | CAD Panacea |

  3. #3
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Looking for a LISP routine to draw a ZigZag line that is a 2 inch wide Polyline

    Hi "gab.83408"

    Please note I have *moved* this thread from the AutoCAD Customization forum to this one, as I believe it will be better served here.

    Thanks, Mike

    Forum Manager

  4. #4
    Certifiable AUGI Addict ccowgill's Avatar
    Join Date
    2004-08
    Location
    Iron Station, NC
    Posts
    3,198
    Login to Give a bone
    0

    Default Re: Looking for a LISP routine to draw a ZigZag line that is a 2 inch wide Polyline

    I see 2 options, edit a color in your pen table for width of 2" and apply it to the layer, then draw the polyline with no width. or add to the wishlist to have polyline width part of annotative scaling.

    or I guess there is a 3rd option, do both of the above

Similar Threads

  1. Replies: 3
    Last Post: 2015-01-23, 12:29 AM
  2. Replies: 3
    Last Post: 2014-04-04, 08:17 PM
  3. LISP to draw polyline with specified segment length
    By bhughes.211978 in forum AutoLISP
    Replies: 8
    Last Post: 2010-08-31, 09:45 PM
  4. Replies: 5
    Last Post: 2009-02-26, 07:40 PM
  5. Is it possible to draw attached image via a LISP routine?
    By BRENDA_GZZ_GOMEZ in forum AutoLISP
    Replies: 6
    Last Post: 2007-04-16, 09:00 PM

Posting Permissions

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