8 May 2012

how to give the hatch to the rectangle in autolisp. | Hatch in autolisp |Give hatch to rectangle in autolisp

   Hi friends ,in this article i will explain about how to give the hatch to the circle in autolisp.

In previous article i explained about how to give the hatch to the circle 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:col_rec()
(command "setvar" "cmdecho" "0")
(command "blipmode" "off")
(command "layer" "n" "hatch" "c" "magenta" "hatch" "")
(command "layer" "n" "column" "c" "red" "column" "s" "column" "")
(setq p1 (getpoint "\nPick bottom left point"))
(setq lenth (getstring "\nEnter the length of column in [ X-dir ]:"))(setq width (getstring "\nEnter the width of column [ Y-dir ]:"))
(command "pline" p1 (strcat "@" lenth "<0") (strcat "@" width "<90") (strcat "@" lenth "<180") (strcat "@" width "<270") "c")
(command "layer" "s" "hatch" "")
(if (> (distof lenth) 100)
  (command "hatch" "net" "15" "45" "l" "")
  (command "hatch" "net" "0.5" "45" "l" "")

Save the file as col_rec.LSP
Goto In the c:col_rec() shows the main function in this file.
Goto AutoCAD.in the command  prompt write the following.

Command: (load “col_rec”) 

Press ENTER.
This shows that load the col_rec.LSP file.
Type col_cir and press ENTER the output like the below figure.

Happy Reading.............

No comments:

Post a Comment