View Full Version : How do make a line in new drawing by lisp?
rliang
2004-09-10, 12:06 AM
Hi!
How do make a line in new drawing by lisp/vlisp code?
Anyone can help me ? thanks.
Mike.Perry
2004-09-10, 06:53 AM
Hi
Please note I've *moved* this thread from the AutoCAD General (http://forums.augi.com/forumdisplay.php?f=120) Forum to this one as I believe it would be better served here.
Thanks, Mike
Forum Moderator
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?
CAB2k
2004-09-10, 12:41 PM
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.
(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)
rliang
2004-09-13, 11:24 PM
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?
RobertB
2004-09-14, 04:09 AM
You cannot. MDI support in Visual LISP is terrible. You can do this in VBA.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.