Wednesday, August 19, 2009

macro ေတြသံုးက်င့္ရိွလာျပီဆိုရင္ အသစ္ေရးစရာေတြ အမ်ားၾကီးေပၚလာပါတယ္... အဲ့ဒါအတြက္ အခိ်န္ယူျပီးၾကိဳတင္စဥ္းစား လိုက္ စမ္းၾကည့္လိုက္ ေရးလိုက္ လုပ္ႏိုင္ရင္ေတာ့ အင္မတန္ေကာင္းတာေပါ့ခင္ဗ်ာ.. အဲ့ဒိလိုမဟုတ္၀ူး သယ္ရင္း က ခ်န္းခ်န္းလိုပဲ အပ်င္းထူမယ္ဆိုရင္ေတာ့ သူမ်ားေရးျပီးသားေတြသာလိုက္ရွာေပေတာ့... အဲ့လိုရွာရင္လည္း အခ်ိန္မကုန္ေအာင္လို့ဒီေနရာကေနတခ်ိဳ့ကိုတင္ေပးထားပါ့မယ္.. တခ်ိဳ့လိုအပ္ေနတာေတြကိုလည္း ဘယ္လိုပံုစံမ်ိဳးေလးသံုးခ်င္တယ္ ဒီလိုေရးေနတယ္.. error ေတြနဲ့ ေတြ့ေနလို့ ေကာင္းေကာင္းမ run ဘူး ဆိုရင္ ေဆြးေႏြးအကူအညီေတာင္းႏိုင္ပါတယ္....
ေအာက္မွာေဖၚျပေပးထားတာကေတာ့ ဆရာဦးေရာဘတ္တင္ေအး ရဲ့ quick tool ထဲက macro ေလးေတြပဲျဖစ္ပါတယ္..
code ေတြကို copy ကူးျပီး note pad မွာပဲျဖစ္ျဖစ္ ၊ visual lisp editor မွာျဖစ္ျဖစ္ ႏွစ္သက္ရာ အမည္ name.lsp ေလးနဲ့ save လုပ္ျပီး သံုးႏုိင္ပါတယ္.. note pad သံုးရင္ေတာ့ .lsp လိုထည့္ေရးဖို့ မေမ့ပါနဲ့ေနာ္....အမ်ားအက်ိဳးရိွဖို့ ျဖန့္ေ၀တာျဖစ္လို့ (ဆရာဦးေရာဘတ္တင္ေအးကေတာ့စိတ္မဆိုးေလာက္၀ူးထင္ပါရဲ့......)

(defun c:aaa () (command "area") (princ))
(defun c:aa () (command "-array") (princ))
(defun c:bb () (command "box") (princ))
(defun c:cy () (command "cylinder") (princ))
(defun c:da () (command "dimaligned") (princ))
(defun c:dde () (command "dimdec") (princ))
(defun c:dds () (command "dimscale") (princ))
(defun c:dg () (command "dimangular") (princ))
(defun c:di () (command "dimdiameter") (princ))
(defun c:do () (command "dimordinate") (princ))
(defun c:dob () (command "dim" "oblique") (princ))
(defun c:dov () (command "dimoverride") (princ))
(defun c:dr () (command "dimradius") (princ))
(defun c:dv () (command "dimlinear") (princ))
(defun c:ee () (command "extend") (princ))
(defun c:es () (command "edgesurf") (princ))
(defun c:ll () (command "list") (princ))
(defun c:mm () (command "mirror") (princ))
(defun c:r () (command "rotate") (princ))
(defun c:res () (command "revsurf") (princ))
(defun c:rs () (command "rulesurf") (princ))
(defun c:t () (command "trim") (princ))
(defun c:tz () (command "textsize") (princ))
(defun c:ts () (command "tabsurf") (princ))
(defun c:pn () (command "plan") (princ))
(defun c:k () (command "break" pause "f" pause "@") (princ))
(defun c:f () (command "fillet" "r" pause "fillet") (princ))
(defun c:ff () (command "fillet" "r" "0" "fillet") (princ))

(defun c:oc () (command "osnap" "cent") (princ))
(defun c:op () (command "osnap" "perp") (princ))
(defun c:oe () (command "osnap" "endp") (princ))
(defun c:om () (command "osnap" "midp") (princ))
(defun c:oo () (command "osnap" "none") (princ))
(defun c:oq () (command "osnap" "quad") (princ))
(defun c:od () (command "osnap" "node") (princ))
(defun c:os () (command "osnap" "insert") (princ))
(defun c:on () (command "osnap" "nea") (princ))

