+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Apr 2015
    Posts
    16

    Default Multiple lines with user input..

    Registered forum members do not see this ad.

    Hi Guys... can some one help me to develop a lisp...
    I need to draw multiple lines with user input

    Ex. Length, Number of lines, offset size

    also need draw vertical lines both ends 1/16" inside...

    I have attached Image as an example

    Thanks in advance....
    Attached Images

  2. #2
    Super Moderator SLW210's Avatar
    Computer Details
    SLW210's Computer Details
    Operating System:
    Windows 7 PRO 64-bit
    Computer:
    IBM Lenovo
    Motherboard:
    ACPI x64
    CPU:
    Pentium(R) i5 4570 @ 3.2GHz
    RAM:
    8 GB RAM
    Graphics:
    Nvidia Quadro 600 1GB
    Primary Storage:
    300 GB
    Secondary Storage:
    650GB
    Monitor:
    2x ThinkVision 24"
    Discipline
    Multi-disciplinary
    SLW210's Discipline Details
    Occupation
    Design Draftsman
    Discipline
    Multi-disciplinary
    Details
    Mostly do drafting related to manufacturing. From doing site layouts with proposed updates, additions and renovations to be budgeted and submitted for bid, to updating and changing existing drawings to reflect maintenance and repair/revision work done on site.
    Using
    AutoCAD 2018
    Join Date
    May 2007
    Location
    South Florida, USA
    Posts
    11,957

    Default

    I have moved your thread to the AutoLISP, Visual LISP & DCL Forum, please post in the most relevant forum.
    “A narrow mind and a fat head invariably come on the same person” Zig Zigler



  3. #3
    Super Member
    Computer Details
    ronjonp's Computer Details
    Operating System:
    Windows 10
    Using
    AutoCAD 2018
    Join Date
    Apr 2009
    Location
    Colorado
    Posts
    670

    Default

    This sounds like a task for a dynamic block.

  4. #4
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,280

    Default

    Where should be located the base point?

  5. #5
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,154

    Default

    I will try to find, did something like this previously using simple input of 50,4,-25
    50 = length
    4 is number required
    -25 offset is +/- for right/left

    I will keep looking found this same idea.
    Code:
    ; copy multiple objects along x or y axis
    ; use 2x40 etc
    A man who never made mistakes never made anything

  6. #6
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,154

    Default

    Have a look at my post here http://www.cadtutor.net/forum/showth...polyline/page3

    May though just be easier to write from scratch.
    A man who never made mistakes never made anything

  7. #7
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Apr 2015
    Posts
    16

    Default

    0,0 or anywhere it's not critical

  8. #8
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Apr 2015
    Posts
    16

    Default

    Quote Originally Posted by Grrr View Post
    Where should be located the base point?
    0,0 or anywhere it's not critical

  9. #9
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,280

    Default

    Here you go:

    Code:
    (defun C:test ( / p1 p2 off n a d f p )
      (and
        (cond 
          ( (and *MtpLines* (setq p1 (getpoint "\nSpecify base point <new line>: ")))
            (mapcar '(lambda (x) (set x (cdr (assoc x *MtpLines*)))) '(d a))
            (setq p2 (polar p1 (- a (* 0.5 PI)) d))
          )
          (
            (and
              (setq p1 (getpoint "\nSpecify line's length: "))
              (setq p2 (getpoint "\nSpecify line's length: " p1))
            )
          )
        ); cond
        (not (grdraw p1 p2 1 1))
        
        (setq off (cond ( (progn (initget 6) (getdist (strcat "\nSpecify offset " (if (setq off (cdr (assoc 'off *MtpLines*))) (strcat "<" (rtos off 2 15) ">") "") ": "))) ) ( off )))
        (setq n (cond ( (progn (initget 6) (getint (strcat "\nSpecify number of lines " (if (setq n (cdr (assoc 'n *MtpLines*))) (strcat "<" (itoa n) ">") "") ": "))) ) ( n )))
        
        (or a (setq a (+ (angle p1 p2) (* 0.5 PI))))
        (or d (setq d (distance p1 p2)))
        (setq f '((p a d) (entmakex (list '(0 . "LINE") (cons 10 p) (cons 11 (polar p a d))))))
        (setq p p1)
        (progn
          (redraw)
          (repeat n 
            (f p (angle p1 p2) d)
            (setq p (polar p a off))
          )
          (
            '(( / ed pt1 pt2 dst )
              (setq ed 6.)
              (setq pt1 (polar p1 a (- ed)))
              (setq pt2 (polar p2 a (- ed)))
              (setq dst (+ (- (distance p1 p) off) (* 2. ed)))
              (f (polar pt1 (angle p1 p2) ed) a dst )
              (f (polar pt2 (angle p1 p2) (- ed)) a dst )
            )
          )
          (setq *MtpLines* (mapcar '(lambda (x) (cons x (eval x))) '(d a off n)))
        ); progn
      ); and
      (princ)
    ); defun

  10. #10
    Junior Member
    Using
    AutoCAD 2014
    Join Date
    Apr 2015
    Posts
    16

    Default

    Registered forum members do not see this ad.

    Thanks for code...it works some what but it's kind of confusing and does not work as i expected.. can you please change user input as follows and also Define start point to auto @ 0,0 and length going horizontally

    1. Enter total Length of the strip (ex 100")
    2. Enter Vertical offset length (both vertical line at each end) (ex 0.25")
    3. Enter horizontal offset distance (ex 5")
    4. Enter number of lines to offset (ex 10)

    I have attached the example sketch with above values... hope this info is good enough

    Thanks again
    Attached Images

Similar Threads

  1. Multiple user input
    By NoroZorro in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 20th Jun 2016, 08:14 pm
  2. ESC User Input
    By Lee Chu Chu in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 14th Jul 2014, 01:46 am
  3. Looking for user input
    By Skilbride in forum AutoCAD General
    Replies: 13
    Last Post: 23rd May 2011, 08:28 pm
  4. user input
    By salman in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 13th May 2010, 04:33 pm
  5. User Input:
    By tzframpton in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 10th May 2007, 07:12 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