最初由 pipi002004 发布
[B]大家帮我看看,为什么我输入3.000后输出为3,
大家有高手的帮我改改。
还有文字,我想把它弄到pipi_文字层上,也帮我改改,谢谢了
******************标高1
(defun C:bg1(/ dx dy dx1 dx2 dx3 dy1 pt dxt dyt
... [/B]  - [FONT=courier new]
- ;;;******************标高1
- (defun C:bg1 (/ dx dy dx1 dx2 dx3 dy1 pt dxt dyt lay pt1 pt2 pt3 pt4 pt5
- ptt scale)
- (setvar "CMDECHO" 0)
- (setvar "DIMZIN" 0) ;保留后续零
- (setq lay (getvar "clayer"))
- (command "color" "bylayer")
- (command "layer" "m" "pipi_标高" "c" "94" "" "")
- (if (or (= nil (tblsearch "style" "pipi_标高"))
- (/= (cdr (assoc 40 (tblsearch "style" "pipi_标高"))) 0)
- )
- (command "STYLE" "pipi_标高" "romanc" "0" "0.75" "0" "n" "n" "n")
- )
- (if (= scab nil)
- (setq scab 1.0)
- )
- (setq scale (getreal (strcat "\nScale <" (rtos scab 2 0) ">:")))
- (if (= scale nil)
- (setq scale scab)
- )
- (setq scab scale)
- (setvar "osmode" 512)
- (setq pt (getpoint "\nInsert point : "))
- (setvar "osmode" 0)
- (setq dy (cadr pt)
- dx (car pt)
- dx1 (- dx (* 3 scale))
- dx2 (+ dx (* 3 scale))
- pt1 (list dx1 dy)
- pt2 (list dx2 dy)
- )
- (command "line" pt1 pt2 "")
- (setq dy1 (+ dy (* 3 scale))
- pt3 (list dx1 dy1)
- )
- (command "line" pt pt3 "")
- (setq pt4 (list dx2 dy1))
- (command "line" pt pt4 "")
- (setq dx3 (+ dx (* 13 scale))
- pt5 (list dx3 dy1)
- )
- (command "line" pt3 pt5 "")
- (setq dxt dx2
- dyt (+ dy1 (* 1.15 scale))
- txt 0
- high (* 3 scale)
- )
- (while (/= txt nil)
- (setq txt (getreal "\nText:"))
- (if (/= txt nil)
- (progn
- (setq ptt (list dxt dyt)
- txt1 (rtos txt 2 3)
- )
- (command "layer" "m" "pipi_文字" "c" "white" "" "")
- (command "text" "s" "pipi_标高" ptt high "0" txt1)
- (setq dyt (+ dyt (* 4.15 scale)))
- )
- )
- )
- (command "layer" "s" lay "")
- (princ)
- )[/FONT]
可以试试“立剖面标高程序”:http://www.xdcad.net/forum/showthread.php?s=&threadid=291466 |