(defun c:xx () (command "ucs" "x" "90") (princ))
(defun c:yy () (command "ucs" "y" "-90") (princ))
(defun c:u33 () (command "ucs" "3" "end" pause "nea" pause "nea" pause) (princ))
(defun c:u32 () (command "ucs" "3" "end" pause "nea" pause "") (princ))
(defun c:slx () (command "slice" (ssget) "" "0,0,0" "5,0" "0,0,5" "b") (princ))
(defun c:sex () (command "section" (ssget) "" "0,0,0" "5,0" "0,0,5") (princ))
(defun c:sly () (command "slice" (ssget) "" "0,0,0" "0,5" "0,0,5" "b") (princ))
(defun c:sey () (command "section" (ssget) "" "0,0,0" "0,5" "0,0,5") (princ))
(defun c:sxy () (command "slice" (ssget) "" "xy" "" "b") (princ))
(defun c:sl3 () (command "slice" pause "" "end" pause "end" pause "end" pause "b") (princ))
(defun c:uw () (command "ucs" "") (princ))
(defun c:uv () (command "ucs" "v") (princ))
(defun c:uu () (command "ucs" "e") (princ))
(defun c:v2 () (command "ucs" "") (command "vpoint" "r" "225" "35.2644") (princ))
(defun c:v1 () (command "ucs" "") (command "vpoint" "r" "270" "90") (princ))
(defun c:v0 () (command "ucs" "") (command "vpoint" "r" "220" "30") (princ))
(defun c:v-2 () (command "ucs" "") (command "vpoint" "r" "220" "-35.2644") (princ))
(defun c:vv2 () (command "ucs" "") (command "vpoint" "r" "45" "35.2644") (princ))
(defun c:v3 () (command "vpoint" "r" "270" "0") (command "ucs" "v") (princ))
(defun c:vv3 () (command "vpoint" "r" "90" "0") (command "ucs" "v") (princ))
(defun c:v4 () (command "ucs" "") (command "vpoint" "r" "315" "35.2644") (princ))
(defun c:vv4 () (command "ucs" "") (command "vpoint" "r" "135" "35.2644") (princ))
(defun c:vv5 () (command "ucs" "") (command "vpoint" "r" "0" "0") (command "ucs" "v") (princ))
(defun c:v5 () (command "ucs" "") (command "vpoint" "r" "180" "0") (command "ucs" "v") (princ))
(defun c:v10 () (command "ucs" "") (command "vpoint" "r" "225" "10") (princ))
(defun c:v15 () (command "ucs" "") (command "vpoint" "r" "225" "15") (princ))
(defun c:v20 () (command "ucs" "") (command "vpoint" "r" "225" "20") (princ))
(defun c:zz () (command "zoom" "p") (princ))
(defun c:za () (command "zoom" "a") (command "zoom" ".5x") (princ))
(defun c:zx () (command "zoom" ".5x") (princ))
(defun c:pp () (command "pedit" "m" (ssget) "" "y" "j" "" "") (princ))
(defun c:vs () (command "-vports" "si") (princ))
(defun c:vp2 () (command "-vports" "2" "") (princ))
(defun c:ur () (command "ucsicon" "or") (princ))
(defun c:urn () (command "ucsicon" "n") (princ))
(defun c:uo () (command "ucs" "o") (princ))
(defun c:uoe () (command "ucs" "o" "endp") (princ))
(defun c:uoc () (command "ucs" "o" "cen") (princ))
(defun c:uoi () (command "ucs" "o" "int") (princ))
(defun c:uoq () (command "ucs" "o" "qua") (princ))
(defun c:uom () (command "ucs" "o" "mid") (princ))
(defun c:ue () (command "ucs" "o" "end" pause) (princ))
(defun c:e1 () (command "view" "r" "e1") (princ))
(defun c:e2 () (command "view" "r" "e2") (princ))
(defun c:e3 () (command "view" "r" "e3") (princ))
(defun c:e4 () (command "view" "r" "e4") (princ))
(defun c:e5 () (command "view" "r" "e5") (princ))
(defun c:e6 () (command "view" "r" "e6") (princ))
(defun c:e7 () (command "view" "r" "e7") (princ))
(defun c:e8 () (command "view" "r" "e8") (princ))
(defun c:e9 () (command "view" "r" "e9") (princ))
(defun c:vv () (command "view" "s") (princ))
(defun c:bm () (command "blipmode" "on") (princ))
(defun c:cf () (command "chamfer" "d" pause "" "chamfer") (princ))
(defun c:n () (command "pdmode" "3") (command "point") (princ))
(defun c:nn () (command "pdmode" "1") (princ))
(defun c:nm () (command "pdmode" "3") (princ))
(defun c:dn ()
(command "dimcen" "-.1")
(command "dimcenter" pause)
(command "dimcen" ".09")
(princ)
)
(defun c:dx () (command "dimoverride" "dimtix" "on" "") (princ))
(defun c:cc () (command "copy" (ssget) "" "m") (princ))
(defun c:yd1 () (command "chprop" (ssget) "" "la" "d1" "") (princ))
(defun c:yd2 () (command "chprop" (ssget) "" "la" "d2" "") (princ))
(defun c:yd3 () (command "chprop" (ssget) "" "la" "d3" "") (princ))
(defun c:ct () (command "change" (ssget) "" "p" "t") (princ))
(defun c:ce () (command "change" (ssget) "" "p" "e") (princ))
(defun c:sn () (command "snap" "s" "i" ".001") (command "snapmode" 0) (princ))
(defun c:sd () (command "snap" "s" "s" ".001") (command "snapmode" 0) (princ))
(defun c:dp () (command "dview" (ssget) "" "po") (princ))
(defun c:df () (command "dim" "update" (ssget) "" "exit") (princ))
(defun c:dw () (command "dim" "" "n") (princ))
(defun c:lt () (command "linetype" "l" "dashed,hidden,center" "" "") (princ))
(defun c:mh () (command "mview" "h" "on") (princ))
(defun c:u32p () (command "ucs" "3" "end" pause "nea" pause "") (command "plan" "") (princ))
(defun c:u33p ()
(command "ucs" "3" "end" pause "nea" pause "nea" pause)
(command "plan" "")
(princ)
)
(defun c:up () (command "ucs" "") (command "plan" "") (princ))

(defun c:l1 () (command "layer" "m" "1" "c" "1" "" "") (princ))
(defun c:l2 () (command "layer" "m" "2" "c" "2" "" "") (princ))
(defun c:l3 () (command "layer" "m" "3" "c" "3" "" "") (princ))
(defun c:l4 () (command "layer" "m" "4" "c" "4" "" "") (princ))
(defun c:l5 () (command "layer" "m" "5" "c" "5" "" "") (princ))
(defun c:l6 () (command "layer" "m" "6" "c" "6" "" "") (princ))
(defun c:l7 () (command "layer" "m" "7" "c" "7" "" "") (princ))
(defun c:l8 () (command "layer" "m" "8" "c" "8" "" "") (princ))
(defun c:l9 () (command "layer" "m" "9" "c" "9" "" "") (princ))
(defun c:l11 () (command "layer" "m" "11" "c" "11" "" "") (princ))
(defun c:l22 () (command "layer" "m" "22" "c" "41" "" "") (princ))
(defun c:l33 () (command "layer" "m" "33" "c" "114" "" "") (princ))
(defun c:l44 () (command "layer" "m" "44" "c" "135" "" "") (princ))
(defun c:l55 () (command "layer" "m" "55" "c" "171" "" "") (princ))
(defun c:l66 () (command "layer" "m" "66" "c" "203" "" "") (princ))
(defun c:l77 () (command "layer" "m" "77" "c" "7" "" "") (princ))
(defun c:l88 () (command "layer" "m" "88" "c" "7" "" "") (princ))
(defun c:l99 () (command "layer" "m" "99" "c" "7" "" "") (princ))
(defun c:l00 () (command "layer" "m" "00" "c" "7" "" "") (princ))


