本帖最后由 xyp1964 于 2020-11-19 23:30 编辑
;; 先来个伪源码的看看效果
- ;; zttc(总图停车)
- (defun c:zttc (/ ilst ll1 ll2)
- (cmdla0)
- (defun main-pro (/ ss i s1 an w l ss dl dw i num ptn ptn1 ptn2 pt s2 n1 tx)
- (princ "\n选择曲线: ")
- (if (< ang 45)
- (setq an 90
- w (+ leng 0.5)
- l (- wide 1)
- )
- (setq an ang
- w wide
- l leng
- )
- )
- (setq ss (ssget '((0 . "*LINE,ARC,CIRCLE,ELLIPSE")))
- dl (+ l (* w (xyp-TAN (xyp-d2r (- 90 an)))))
- dw (/ w (sin (xyp-d2r an)))
- i -1
- num 0
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (xyp-Group0)
- (setq ptn (xyp-CurveDivDistBetweenPtn s1 dw))
- (foreach ptn1 ptn
- (xyp-MkLaCo "总图停车" 8)
- (foreach pt ptn1
- (setq s2 (xyp-Faxian s1 pt dl))
- (xyp-rotate s2 pt (- an 90))
- )
- (if (= bo1 "1")
- (progn
- (xyp-MkLaCo "总图停车数量" 4)
- (setq pt (xyp-Get-RightPoint (car ptn1) (last ptn1) (* l 0.5))
- n1 (- (length ptn1) 1)
- num (+ n1 num)
- tx (itoa n1)
- s2 (xyp-Text 5 pt tx)
- )
- )
- )
- )
- (xyp-Group1)
- )
- (if (= bo1 "1")
- (progn
- (xyp-Text 5 '(0 0) (strcat "停车数量 = " (itoa num)))
- (xyp-GrreadMove (entlast) '(0 0))
- )
- )
- )
- (setq ll1 '(wide leng ang bo1)
- ll2 '(3. 5. 90. "1")
- )
- (defun ajbcs () (xyp-Multiple-Settile ll1 ll2))
- (xyp-initSet ll1 ll2)
- (setq ilst '(("k0" "" "imagebutton" "-2" "24" "zongtutingche" "(princ)")
- "spacer;"
- ("" "车位参数" ":boxed_column{")
- ("wide" "宽度(W)" "real" "8")
- ("leng" "长度(L)" "real" "8")
- ("ang" "角度(a)" "real" "8")
- "spacer;"
- ("bo1" "标数量" "bool")
- "spacer;"
- "}"
- "spacer;"
- ("jbcs" "缺省参数" "button1" "(ajbcs)")
- "spacer;"
- "ioc"
- )
- )
- (if (= (xyp-Dcl-Init Ilst "【总图停车】" t) 1)
- (main-pro)
- )
- (cmdla1)
- )
|