-
Notifications
You must be signed in to change notification settings - Fork 0
/
pb.lsp
48 lines (46 loc) · 1.21 KB
/
pb.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
;polyline build
(defun c:pb(/ newset ss cn ent entn max)
(setvar "cmdecho" 0)
(setvar "highlight" 0)
(setq ss (ssget))
(command "._Select" ss "")
(setq ss (ssget "P" '( (-4 . "<OR")
(0 . "*POLYLINE")
(0 . "LINE")
(0 . "ARC")
(-4 . "OR>")
)
) )
(if (= ss nil)
(princ "Nothing to do.")
(progn
(setq max (sslength ss) cn 0)
(repeat max
(princ (strcat "\r" (rtos (* 100.0 (/ cn 1.0 max)) 2 0) " % Done "))
(setq entn (ssname ss cn))
(setq cn (1+ cn))
(setq ent (entget entn))
(if ent
(progn
(cond
((or (= (cdr (assoc 0 ent)) "LINE")
(= (cdr (assoc 0 ent)) "ARC")
)
(command "._Pedit" entn "Yes" "Join" ss "" "")
)
((/= (rem (cdr (assoc 70 ent)) 2) 1)
(command "._Pedit" entn "Join" ss "" "")
)
)
)
)
)
)
)
(setvar "cmdecho" 1)
(setvar "highlight" 1)
(princ)
)
(defun tk_r2d(a)
(* a (/ 180.0 PI))
)