-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPoly_Hatch.lsp
63 lines (62 loc) · 2.12 KB
/
Poly_Hatch.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;------------------------------------------------------------------------
; Script to find and hatch all closed polylines within a selection
; and specific layers to depict how actual mask will look like.
; - First input is the layers name seperated by ","
; - Second input is making the selection
; -Hit the Enter/Space to see the result
;
; Developed by Vahid Ganjalizadeh April, 2017
;------------------------------------------------------------------------
(defun C:POLYHATCH ()
(command)
(vlax-for lyr
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(setq lays (cons (vla-get-name lyr) table))
)
(princ "Available layers: ")
(princ lays)
(princ "\n")
(setq sellays (getstring "Input layers as lay1,lay2,... : "))
(setq lay1 (cons 8 sellays))
; (setq filters (list (0 . "*POLYLINE") lay1 (70 . 1)))
; (print filters)
; (print '((0 . "*POLYLINE") (70 . 1)))
; (print (list (8 . lay1) (70 . 1)))
(if (= sellays "all")
(progn
(setq sel1 (ssget (list (cons 0 "*POLYLINE") (cons 70 1))))
)
(setq sel1 (ssget (list (cons 0 "*POLYLINE") lay1 (cons 70 1))))
)
(setq i 0)
(setq t 0)
(repeat (sslength sel1) ;loop for every entity in the set
(setq en (ssname sel1 i)) ;get entity name
(print en)
(setq ent (ssadd))
(ssadd en ent)
; (setq ed (entget en)) ;get entity definition
; (command "._-HATCH" "s" sel1 "" "Properties" "Solid" "Advanced" "Island" "No" "Nearest" "Style" "Ignore" "Gap" 0.0 "" "")
(command "._-HATCH" "s" ent "" "Properties" "Solid" "Advanced" "Island" "No" "Nearest" "Style" "Ignore" "Gap" 0.0 "" "")
(setq htch (ssget "L"))
(if (= t 0)
(progn
(setq t 1)
(setq htch_g (getstring "Enter a name to create a hatch group: "))
(command "_.-GROUP" "Create" htch_g "" htch "")
)
(progn
(command "_.-GROUP" "Add" htch_g htch "")
)
)
; (command "._-HATCH" "s" sel1 "" "Properties" "Solid" "Advanced" "Island" "Yes" "Style" "Normal" "Gap" 0.0 "" "")
(setq i (+ i 1)) ;increment the counter
(redraw)
)
(princ)
(print "Finished!")
)