本帖最后由 ZZXXQQ 于 2015-4-16 15:32 编辑
 - (defun C:tt()
- (setvar "CMDECHO" 0)
- (command "-layer" "m" "S3-BEAM-IDEN-HORT" "c" 21 "" "")
- (setq r1 (getvar "userr1"))
- (setq k1 (* 250 (/ r1 100)))
- (setq k2 (* 200 (/ r1 100)))
- (if (or (= str nil) (= (wcmatch str "*.*") nil)) (setq str "200.400"))
- (if (= SDQ nil) (setq SDQ "C" DQWZ "居中"))
- (setq stt str)
- (setq TFF 0)
- (while (= TFF 0)
- (if (or (= str nil) (= (wcmatch str "*.*") nil)) (setq str "200.400"))
- (setq stt str)
- (setq str (getstring (strcat "\n输入梁截面(*.*)or[上对齐(F)/居中(C)/下对齐(B)]当前{" DQWZ "}:<" stt ">:")))
- (if (= str "")
- (setq str stt)
- (if (not(wcmatch str "*.*"))
- (setq SDQ (strcase str) DQWZ (if (= SDQ "F") "上对齐" (if (= SDQ "C") "居中" "下对齐")))
- )
- )
- (if (wcmatch str "*.*") (progn
- (setq TFF 1)
- (setq LKK (SB_LJM str 1))
- (setq LGG (SB_LJM str 2))
- (while (and (setq pc1 (getpoint "\n请输入第一点:"))
- (setq pc2 (getpoint pc1 "\n请输入第二点:")))
- (setvar "CLAYER" "S0-BEAM1")
- (setq jd0 (angle pc1 pc2))
- (setq j0 (angtos jd0 0 20))
- (setq jd1 (+ jd0 (/ pi 2)))
- (setq pz2 (mapcar '+ pc1 pc2))
- (setq pzd (mapcar '(lambda (x) (/ x 2)) pz2) )
- (if (= DQWZ "上对齐") (setq lks 0 ))
- (if (= DQWZ "居中") (setq lks 0.5))
- (if (= DQWZ "下对齐") (setq lks 1))
- (setq k3 (+ (* LKK lks) k2))
- (setq px1 (polar pzd jd1 k3))
- (setvar "clayer" "S3-BEAM-IDEN-HORT")
- (command "text" "style" "GB" "MC" px1 k1 j0 sts)
- ; (command "text" "MC" px1 k1 j0 sts)
- (if (= SDQ "F") (progn
- (setq TFF 0)
- (command "line" pc1 pc2 "")
- (setq pt1 (polar pc1 (+ jd0 (* 1.5 pi)) LKK))
- (setq pt2 (polar pc2 (+ jd0 (* 1.5 pi)) LKK))
- (command "line" pt1 pt2 "")
- ))
- (if (= SDQ "C") (progn
- (setq TFF 0)
- (setq l1 (/ LKK 2))
- (setq pt1 (polar pc1 (+ jd0 (* 1.5 pi)) l1))
- (setq pt2 (polar pc2 (+ jd0 (* 1.5 pi)) l1))
- (command "line" pt1 pt2 "")
- (setq pt3 (polar pc1 (+ jd0 (* 0.5 pi)) l1))
- (setq pt4 (polar pc2 (+ jd0 (* 0.5 pi)) l1))
- (command "line" pt3 pt4 "")
- ))
- (if (= SDQ "B") (progn
- (setq TFF 0)
- (command "line" pc1 pc2 "")
- (setq pt1 (polar pc1 (+ jd0 (* 0.5 pi)) LKK))
- (setq pt2 (polar pc2 (+ jd0 (* 0.5 pi)) LKK))
- (command "line" pt1 pt2 "")
- ))
- )
- ))
- )
- (princ)
- )
- ;;;(x)梁截面识别
- (defun SB_LJM(LJM pr)
- (VL-LOAD-COM)
- (setq LKST "")
- (setq LGST "")
- (setq LJMN (strlen LJM))
- (if (wcmatch LJM "*.*") (progn
- (setq XDWZ (vl-string-search "." LJM)) ;;;小数点位置
- (setq LKFF (atof (substr LJM 1 XDWZ))) ;;;梁宽实数
- (setq LGFF (atof (substr LJM (+ XDWZ 2))));;;梁高实数
- ))
- (if (= pr 1)
- (setq LKLG LKFF)
- (setq LKLG LGFF)
- )
- LKLG
- )
|