bhatch

how do I add hatch to closed polyline in AutoLISP?

here is the program I use for making polyline, how should it be modified to add solid hatch to every object?:

;|requires data file in the format of: objectnumber, x-coordinate,y-coordinate" Example:

1,2117.42899999954,-2147.81300000008 1,2150.03500000015,-2165.32400000002 1,2167.15799999982,-2143.45299999975 1,2160.74000000022,-2134.02300000004 1,2122.4879999999,-2111.14400000032 1,2105.6129999999,-2140.65000000037 1,2108.7790000001,-2142.45999999996 2,1486.67200000025,-2271.01699999999 2,1489.32699999958,-2274.32400000002 2,1480.68499999959,-2280.36199999973

by Jeff Mishler March 11, 2006 |; (defun c:data2plines (/ dat dat_list ffile fname idx master tmp mspace coords pline) ;;Str2List function by John Uhden as posted to the Adesk newsgroups (defun Str2List (str pat / i j n lst) (cond ((/= (type str) (type pat) 'STR)) ((= str pat) '("")) (T (setq i 0 n (strlen pat) ) (while (setq j (vl-string-search pat str i)) (setq lst (cons (substr str (1+ i) (- j i)) lst) i (+ j n) ) ) (reverse (cons (substr str (1+ i)) lst)) ) ) ) (if (setq fname (getfiled "Data File Selection" "" "" 0)) (progn (vl-load-com) (setq ffile (open fname "R")) (while (setq dat (read-line ffile)) (setq dat_list (str2list dat ",")) (setq master (cons (list (atoi (car dat_list)) (atof (cadr dat_list)) (atof (caddr dat_list)) ) master)) ) (close ffile) (setq master (reverse master) mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setvar "osmode" 0) (while master (setq idx (car (car master)) coords nil) (setq tmp (vl-remove-if-not '(lambda (x) (= (car x) idx) ) master)) (setq coords (apply 'append (mapcar 'cdr tmp))) (setq pline (vlax-invoke mspace 'addlightweightpolyline coords)) (vla-put-closed pline :vlax-false) (setq master (vl-remove-if '(lambda (x) (= (car x) idx) ) master) ) ) (vla-zoomextents (vlax-get-acad-object)) ) ) (princ) )

Reply to
orange
Loading thread data ...

You're in the wrong group.... Goto discussion.autodesk.com add autodesk.autocad.customization

Reply to
BRAK!!!

If you could use a simple command call to the command line version of BHATCH, use the "select" option, and feed it a point that you extract from the list of vertices in the data list for the PLINE.

Reply to
Michael Bulatovich

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.