文字旋轉(if cond)
文字旋轉(if cond)
前輩們好~目前針對if函數使用已完成,只是不懂如何使用cond讓文字可以跟著角度選轉為同一方向,且以cond寫入指令無果...還請教前輩們該如何做...
(DEFUN C:CAS0725()
(setq cir 12
cir2 (* cir 0.5)
TT 4
T1 2.5
BC (getpoint "\n START line 1 point:")
BP1 (getpoint BC "\n END line 2 point:")
BP2 (getpoint BP1"\n direction:")
TP1 (getstring "\n Drawing section:")
TP2 (getstring (-)"\n Drawing number:")
)
(setvar "osmode" 0 )
(setq A (cal "ang(BC,BP1,BP2)"))
(setq p1 (cal "Bc+vec1(BP1,BC)*cir2"))
(setq p4 (cal "Bc+vec1(BC,BP1)*cir2"))
(if (> A 180 )
(setq p2 (cal "rot(p1,BC,45)")
p3 (cal "P2-nor(BC,P2)*cir2")
p5 (cal "rot(p4,BC,-45)")
p6 (cal "P5+nor(BC,P5)*cir2"))
(setq p2 (cal "rot(p1,BC,-45)")
p3 (cal "P2+nor(BC,P2)*cir2")
p5 (cal "rot(p4,BC,45)")
p6 (cal "P5-nor(BC,P5)*cir2"))
)
(setq p7 (inters P3 P2 P6 P5 nil))
(SETQ TPC1 (CAL "PLT(BC,P7,1/3)"))
(SETQ TPC2 (CAL "PLT(BC,P7,-1/3)"))
(command "pline" P3 P1 "A" "S" P2 P4 "L" P6 P7 "C")
(setq O (entlast))
(command "LAYER" "M" "MARK" "C" "2" "MARK" "")
(setvar "CECOLOR" "2")
(command "hatch" "P" "solid" "s" O "")
(COMMAND "circle" Bc (* CIR2))
(command "PLINE" p1 p4 "")
(setq v71 (cal "pld(p4,p6,cir2)"))
(setq v72 (cal "pld(v71,bp1,(cir2/3))"))
(setq v73 (cal "pld(v72,bp1,(cir2/3))"))
(setq V2 (cal "pld(BP1,BC,cir2)"))
(setq V1 (cal "pld(BP1,BC,2.5)"))
(if (> A 180)
(setq V5 (cal "BP1+NOR(BP1,BC)*8"))
(setq V5 (cal "BP1-NOR(BP1,BC)*8"))
)
(setq V3 (cal "pld(V2,BC,(cir2/3))"))
(setq V4 (cal "pld(V3,BC,(cir2/3))"))
(command "LINE" p4 v71 "" "LINE" v72 v73 "" "LINE" v4 v3 "" "LINE" v2 bp1 "")
(command "PLINE" v1 bP1 v5 "c")
(command "LAYER" "M" "MARK" "C" "2" "MARK" "")
(setvar "CECOLOR" "2")
(setq O (entlast))
(command "hatch" "P" "solid" "s" O "")
;(princ "step1 n\:")
(command-s "style" "COMPLEX" "COMPLEX" tt "1" "0" "n" "n" "n" "")
(command "text" "J" "MC" TPC1 "0" TP1 "")
(command-s "style" "COMPLEX" "COMPLEX" t1 "1" "0" "n" "n" "n" "")
(command "text" "J" "MC" TPC2 "0" TP2 "")
(PRINC "STEP1 n\:")
(setq way90 (cal "rot(p4,bc,90)")
)
(cond ((and (>= angle 0)(<= angle 90)
((= n1 (cal "rot(bc,P7,10)")))
((= n2 (cal "rot(bc,P7,20)")))
((= n3 (cal "rot(bc,P7,30)")))
((= n4 (cal "rot(bc,P7,40)")))
((= n5 (cal "rot(bc,P7,45)")))
);;;cond
);;;if<90
);;DEFUN
(DEFUN C:CAS0725()
(setq cir 12
cir2 (* cir 0.5)
TT 4
T1 2.5
BC (getpoint "\n START line 1 point:")
BP1 (getpoint BC "\n END line 2 point:")
BP2 (getpoint BP1"\n direction:")
TP1 (getstring "\n Drawing section:")
TP2 (getstring (-)"\n Drawing number:")
)
(setvar "osmode" 0 )
(setq A (cal "ang(BC,BP1,BP2)"))
(setq p1 (cal "Bc+vec1(BP1,BC)*cir2"))
(setq p4 (cal "Bc+vec1(BC,BP1)*cir2"))
(if (> A 180 )
(setq p2 (cal "rot(p1,BC,45)")
p3 (cal "P2-nor(BC,P2)*cir2")
p5 (cal "rot(p4,BC,-45)")
p6 (cal "P5+nor(BC,P5)*cir2"))
(setq p2 (cal "rot(p1,BC,-45)")
p3 (cal "P2+nor(BC,P2)*cir2")
p5 (cal "rot(p4,BC,45)")
p6 (cal "P5-nor(BC,P5)*cir2"))
)
(setq p7 (inters P3 P2 P6 P5 nil))
(SETQ TPC1 (CAL "PLT(BC,P7,1/3)"))
(SETQ TPC2 (CAL "PLT(BC,P7,-1/3)"))
(command "pline" P3 P1 "A" "S" P2 P4 "L" P6 P7 "C")
(setq O (entlast))
(command "LAYER" "M" "MARK" "C" "2" "MARK" "")
(setvar "CECOLOR" "2")
(command "hatch" "P" "solid" "s" O "")
(COMMAND "circle" Bc (* CIR2))
(command "PLINE" p1 p4 "")
(setq v71 (cal "pld(p4,p6,cir2)"))
(setq v72 (cal "pld(v71,bp1,(cir2/3))"))
(setq v73 (cal "pld(v72,bp1,(cir2/3))"))
(setq V2 (cal "pld(BP1,BC,cir2)"))
(setq V1 (cal "pld(BP1,BC,2.5)"))
(if (> A 180)
(setq V5 (cal "BP1+NOR(BP1,BC)*8"))
(setq V5 (cal "BP1-NOR(BP1,BC)*8"))
)
(setq V3 (cal "pld(V2,BC,(cir2/3))"))
(setq V4 (cal "pld(V3,BC,(cir2/3))"))
(command "LINE" p4 v71 "" "LINE" v72 v73 "" "LINE" v4 v3 "" "LINE" v2 bp1 "")
(command "PLINE" v1 bP1 v5 "c")
(command "LAYER" "M" "MARK" "C" "2" "MARK" "")
(setvar "CECOLOR" "2")
(setq O (entlast))
(command "hatch" "P" "solid" "s" O "")
;(princ "step1 n\:")
(command-s "style" "COMPLEX" "COMPLEX" tt "1" "0" "n" "n" "n" "")
(command "text" "J" "MC" TPC1 "0" TP1 "")
(command-s "style" "COMPLEX" "COMPLEX" t1 "1" "0" "n" "n" "n" "")
(command "text" "J" "MC" TPC2 "0" TP2 "")
(PRINC "STEP1 n\:")
(setq way90 (cal "rot(p4,bc,90)")
)
(cond ((and (>= angle 0)(<= angle 90)
((= n1 (cal "rot(bc,P7,10)")))
((= n2 (cal "rot(bc,P7,20)")))
((= n3 (cal "rot(bc,P7,30)")))
((= n4 (cal "rot(bc,P7,40)")))
((= n5 (cal "rot(bc,P7,45)")))
);;;cond
);;;if<90
);;DEFUN
Grace.Hsu- 一般會員
- 文章總數 : 6
年齡 : 34
來自 : 高雄市
職業 : 工程設計
愛好 : 運動
個性 : 直爽
使用年資 : 1
使用版本 : 2015
經驗值 : 943
威望值 : 0
注冊日期 : 2022-05-26
這個論壇的權限:
您 無法 在這個版面回復文章