(defun c:lh1 () (command "layer" "m" "h1" "s" "h1" "c" "8" "" "l" "dashed" "" "") (princ))
(defun c:ld1 () (command "layer" "m" "d1" "s" "d1" "c" "8" "" "") (princ))
(defun c:ld2 () (command "layer" "m" "d2" "s" "d2" "c" "8" "" "") (princ))
(defun c:ld3 () (command "layer" "m" "d3" "s" "d3" "c" "8" "" "") (princ))
(defun c:lc1 () (command "layer" "m" "c1" "s" "c1" "c" "8" "" "l" "center" "" "") (princ))

(defun c:0 () (command "layer" "s" "0" "") (princ))
(defun c:1 () (command "layer" "s" "1" "") (princ))
(defun c:2 () (command "layer" "s" "2" "") (princ))
(defun c:3 () (command "layer" "s" "3" "") (princ))
(defun c:4 () (command "layer" "s" "4" "") (princ))
(defun c:5 () (command "layer" "s" "5" "") (princ))
(defun c:6 () (command "layer" "s" "6" "") (princ))
(defun c:7 () (command "layer" "s" "7" "") (princ))
(defun c:8 () (command "layer" "s" "8" "") (princ))
(defun c:9 () (command "layer" "s" "9" "") (princ))
(defun c:00 () (command "layer" "s" "00" "") (princ))
(defun c:11 () (command "layer" "s" "11" "") (princ))
(defun c:22 () (command "layer" "s" "22" "") (princ))
(defun c:33 () (command "layer" "s" "33" "") (princ))
(defun c:44 () (command "layer" "s" "44" "") (princ))
(defun c:55 () (command "layer" "s" "55" "") (princ))
(defun c:66 () (command "layer" "s" "66" "") (princ))
(defun c:77 () (command "layer" "s" "77" "") (princ))
(defun c:88 () (command "layer" "s" "88" "") (princ))
(defun c:99 () (command "layer" "s" "99" "") (princ))
(defun c:d1 () (command "layer" "s" "d1" "") (princ))
(defun c:d2 () (command "layer" "s" "d2" "") (princ))
(defun c:d3 () (command "layer" "s" "d3" "") (princ))

(defun c:y0 () (command "chprop" (ssget) "" "la" "0" "") (princ))
(defun c:y1 () (command "chprop" (ssget) "" "la" "1" "") (princ))
(defun c:y2 () (command "chprop" (ssget) "" "la" "2" "") (princ))
(defun c:y3 () (command "chprop" (ssget) "" "la" "3" "") (princ))
(defun c:y4 () (command "chprop" (ssget) "" "la" "4" "") (princ))
(defun c:y5 () (command "chprop" (ssget) "" "la" "5" "") (princ))
(defun c:y6 () (command "chprop" (ssget) "" "la" "6" "") (princ))
(defun c:y7 () (command "chprop" (ssget) "" "la" "7" "") (princ))
(defun c:y8 () (command "chprop" (ssget) "" "la" "8" "") (princ))
(defun c:y9 () (command "chprop" (ssget) "" "la" "9" "") (princ))
(defun c:y00 () (command "chprop" (ssget) "" "la" "00" "") (princ))
(defun c:y11 () (command "chprop" (ssget) "" "la" "11" "") (princ))
(defun c:y22 () (command "chprop" (ssget) "" "la" "22" "") (princ))
(defun c:y33 () (command "chprop" (ssget) "" "la" "33" "") (princ))
(defun c:y44 () (command "chprop" (ssget) "" "la" "44" "") (princ))
(defun c:y55 () (command "chprop" (ssget) "" "la" "55" "") (princ))
(defun c:y66 () (command "chprop" (ssget) "" "la" "66" "") (princ))
(defun c:y77 () (command "chprop" (ssget) "" "la" "77" "") (princ))
(defun c:y88 () (command "chprop" (ssget) "" "la" "88" "") (princ))
(defun c:y99 () (command "chprop" (ssget) "" "la" "99" "") (princ))

(defun c:eli () (command "ellipse" "i") (princ))
(defun c:dvee () (command "dimlinear" "end" pause "end" pause pause) (princ))
(defun c:dvep () (command "dimlinear" "end" pause "per" pause pause) (princ))
(defun c:dvmm () (command "dimlinear" "mid" pause "mid" pause pause) (princ))
(defun c:dvem () (command "dimlinear" "end" pause "mid" pause pause) (princ))
(defun c:dcee () (command "osnap" "end") (command "dimcontinue" "end") (princ))
(defun c:dveep () (command "dimlinear" "end" pause "end" pause "per" pause) (princ))
(defun c:daee () (command "dimaligned" "end" pause "end" pause pause) (princ))
(defun c:daeep () (command "dimaligned" "end" pause "end" pause "per" pause) (princ))
(defun c:dvnn () (command "dimlinear" "nea" pause "per" pause pause) (princ))
(defun c:dann () (command "dimaligned" "nea" pause "per" pause pause) (princ))
(defun c:dvei () (command "dimlinear" "end" pause "int" pause pause) (princ))
(defun c:dvec () (command "dimlinear" "end" pause "cen" pause pause) (princ))
(defun c:dvcc () (command "dimlinear" "cen" pause "cen" pause pause) (princ))
(defun c:dvqq () (command "dimlinear" "qua" pause "qua" pause pause) (princ))
(defun c:dveq () (command "dimlinear" "end" pause "qua" pause pause) (princ))
(defun c:ttt () (command "circle" "3p" "tan" pause "tan" pause "tan" pause) (princ))
(defun c:mei () (command "move" (ssget) "" "end" pause "int") (princ))
(defun c:mii () (command "move" (ssget) "" "int" pause "int") (princ))
(defun c:mie () (command "move" (ssget) "" "int" pause "end") (princ))
(defun c:mec () (command "move" (ssget) "" "end" pause "cen") (princ))
(defun c:mee () (command "move" (ssget) "" "end" pause "end") (princ))
(defun c:mep () (command "move" (ssget) "" "end" pause "perp") (princ))
(defun c:mme () (command "move" (ssget) "" "mid" pause "end") (princ))
(defun c:mmm () (command "move" (ssget) "" "mid" pause "mid") (princ))
(defun c:mmi () (command "move" (ssget) "" "mid" pause "int") (princ))
(defun c:mem () (command "move" (ssget) "" "end" pause "mid") (princ))
(defun c:mcm () (command "move" (ssget) "" "cen" pause "mid") (princ))
(defun c:mcc () (command "move" (ssget) "" "cen" pause "cen") (princ))
(defun c:mci () (command "move" (ssget) "" "cen" pause "int") (princ))
(defun c:mce () (command "move" (ssget) "" "cen" pause "end") (princ))

