27 August 2013

How to give the hatch to the particular area by pick the point in AutoLISP or AutoCAD

 Hi friends, in this article I will explain about how to give the hatch to the particular area by pick the point in AutoLISP.. 
First of all open the Visual Lisp Editor in AutoCAD 
Open AutoCAD --- click on Tools --- click on AutoLISP----click on Visual LISP Editor. 
After open the Visual LISP Editor write the following code.
(defun c:pth()
    (setq p1(getpoint "pick the point")
            p2(list (+ (car p1) 10) (cadr p1))
            p3(list (car p2) (+ (cadr p1) 10))
            p4(list (car p1) (cadr p3))
            p5(list (+ (car p1) 5) (+ (cadr p1) 5))
  (command "line" p1 p2 p3 p4 p1 "")
  (command "hatch" "net" 10 "45" "l" "")
  (command "-hatch" p5  "")
In the above program I take four lines and draw lines and make those lines as rectangle. We can’t give hatch to the explode rectangle using the code in the previous article how to give the hatch to the rectangle in AutoLISP and how to give the hatch to the circle in AutoLISP
We have to use the pick point property. For this we have to use the above code.
Save the file as pth.LSP
Then write the below line in the AutoCAD Command prompt. 
Command: (load “pth”)
The output of the above program is as shown in the below figure.

Happy Reading my Blog.

1 comment:

  1. Hello sir,
    I am searching the LISP codes for finding out diameter of a circle by just clicking on it. Please help me.