Hi friends,
in this article I will explain about how to insert drawing in AutoCAD using
AutoLISP.
First we
know about how to insert drawing in AutoCAD. We use insert command to insert
the drawing.
Enter insert
command and press Enter or Space button. It will
display below popup enter drawing name or browse and select your drawing and
press OK button.
Enter the
below commands in AutoCAD
Command: insert
Command: INSERT
Specify insertion point or
[Basepoint/Scale/X/Y/Z/Rotate]:
|
Now let’s
see how to insert drawing in AutoCAD using AutoLISP.
First of all open the Visual LISP Editor; I
already explained in the previous article how to open Visual LISP Editor in AutoCAD.
Write the below code or Simply Copy and Paste
the below code.
(defun
c:in()
(setq i1(getpoint "Pick the
point"))
(setq i2(list (+ (car i1) 100) (cadr i1)))
(setq i3(list (+ (car i1) 50) (cadr i1)))
(command "line" i1 i2
"")
(command "insert" "gh"
i3 1 1 "")
)
|
Save the
above program as in.LSP .Open the AutoCAD and type the below commands.
Command: (load
"in")
C:IN
Command: in
Pick the point
|
Pick the
point then it will automatically insert the gh.dwg and draw the line
according to your i1 i2 points. The green colored line circle and red colored 1
is the gh.dwg. The output of the above program will like as shown in
the below figure.
No comments:
Post a Comment