(defun c:lee () (command "line" "end" pause "end" pause "") (princ))
(defun c:ltt () (command "line" "tan" pause "tan" pause "") (princ))
(defun c:let () (command "line" "end" pause "tan" pause "") (princ))
(defun c:le () (command "line" "end" pause) (princ))
(defun c:lm () (command "line" "mid" pause) (princ))
(defun c:lq () (command "line" "qua" pause) (princ))
(defun c:lnt () (command "lengthen" "t") (princ))
(defun c:lnd () (command "lengthen" "de") (princ))
(defun c:lei () (command "line" "end" pause "int" pause "") (princ))
(defun c:ldd () (command "line" "nod" pause "nod" pause "") (princ))
(defun c:lem () (command "line" "end" pause "mid" pause "") (princ))
(defun c:lii () (command "line" "int" pause "int" pause "") (princ))
(defun c:lim () (command "line" "int" pause "mid" pause "") (princ))
(defun c:lip () (command "line" "int" pause "perp" pause "") (princ))
(defun c:lmm () (command "line" "mid" pause "mid" pause "") (princ))
(defun c:lmp () (command "line" "mid" pause "perp" pause "") (princ))
(defun c:lmt () (command "line" "mid" pause "tan" pause "") (princ))
(defun c:lqi () (command "line" "qua" pause "int" pause "") (princ))
(defun c:lqm () (command "line" "qua" pause "mid" pause "") (princ))
(defun c:lqp () (command "line" "qua" pause "perp" pause "") (princ))
(defun c:lqq () (command "line" "qua" pause "qua" pause "") (princ))
(defun c:lcc () (command "line" "cen" pause "cen" pause "") (princ))
(defun c:lpe () (command "line" "perp" pause "end" pause "") (princ))
(defun c:lep () (command "line" "end" pause "per" pause "") (princ))
(defun c:lpi () (command "line" "perp" pause "int" pause "") (princ))
(defun c:lcq () (command "line" "cen" pause "qua" pause "") (princ))
(defun c:lec () (command "line" "end" pause "cen" pause "") (princ))
(defun c:lic () (command "line" "int" pause "cen" pause "") (princ))
(defun c:lmc () (command "line" "mid" pause "cen" pause "") (princ))
(defun c:lmi () (command "line" "mid" pause "int" pause "") (princ))
(defun c:lmq () (command "line" "mid" pause "qua" pause "") (princ))
(defun c:lcn () (command "line" "cen" pause "nea" pause "") (princ))
(defun c:lie () (command "line" "int" pause "end" pause "") (princ))
(defun c:lin () (command "line" "int" pause "nea" pause "") (princ))
(defun c:lme () (command "line" "mid" pause "end" pause "") (princ))
(defun c:lnc () (command "line" "nea" pause "cen" pause "") (princ))
(defun c:lni () (command "line" "nea" pause "int" pause "") (princ))
(defun c:lne () (command "line" "nea" pause "end" pause "") (princ))
(defun c:lnm () (command "line" "nea" pause "mid" pause "") (princ))
(defun c:lnn () (command "line" "nea" pause "nea" pause "") (princ))
(defun c:lnp () (command "line" "nea" pause "per" pause "") (princ))
(defun c:lnq () (command "line" "nea" pause "qua" pause "") (princ))
(defun c:ltc () (command "line" "tan" pause "cen" pause "") (princ))
(defun c:lte () (command "line" "tan" pause "end" pause "") (princ))
(defun c:lii () (command "line" "int" pause "int" pause "") (princ))
(defun c:ltm () (command "line" "tan" pause "mid" pause "") (princ))
(defun c:ltn () (command "line" "tan" pause "nea" pause "") (princ))
(defun c:ltq () (command "line" "tan" pause "qua" pause "") (princ))
(defun c:lmn () (command "line" "mid" pause "nea" pause "") (princ))
(defun c:lqn () (command "line" "qua" pause "nea" pause "") (princ))

(defun c:vr2 ()
(setvar "cmdecho" 0)
(command "id" "end" pause)
(command "vpoint" "r" "225" "35.2644")
(command "ucsicon" "or")
(command "ucs" "o" "@")
(command "rotate" (ssget) "" "0,0,0" "-90")
(command "ucs" "x" "90")
(command "rotate" "p" "" "@" "90")
(command "ucs" "w")
(princ)
)

