Results 1 to 6 of 6

Thread: How do make a line in new drawing by lisp?

  1. #1
    Member
    Join Date
    2000-12
    Posts
    3
    Login to Give a bone
    0

    Default How do make a line in new drawing by lisp?

    Hi!
    How do make a line in new drawing by lisp/vlisp code?
    Anyone can help me ? thanks.

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

    Default Re: How do make a line in new drawing by lisp?

    Hi

    Please note I've *moved* this thread from the AutoCAD General Forum to this one as I believe it would be better served here.

    Thanks, Mike

    Forum Moderator

  3. #3
    AUGI Addict sinc's Avatar
    Join Date
    2004-02
    Location
    Colorado
    Posts
    1,986
    Login to Give a bone
    0

    Default Re: How do make a line in new drawing by lisp?

    There are at least three different ways: use "command", use "entmake", or use ActiveX.

    Have you looked in the developer help? Is there something specific that is giving you problems?

  4. #4
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: How do make a line in new drawing by lisp?

    Quote Originally Posted by rliang
    Hi!
    How do make a line in new drawing by lisp/vlisp code?
    Anyone can help me ? thanks.
    There are may way to do this but here are a few.

    Code:
    (defun c:myline1 ()
      (prompt "\nPick points to draw a line.")
      (command "._line" pause pause "")
      (princ)
    )
    (prompt "\nMyLine1 Loaded. Enter MyLine1 to run.")
    (princ)
    
    (defun c:myline2 ()
      (prompt "\nPick points to draw a line.")
      (if (and (setq p1 (getpoint "\nPick the first point."))
               (setq p2 (getpoint p1 "\nPick the second point."))
          )
        (command "._line" p1 p2 "")
      )
      (princ)
    )
    (prompt "\nMyLine2 Loaded. Enter MyLine2 to run.")
    (princ)
    
    
    (defun c:myline3 ()
      (prompt "\nPick points to draw a line.")
      (command "._line") ; lisp is ended with command active
      (princ)
    )
    (prompt "\nMyLine3 Loaded. Enter MyLine3 to run.")
    (princ)
    
    
    (defun c:myline4 ()
      (prompt "\nPick points to draw a line.")
      (command "._line")
      (while (> (getvar "CMDACTIVE") 0)
        (command pause)
      )
      (princ)
    )
    (prompt "\nMyLine4 Loaded. Enter MyLine4 to run.")
    (princ)

  5. #5
    Member
    Join Date
    2000-12
    Posts
    3
    Login to Give a bone
    0

    Default Re: How do make a line in new drawing by lisp?

    Quote Originally Posted by richards.64879
    There are at least three different ways: use "command", use "entmake", or use ActiveX.
    Have you looked in the developer help? Is there something specific that is giving you problems?
    This is my code:

    (defun c:test ()
    (setq docs (vla-get-Documents (vlax-get-acad-object)))
    (setq dwg (vla-item docs "dwg1.dwg"))
    (setq p1 (getpoint "/npick strt point :"))
    (setq p2 (getpoint "/npick end point :"))
    (vla-addline (vla-get-modelspace dwg)(vlax-3d-point p1)(vlax-3d-point p2))
    (princ)
    )

    my problem is :but P1,P2 on current drawing. how can i pick p1 p2 on dwg1?

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: How do make a line in new drawing by lisp?

    You cannot. MDI support in Visual LISP is terrible. You can do this in VBA.

Similar Threads

  1. Replies: 13
    Last Post: 2014-07-01, 02:23 PM
  2. Make an open drawing visible in the drawing editor
    By victorbarrage528662 in forum AutoLISP
    Replies: 2
    Last Post: 2011-02-10, 01:15 AM
  3. Parameter that can Make a Line Change Line Categories
    By Saimon in forum Revit MEP - Families
    Replies: 4
    Last Post: 2010-05-31, 03:18 PM
  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. Make CAD drawing look like a hand drawing
    By neilcheshire in forum AutoCAD General
    Replies: 11
    Last Post: 2006-01-31, 05:36 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
  •