本帖最后由 yshf 于 2013-5-1 23:15 编辑
剩下的自己去改(注意:没有进行测试过)
- (if (setq file (getfiled "选择文件" "f:\" "dat" 8))
- (progn
- (setq ff (open file "r")
- ptb nil
- )
- (while (setq zfc (read-line ff))
- (setq zfc (vl-string-translate "," " " zfc)
- zfc (read (strcat "(" zfc ")"))
- xh (vl-prin1-to-string (car zfc))
- Bz (vl-prin1-to-string (cadr zfc))
- p0 (list (nth 2 zfc) (nth 3 zfc))
- p1 (mapcar '+ p0 '(-0.38 -0.13))
- p2 (mapcar '+ p0 '( 0.26 -0.24))
- p3 (polar p0 pi 0.02)
- p4 (polar p0 0 0.02)
- bg (rtos (last zfc) 2 3)
- )
- (if (setq jgb (assoc Bz ptb))
- (setq ptb (subst (cons (car jgb) (cons (cons 10 p0) (cdr jgb))) jgb ptb))
- (setq ptb (cons (list Bz (cons 10 p0)) ptb))
- )
- (entmake (list '(0 . "TEXT")
- '(100 . "AcDbEntity") '(100 . "AcDbText")
- '(67 . 0)
- '(8 . "ZDH")
- (cons 10 p1)
- '(40 . 0.2)
- (cons 1 xh)
- )
- )
-
- (entmake (list '(0 . "TEXT")
- '(100 . "AcDbEntity") '(100 . "AcDbText")
- '(67 . 0)
- '(8 . "GCD")
- (cons 10 p2)
- '(40 . 0.4)
- (cons 1 bg)
- )
- )
-
- (entmake (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity") '(100 . "AcDbPolyline")
- '(67 . 0)
- '(8 . "GCD")
- '(90 . 2)
- '(70 . 129)
- '(43 . 0.5)
- '(38 . 0.0)
- '(39 . 0.0)
- (cons 10 p3)
- '(40 . 0.5)
- '(41 . 0.5)
- '(42 . 1.0)
- (cons 10 p4)
- '(40 . 0.5)
- '(41 . 0.5)
- '(42 . 1.0)
- '(210 0.0 0.0 1.0)
- )
- )
- )
- (close ff)
-
- (if ptb
- (progn
- (setq ptb (reverse ptb)
- ptb (mapcar '(lambda(x)(cons (car x) (reverse (cdr x)))) ptb)
- )
- (mapcar '(lambda(x)
- (entmake (append '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline"))
- (cons (cons 90 (length (cdr x))) (cdr x))
- )
- )
- )
- ptb
- )
- )
- )
- )
-
- )
|