(defun c:r2 ()
(setvar "cmdecho" 0)
(command "id" "endp" pause)
(command "ucs" "o" "@")
(command "rotate" (ssget) "" "0,0,0" "90")
(command "ucs" "x" "90")
(command "ucs" "y" "-90")
(command "rotate" "p" "" "0,0" "90")
(command "ucs" "w")
(command "vpoint" "r" "270" "90")
(setvar "cmdecho" 1)
(princ)
)
(defun c:r1 ()
(setvar "cmdecho" 0)
(command "id" "endp" pause)
(command "ucs" "o" "@")
(command "ucs" "x" "90")
(command "ucs" "y" "-90")
(command "rotate" (ssget) "" "0,0,0" "90")
(command "ucs" "w")
(command "vpoint" "r" "270" "90")
(setvar "cmdecho" 1)
(princ)
)
(defun c:vr ()
(setvar "cmdecho" 0)
(command "id" "end" pause)
(command "vpoint" "r" "225" "35.2644")
(command "ucsicon" "or")
(command "ucs" "o" "@")
(command "ucs" "x" "90")
(command "ucs" "y" "-90")
(command "rotate" (ssget) "" "@" "-90")
(command "ucs" "w")
(setvar "cmdecho" 1)
(princ)
)
(defun c:cee ()
(setvar "cmdecho" 0)
(setq a (ssget))
(command "osmode" "33")
(command "copy" a "" "m")
(setvar "cmdecho" 1)
(princ)
)
(defun c:dee ()
(command "dist" "endp" pause "endp" pause)
(command "textscr")
(princ)
)
(defun c:dep ()
(command "dist" "endp" pause "per" pause)
(command "textscr")
(princ)
)
(defun c:j () (command "lengthen" "dy") (princ))
(defun c:tit () (command "script" "tt") (princ))
(defun c:tit2 () (command "script" "tt2") (princ))
(defun c:ri () (command "re-init" "31") (princ))
(defun c:pur () (command "purge" "all" "" "n") (princ))
(defun c:srs () (command "-style" "rs" "romans.shx" "" "" "" "" "" "") (princ))
(defun c:srd () (command "-style" "rd" "romand.shx" "" "" "" "" "" "") (princ))
(defun c:srt () (command "-style" "rd" "romant.shx" "" "" "" "" "" "") (princ))
(defun c:sis () (command "-style" "is" "isocp.shx" "" "" "" "" "") (princ))
(defun c:jh () (command "change" (ssget) "" "p" "lt" "hidden" "") (princ))
(defun c:jc () (command "change" (ssget) "" "p" "lt" "center" "") (princ))
(defun c:jd () (command "change" (ssget) "" "p" "lt" "dashed" "") (princ))
(defun c:j1 () (command "change" (ssget) "" "p" "c" "1" "") (princ))
(defun c:j2 () (command "change" (ssget) "" "p" "c" "2" "") (princ))
(defun c:j3 () (command "change" (ssget) "" "p" "c" "3" "") (princ))
(defun c:j4 () (command "change" (ssget) "" "p" "c" "4" "") (princ))
(defun c:j5 () (command "change" (ssget) "" "p" "c" "5" "") (princ))
(defun c:j6 () (command "change" (ssget) "" "p" "c" "6" "") (princ))
(defun c:j7 () (command "change" (ssget) "" "p" "c" "7" "") (princ))
(defun c:j8 () (command "change" (ssget) "" "p" "c" "8" "") (princ))
(defun c:j10 () (command "change" (ssget) "" "p" "c" "10" "") (princ))
(defun c:ld () (command "layout" "d") (princ))
(defun c:lc () (command "layout" "c") (princ))
(defun c:ldl ()
(command "layout" "d" "layout2")
(command "layout" "d" "layout1")
(princ)
)
(defun c:rtb () (command "-toolbar" "render" "") (princ))
(defun c:rtn () (command "-toolbar" "render" "h") (princ))

(defun c:down ()
(command "extrude" "endp" pause "" "@" ".xy" "@" "0,0,0" "")
(princ)
)
(defun c:qt () (command "qtext" "on") (command "regen") (princ))
(defun c:qf () (command "qtext" "off") (command "regen") (princ))
(defun c:sq () (command "polygon" "4" pause "c" pause) (princ))
(defun c:pm () (command "pedit" "m" (ssget) "" "y" "") (princ))
(defun c:lon () (command ".-layer" "on" "*" "") (princ))
(defun c:er ()
(setvar "cmdecho" 0)
(command "layer" "m" "1" "c" "1" "" "")
(command "layer" "m" "2" "c" "2" "" "")
(command "layer" "m" "3" "c" "3" "" "")
(command "layer" "m" "4" "c" "4" "" "")
(command "layer" "m" "5" "c" "5" "" "")
(command "layer" "m" "6" "c" "6" "" "")
(command "layer" "m" "7" "c" "7" "" "")
(command "layer" "m" "8" "c" "8" "" "")
(command "layer" "m" "9" "c" "9" "" "")
(command "layer" "m" "11" "c" "11" "" "")
(command "layer" "m" "22" "c" "41" "" "")
(command "layer" "m" "33" "c" "114" "" "")
(command "layer" "m" "44" "c" "135" "" "")
(command "layer" "m" "55" "c" "171" "" "")
(command "layer" "m" "66" "c" "203" "" "")
(command "layer" "m" "77" "c" "7" "" "")
(command "layer" "m" "88" "c" "7" "" "")
(command "layer" "m" "99" "c" "7" "" "")
(command "layer" "s" "0" "")
(setvar "cmdecho" 1)
(princ)
)
(defun c:mz () (command "move" (ssget) "" "endp" pause ".xy" "@" "0,0,0") (princ))
(defun c:mx () (command "move" (ssget) "" "endp" pause ".yz" "@" "0,0,0") (princ))
(defun c:my () (command "move" (ssget) "" "endp" pause ".xz" "@" "0,0,0") (princ))
(defun c:cz () (command "copy" (ssget) "" "endp" pause ".xy" "@" "0,0,0") (princ))
(defun c:cx () (command "copy" (ssget) "" "endp" pause ".yz" "@" "0,0,0") (princ))
(defun c:cy () (command "copy" (ssget) "" "endp" pause ".xz" "@" "0,0,0") (princ))
(defun c:sz () (command "stretch" (ssget) "" "endp" pause ".xy" "@" "0,0,0") (princ))
(defun c:sx () (command "stretch" (ssget) "" "endp" pause ".yz" "@" "0,0,0") (princ))
(defun c:sy () (command "stretch" (ssget) "" "endp" pause ".xz" "@" "0,0,0") (princ))

(defun c:lz () (command "line" pause ".xy" "@" "0,0,0" "")(princ))
(defun c:lx () (command "line" pause ".yz" "@" "0,0,0" "")(princ))
(defun c:ly () (command "line" pause ".xz" "@" "0,0,0" "")(princ))

