-
Notifications
You must be signed in to change notification settings - Fork 0
/
ptexport.lsp
55 lines (54 loc) · 1.67 KB
/
ptexport.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
(defun c:ptexport ()
(setq sset (ssget '((-4 . "<OR")(0 . "POINT")
(0 . "LWPOLYLINE")(-4 . "OR>"))))
(if sset
(progn
(setq itm 0 num (sslength sset))
(setq fn (getfiled "Point Export File" "" "txt" 1))
(if (/= fn nil)
(progn
(setq fh (open fn "w"))
(while (< itm num)
(setq hnd (ssname sset itm))
(setq ent (entget hnd))
(setq obj (cdr (assoc 0 ent)))
(cond
((= obj "POINT")
(setq pnt (cdr (assoc 10 ent)))
(setq pnt (trans pnt 0 1));;**CAB
(princ (strcat (rtos (car pnt) 2 8) ","
(rtos (cadr pnt) 2 8) ","
(rtos (caddr pnt) 2 8)) fh)
(princ "\n" fh)
)
((= obj "LWPOLYLINE")
(if (= (cdr (assoc 38 ent)) nil)
(setq elv 0.0)
(setq elv (cdr (assoc 38 ent)))
)
(foreach rec ent
(if (= (car rec) 10)
(progn
(setq pnt (cdr rec))
(setq pnt (trans pnt 0 1));;**CAB
(princ (strcat (rtos (car pnt) 2 8) ","
(rtos (cadr pnt) 2 8) ","
(rtos elv 2 8)) fh)
(princ "\n" fh)
)
)
)
)
(t nil)
)
(setq itm (1+ itm))
)
(close fh)
)
)
)
)
(princ)
)
(princ "\nPoint Export loaded, type PTEXPORT to run.")
(princ)