22 June 2012

Offset in the AutoLISP and the AutoCAD


                Hi Friends, in this article I will explain about the offset in the AutoLISP and the AutoCAD.
                First of all open the Visual LISP Editor, I already explained in the previous article how to open Visual LISP Editor in AutoCAD.

               Open the AutoCAD, Write offset or "0"  and press enter. It asks the distance, enter distance after that it will ask point on side to offset select the point then the offset line will draw automatically.if you want to know clearly then follow the below process or see the following image.

Command: l
LINE Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: *Cancel*
Command: offset
Current settings: Erase source=No  Layer=Source  OFFSETGAPTYPE=0
Specify offset distance or [Through/Erase/Layer] <15.0000>: 150
Select object to offset or [Exit/Undo] <Exit>:
Specify point on side to offset or [Exit/Multiple/Undo] <Exit>:
Select object to offset or [Exit/Undo] <Exit>: *Cancel*


Write the below code or Simply Copy and Paste the below code.
(defun c:bd()
  (setq p1(getpoint "\npick the First point: "))
 (setq p2(getpoint "\npick the Second point: "))
  (command "line" p1 p2 "")
  (setq p3(getpoint "\npick the point: "))
  (setq dis 12)
  (command "OFFSET" dis  p1  p3 "")
  )           

In the above program getpoint  is allows the user to select a single point and also to create a point in reference to the total input from the user.

Save the file as DRAWoffset.LSP
Then write the below line in the AutoCAD Command prompt.

Command: (load “Drawoffset”)
Command:DRAWoffset

Then the output will like in the below figure.


No comments:

Post a Comment