;;;Copy and Rotate the object(s).
(defun c:cr ()
(setvar "cmdecho" 0)
(prompt "\nSelect object(s) to copy and rotate:")
(setq aa (ssget))
(if (/= aa nil)
(progn
(setq bb (getpoint "\nPick point for center of rotation"))
(if (/= bb nil)
(progn
(command ".copy" aa "" bb bb)
(prompt "\nRotation angle")
(command ".rotate" "p" "" bb pause)
(command "redraw")
)
(prompt "\nInvalid. Expect 2D or 3D point.")
)
)
(prompt "\nNothing select.")
)
(setvar "cmdecho" 1)
(princ)
)
ခင္မင္ေလးစားလ်က္...
ခ်န္းခ်န္း (mg mine)
(command "..."......) ဆိုျပီး command function ကို သံုးရင္ မၾကာမၾကာ သံုးရေလ့ရိွတဲ့ command function ေတြကေတာ့..
Pause ဆုိလိုရင္းက user ကို specify first point ဆိုျပီးေတာင္းတာမ်ိဳးမွာ user က screen ေပၚမွာ click လုပ္တဲ့အခါမ်ိဳးအတြက္ပါ...
"" ၾကားထဲမွာဘာမွမပါဘဲ double quote ခ်ည္းပဲဆိုရင္ေတာ့ enter ႏွိပ္တယ္ဆိုတဲ့အဓိပၼါယ္ပါ...
(ssget)"" အသံုးျပဳသူမွေနျပီး object ေတြကို select လုပ္ႏိုင္ဖို့အတြက္နဲ့ "" enter ပါ. Pick select သုံးရမယ္ဆိုရင္ေတာ့ pause ကိုပဲသံုးရပါမယ္..
"y" "1.2" စတဲ့ option ေတြ...အတိုင္းအတာေတြ အသံုးျပဳသူမွထည့္ေပးဖို့လိုတဲ့ character ေတြကို double quote ၂ခုၾကားက string
အေနနဲ့ျပရပါတယ္..

ေအာက္က macro ေလးေတြကို လိုက္ဖတ္ၾကည့္ျပီး (run ၾကည့္တာကေတာ့ပိုေကာင္းတာေပါ့ ခင္ဗ်ာ...)
အဓိပၼါယ္ေဖၚၾကည့္ပါ.....(autoLisp တဖိုင္မွာ function ေတြၾကိဳက္သေလာက္ပါ၀င္လို့ရပါတယ္.. ဖိုင္ေတြအမ်ားၾကီးလုပ္ထားဖို့မလိုေတာ့ဘူးေပါ့ခင္ဗ်ာ)
ခ်န္းခ်န္းကိုယ္တိုင္ေရးျပီး ကိုယ္တိုင္သံုးေနက် ခ်န္းခ်န္းရဲ့ လက္နက္ပုန္းတခ်ဳိ့ပါ.... (ဟိဟိ...ေရွာင္ၾက ...ရွားၾကေပေရာ့.....)

(defun c:is () (command "snapstyl" "1") (princ))
(defun c:iss () (command "snapstyl" "0") (princ))
(defun c:dd1 () (command "dispsilh" "1") (princ))
(defun c:ss1 () (command "surftab1" "20") (princ))
(defun c:ss2 () (command "surftab1" "20") (princ))
(defun c:vt () (command "-view" "o" "top") (princ))
(defun c:vl () (command "-view" "o" "left") (princ))
(defun c:vf () (command "-view" "o" "front") (princ))
(defun c:vsw () (command "-view" "_swiso" "") (princ))
(defun c:vne () (command "-view" "_neiso" "") (princ))
(defun c:vnw () (command "-view" "_nwiso" "") (princ))
(defun c:vse () (command "-view" "_seiso" "") (princ))
(defun c:gl () (command "ucs" "left") (princ))
(defun c:gf () (command "ucs" "front") (princ))
(defun c:gw () (command "ucs" "world") (princ))
(defun c:sg () (command "_shademode""g")(princ))
(defun c:s2 () (command "_shademode""2d")(princ))

ခင္မင္ေလးစားလ်က္.....
ခ်န္းခ်န္း(Mg Mine)
ဒါၾကီးကအလုပ္ပိုပါတယ္လို့ေတာ့မထင္ပါနဲ့ေနာ္... (လြယ္လြယ္ေလး aliaseditor သံုးလိုက္မွာေပါ့ လို့လည္း မေတြးပါနဲ့အံုး)
ဒီ mm mirror ဆိုတာက ဥပမာေပးသေဘာမ်ိဳးမို့ပါ....
ဆက္ရေအာင္ေနာ္... တကယ္ေတာ့ programming ဆိုတာ ကြန္ျပဴတာကေန လုပ္ငန္း အစီအစဥ္ အတိုင္းလုပ္ေဆာင္သြားဖို့ ၾကိဳတင္စီစဥ္ထားတာ
မ်ိဳးပါ...

single line ေတြကို poly line ( တြဲဆက္ေနေသာလိုင္း) အျဖစ္ေျပာင္းဖို့ pe (pedit) ဆိုတဲ့ command ကို auto CAD user ေတြအၾကိမ္ၾကိမ္
သံုးဖူးၾကပါလိမ့္မယ္... လုပ္ေဆာင္ရတာေတြကေတာ့..command line ကေန.. pe (enter)... m (enter) (line ေတြကို select လုပ္တယ္ enter)
yes ဆိုတဲ့ option အတြက္ y(enter) join အတြက္ j (enter) ( enter ) (enter) မွာ အဲ့ဒိcommand ျပီးဆံုးပါတယ္..
အဲ့ဒိအစီအစဥ္ကို ေအာက္က macro ေလးမွာ ဒီလို ခ်ေရးလိုက္ပါတယ္...

(defun c:pp () (command ".pedit" "m" (ssget) "" "y" "j" "" "") (princ))

pp လို့ command line မွာရိုက္ရင္..pe (enter) (m (enter)) ..(ssget)ဆိုတာကေတာ့ select လုပ္ဖို့ အတြက္ user ကို ခန ေစာင့္ေပးတာပါ..
user က select လုပ္ျပီးတာနဲ့ y(enter) j (enter) ( enter ) (enter) ကို ကြန္ျပဴတာက လုပ္ေဆာင္ေပးပါလိမ့္မယ္..
လက္ေတြ့ သံုးၾကည့္ရင္ pp (enter) select လုပ္(enter) ဒါပဲႏွိပ္ရတဲ့ အတြက္ အခ်ိန္ေတာ့ save ျဖစ္သြားျပန္ပါျပီ...

ခင္မင္ေလးစားလ်က္...

autoLisp command macro.....!

တကယ္ေတာ့ auto CAD drafting, modeling ပိုင္းမွာ professional တေယာက္ခ်င္းစီဟာ command ေတြကိုသိတာျခင္း အသံုးခ်ႏိုင္တာျခင္းအရမ္းၾကီးမကြာၾကပါ၀ူး ဒါေပမယ့္ macro သံုးေလ့ရိွတဲ့ user ကေတာ့ပံုမွန္ထက္ လြယ္ကူ လ်င္ျမန္စြာ drawing ေတြကို ျပီးစီးေလ့ရိွပါတယ္... ဘာေၾကာင့္လည္းဆိုေတာ့ auto CAD ကိုသံုးျပီး drawing တခုဆြဲေနတုန္းမွာ command line ကေန command ေတြကို အၾကိမ္ၾကိမ္ ရိုက္ႏိွပ္အသံုးခ်ရေလ့ရိွပါတယ္.... တခ်ိဳ့ တခ်ို့ ေသာ မိမိသံုးေနၾက command ေတြဟာ မလိုအပ္ပဲအခ်ိန္ေတြပိုေပးေနရတာမ်ိဳးကို သတိထားမိခ်င္မွထားမိပါလိမ့္မယ္... ေသခ်ာပါတယ္ အဲ့ဒိလိုကိစၥမ်ိဳးရိွေနတာ... တကယ္ေတာ့ခ်န္းခ်န္းက အင္မတန္ညံ့ပါတယ္... ထံုလိုက္တာလည္း လြန္ပါေရာလို့ ခနခန အေျပာခံထိတဲ့သူေတြထဲမွာ ခ်န္းခ်န္းလည္းတေယာက္အပါအ၀င္ေပါ့..(နဲနဲၾကြားထားတာ အထင္ၾကီးေအာင္...ဟိဟိ)
ဒါေပမယ့္ သူသူငါငါ ပံုေတြဆြဲရရင္ေတာ့ ခ်န္းခ်န္းက ျမန္ျမန္ျပီးေလ့ရိွပါတယ္.... (လက္ေတြ့အင္တာဗ်ဴးေျဖတဲ့ အခ်ိန္ေတြဆို ခ်န္းခ်န္းတို့ေပ်ာ္တာေပါ့)
ပံုတပံုအတြက္ mi .. enter ဆိုတဲ့ command ကို အၾကိမ္ ၃၀ အသံုးျပဳရတယ္ဆိုပါေတာ့..
အဲ့ဒိ mi အစား mm ... enter ပဲႏိွပ္ရမယ္ဆိုရင္ အခ်ိန္ စကၠန့္၀က္ေလာက္ေျခြတာျဖစ္ႏိုင္ပါတယ္...တခ်က္ခ်င္းအတြက္မသိသာလွေပမယ့္ စကၠန့္၀က္ေတြေပါင္းမ်ားလာတဲ့အခါ နာရီေတြ ရက္ေတြျဖစ္လာပါတယ္... အဲ့ဒိ mi ကို mm အျဖစ္ေျပာင္းတာမ်ိဳးက ရိုးရွင္းပါတယ္...

auto CAD ရဲ့ visual lisp editor ကေန file အသစ္ေတာင္းျပီး ေအာက္က code ေလးေတြကို ( ctrl+c.... ctrl+v...Cheesy) ကူးေရးပါ...

(defun c:mm () (command ".mirror") (princ))

အဲ့ဒါရဲ့ အဓပၼါယ္ကေတာ့
( program တခုစမယ္...
mm ဆိုတဲ့ function name ကို auto CAD command တခုအျဖစ္သတ္မွတ္ပါတယ္... defun c:mm ()
mirror ဆိုတဲ့ command ကို ေခၚေပးထား (command ".mirror") တကယ္လို့ တစံုတေယာက္က Undefine လုပ္ထားရင္လည္း mirror ကို ေခၚရမယ္.. ( စြတ္ပဲ....)
(princ) အပို return ေတြ မျမင္ရဖို့ပါ...
) ဒါပဲ....

program တခုရဲ့ ဖြဲစည္းပံု အျပည့္အစံုပါပါတယ္....
(defun c:function_name (/)
(do something)
)

ခင္မင္ေလးစားလ်က္...
ခ်န္းခ်န္း
-Integer --> 1, 2, 35, 778 စသည့္ ကိန္းျပည့္မ်ား....
-Real Number--> 0.2, 3.34,.... စသည့္ ဒသမကိန္းမ်ား...
-String --> "Chan Chan" , "Hero",.... စသည့္ စကားတြဲမ်ား...
-List --> (1.2 2.0 6.Cool ကဲ့သို့ေသာ data list မ်ား...list ကို အျမဲတန္း ကြင္း အဖြင့္အပိတ္ထဲမွာထားပါတယ္..(1.2 2.0 6.Coolကေတာ့ (x,y,z) ရဲ့ cordinate list တခုျဖစ္ပါတယ္...
-File Descriptor--> File Descriptorကိုသံုးျပီး ဖိုင္ေတြကို access လုပ္ႏိုင္ပါတယ္...
-Object Name --> <600000014c> auto cad နဲ့ဖန္တီးျဖစ္ေပၚလာသမွ် object ေတြမွာ <600000014c> လို alphanumeric code ကိုယ္စီရိွပါတယ္..အဲ့ဒါကိုသံုးျပီး object ေတြကို access လုပ္ႏိုင္ပါတယ္..
-Selection Set --> object ေတြကို select လုပ္ထားတဲ့ selection အစုပါ...
-Symbol --> point1, dx4,...စသည္
-Subrs --> defun, alert,...ကဲ့သို့ေသာ autolisp ရဲ့ built-in ပါလာတဲ့ function ေတြပါ...
-Atoms --> atoms ဆိုတာကေတာ့ တျခားတန္ဖိုးတခုခု ထပ္ခြဲမထုတ္ႏိုင္တဲ့ အရာပါ... autoLisp မွာ List နဲ့ atoms ဆိုျပီး data class ႏွစ္ခုရိွပါတယ္.
ဥပမာေျပာရရင္ coordinate list တခုမွာ (x,y,z) ဟာ List ပါ.... x ကေတာ့ atoms ျဖစ္ပါတယ္ယ yဟာလည္း atoms တခုပါ...atoms ဟာ numbers ေရာ symbol ေရာ ႏွစ္ခုလံုးျဖစ္ႏိုင္ပါတယ္....

ခင္မင္ေလးစားလ်က္
ခ်န္းခ်န္း(mg mine)
ခ်န္းခ်န္းတို့ auto cad ကို သံုးျပီး visual lisp ကို စတင္ဖို့ auto CAD ရဲ့ visual lisp editor ကေန ဖိုင္ အသစ္တခုဖြင့္..

(defun c:my-first ()
(alert "Hello World!")
(princ)
)

လို့ရိုက္ပါ... file ကို my-first နာမည္နဲ့ save လုပ္ျပီး...runၾကည့္ရေအာင္ေနာ္...

autocad command line မွာ ap လို့ရိုက္ျပီး enter ေခါက္ရင္ loadapplication dialoug box ေပၚပါမယ္..
မိမိဖန္တီးခဲ့တဲ့ my-first.lsp ကိုload လုပ္ျပီး load application dialoug box ကို close လုပ္ပါ..

command line မွာ...my-first လို့ရိုက္ျပီး enter ေခါက္ရင္ ဒီprogram ေလး run သြားတာကို ေတြ့ရပါလိမ့္မယ္...
run သြားတာကို ေတြ့လိုက္ျပီးဆိုတာဟာ... visual lisp programmer တေယာက္ရဲ့ ပထမေျခလွမ္း ဆိုတဲ့အေၾကာင္း ကမၻာၾကီးကို ႏႈတ္ဆတ္လိုက္တာ
လို့ပဲထားပါစို့....
(defun c:my-first ()
(alert "Hello World!")
(princ)
)

ဒါဟာ autolisp program တခုျဖစ္တာေၾကာင့္ လက္သည္းကြင္း အဖြင့္အပိတ္ကို သံုးပါတယ္...
(
အျမဲတန္း လက္သည္းကြင္းဖြင့္ျပီးprogram ကိုစတင္ပါတယ္... ကြင္း အဖြင့္ အပိတ္ဟာမွန္ကန္ရပါတယ္... ကြင္း အပိတ္လိုေနရင္ ျဖစ္ေစ.. အပိတ္ပိုေနရင္ျဖစ္ေစ program အလုပ္မလုပ္ႏိုင္ ပါ၀ူး... ပထမဆံုးစခဲ့တဲ့ ကြင္းကို ပိတ္ျပီးျပီဆိုရင္ function တခုျပီးဆံုးတယ္ဆိုတဲ့အဓိပၼါယ္ကို ေဖၚေဆာင္တာပါပဲ...
defun ဆိုတာက define function ပါ... function တခုအျဖစ္ ေၾကျငာတာပါ...
c: ဆိုတာကေတာ့ auto cad ရဲ့ command line မွာ auto CAD command တခုအေနနဲ့ my-first ဆိုတဲ့ function ကိုသံုးမယ္ဆိုတဲ့အဓိပၼါယ္ပါ..
တကယ္လို့ c: ကို မသံုးခဲ့ရင္ေတာ့ global function တခုဆိုတဲ့ အဓိပၼါယ္သက္ေရာက္ပါတယ္....
(alert "Hello World!") ကေတာ့ expression ပါ.. expression ဟာ function တခုနဲ့ အျမဲစပါတယ္... ဒီမွာေတာ့ alert ဆိုတဲ့ function ကိုသံုးထားပါတယ္ alert ကိုသံုးျခင္းအားျဖင့္ message တခုကို simple dialog box တခုနဲ့ျပႏိုင္မွာျဖစ္ပါတယ္..... double quote ၂ ခုၾကားကရိွတာကေတာ့ string ပါ...
(princ) ကေတာ့ expression ကို return ျပန္ျပီး clean exit ျဖစ္ေစခ်င္လို့ပါ...
) program ျပီးဆံုးပါျပီလို့ ေျကျငာပါတယ္...

autoLisp ရဲ့ template ဟာ

(defun c:function_name (/)
(do something)
)

လို့မွတ္ယူထားႏိုင္ပါတယ္....

ခင္မင္ေလးစားလ်က္..
ခ်န္းခ်န္း(mg mine)
Lisp programming language...ဟာ ၁၉၅၈ မွာစတင္ေပၚေပါက္ခဲ့ပါတယ္...IBM က fortran ကို 1950 မွာစတင္ေဖၚထုတ္ခဲ့တာျဖစ္လို့ သူက ပထမ အေစာဆံုး programming language ဆိုရင္ lisp ဟာ ဒုတိယအေစာဆံုး high-level programming ဘာသာစကားတခုလို့ဆိုႏိုင္ပါတယ္... ဒီဘက္ေခတ္မွာေတာ့ c , vb , java တို့လို ဘာသာစကားေတြထြန္းကားလာတာနဲ့အမွ် lisp ရဲ့ ေနရာလည္း နည္းလာပါတယ္.. ဒါေပမယ့္ artificial intelligence (AI) နဲ့ computer science ဘက္ပိုင္းမွာေတာ့ lisp ကိုလည္းခ်န္ထားခဲ့လို့မျဖစ္ပါဘူး..... lisp ကိုစတင္ခဲ့တဲ့ ရည္ရြယ္ခ်က္ကိုက အတြက္အခ်က္ပိုင္းအတြက္ အဓိကထားခဲ့ပါတယ္.... fortran ကို scientific နဲ့ engineering calculation ပိုင္းအတြက္ လိုပါပဲ...
auto desk က Auto Cad ကိုစတင္ျပီး ၁၉၈၆ auto cad version 2.18 မွာ AutoLisp ကိုစတင္မိတ္ဆတ္ခဲ့ပါတယ္....
autolisp ဟာ XLisp ကို develop လုပ္ျပီးျဖစ္ေပၚလာတာပါ...autodesk က autolisp ကို release 13 (1995) အထိ develop လုပ္ျပီးတဲ့ေနာက္ ဆက္လက္ develop မလုပ္ေတာ့ပါ၀ူး.... autodesk က VitalLisp ကို ၀ယ္ျပီး visual Lisp လို့ နာမည္ေျပာင္းေပး ကာ ၁၉၉၇ release 14 မွာထည့္သြင္းခဲ့ပါတယ္... visual lisp ဆိုတာကေတာ့ autoLisp programming language ကို IDE, debugger, compiler ေတြထည့္ေပါင္းထားတာပါ...

ဆက္လက္ေဖၚျပပါအံုးမည္.....

ခင္မင္ေလးစားလ်က္
ခ်န္းခ်န္း(mg mine)