PDA

View Full Version : AutoCAD နဲ႔ Programming



papagyi
11-28-2008, 02:32 PM
Autocad မွာ programing language တစ္မ်ိဳးမက run နိုင္ပါတယ္။..Visual , C ++...စသျဖင့္ေပါ့။
ဘယ္လိုပဲျဖစ္ျဖစ္ autocad user စစ္တစ္ေယာက္အတြက္ကေတာ့ အက်ိဳးရွိဆံုးကေတာ့ Lisp programing ေပၚအေျခခံတဲ႕
Autolisp programing ပါ။..ကၽြန္ေတာ္တို႕သံုးေနတဲ႕ autocad command ေတြက autolisp နဲ႕ပဲေရးျပီး
လုပ္ထားတဲ႕ edit လုပ္လို႕ရတဲ႕ .lisp file ေတြ၊ autolisp file ကို edit လုပ္ခြင့္မရေအာင္ complied လုပ္ထားတဲ႕
.fas file ေတြနဲ႕ run ေနတာအမ်ားဆံုးပါ။ဒါေၾကာင့္ autolisp programing ရဲ႕ တစ္စိတ္ပိုင္း ျဖစ္တဲ႕
Micro lisp အတိုေလးေတြ စေရးဖို႕ၾကိဳးစားသင့္ပါတယ္။လုပ္ငန္းခြင္မွာ မ်ားစြာ အေထာက္အကူျဖစ္ပါလိမ့္မယ္။
ေလ့လာၾကည့္ၾကပါလို႕ပဲ တိုက္တြန္းလိုက္ပါတယ္။

saiaung
12-07-2008, 07:45 PM
AutoCAD နဲ႔ ဖြင္႔လို႔ရတဲ႔ DXF ဖုိင္ကုိ c++ နဲ႔ ဘယ္လိုေရးတယ္ ဘာေၾကာင္႔ ေရးတယ္... ဆုိတာ ဝင္ေရာက္ေဆြးေႏြးေပးေစလိုပါတယ္.....

papagyi
12-07-2008, 11:09 PM
က်ြန္ေတာ္ ကေတာ့ programing သမားမဟုတ္ေတာ့ c ++ ကို နားမလည္လို႕ပါ။
ဒါေပမယ့္ ဘာအတြက္အသံုးခ်ခ်င္ တာလဲမသိဘူးေနာ္။..autocad ရဲ႕ အဓိက programing language က
"autolisp" ပါ။ VB လည္းသံုးပါတယ္။ DXF file ဆိုတာ အရင္တုန္းက တျခား soft software ေတြနဲ႕ခ်ိတ္ဖို႕
သံုးပါတယ္။အခုေတာ့ autocad နဲ႕ ဆက္စပ္ေလ့ရွိတဲ့ soft software ေတာ္ေတာ္မ်ားမ်ားမွာ dwg format ကို
import လုပ္လို႕ရေနပါျပီ။ 3d အတြက္ဆိုရင္အရင္တုန္းက 3ds format သံုးေလ့ရွိပါတယ္။

papagyi
12-08-2008, 12:14 AM
ဒီထဲမွာပဲ တင္ေပးပါေနာ္။ေကာင္းတယ္ဗ်ာ "autocad " နဲ႕ structure တြက္တာ အရင္တုန္းက စမ္းဘူးတယ္။
တင္ထားတာေလးကို ေလ့လာၾကည့္ ျပီးအေႀကာင္းျပန္ပါ့မယ္။..by the way! ကို saiaung ရဲ႕ post ေခါင္းစဥ္ေလးကို "autocad & programing"
ဆိုျပီး rename ျပန္ျပင္ေပးပါလား။ဒီလိုပါ...ဒီေခါင္းစဥ္နဲ႕ဆို post ေတြထပ္ခဲ့ရင္ တစ္ျခားေခါင္းစဥ္ေအာက္ မေရြ႕ေစခ်င္လို႕ပါ။
ျပီးေတာ့ autocad နဲ႕ဆိုင္တဲ့ တစ္ျခား programing အေၾကာင္းေတြလဲ ဝင္ေရးလို႕ရသြားတာေပါ့ေနာ္။ေက်းဇူးပါ.... :) :)

saiaung
12-08-2008, 01:38 AM
ဟုတ္ကဲ႔ပါ ကုိ papagyi ခင္ဗ်ာ ကၽြန္ေတာ္လဲ အခုေလ႔က်င္႔ခန္းေလး လုပ္ေနရလို႔ပါ.. ကၽြန္ေတာ္အခု တင္ေပးလုိက္ပါ႔မယ္။ ဒီဘာသာရပ္ကုိ သိတဲ႔ အစ္ကုိ အစ္မမ်ားလဲ ဝင္ေရာက္ေဆြးေႏြးေပးပါအုံးလို႔ ေတာင္းဆိုခ်င္ပါတယ္..... အခုပုဒ္စာကေတာ႔ Moment နဲ႔ Shear force တြက္ထုတ္ထားတဲ႔ ေလ႔က်င္႔ခန္းေလးတစ္ပုဒ္ပါပဲ.... ဘယ္မွာတင္ရမယ္မွန္းမသိလို႔ တစ္ျခား ဆိုဒ္တစ္ခုမွာတင္လုိက္ပါတယ္... ျပန္ေဆြးေႏြးၾကမယ္လို႔ေမွ်ာ္လင္႔ပါတယ္... ဒီဖုိင္ေလးကုိေဒါင္းၿပီးၾကည္႔လိုက္ပါ (http://www.filefactory.com/file/95c918/n/saiaung3_rar)
ဟုတ္ကဲ႔ပါ အစ္ကုိေရ ကၽြန္ေတာ္ ဒီေခါင္းစဥ္ေလးကုိ ျပင္လိုက္ပါၿပီ အစ္ကုိေရ.... အစ္ခုလို ဝင္ေဆြးေႏြးေပးတဲ႔အတြက္ ေက်းဇူးအရမ္းတင္ပါတယ္...

NayNyo
12-08-2008, 01:19 PM
ေလ႔က်င္႔ခန္းက ဘယ္မွာၾကီးလဲဟင္။ :o :o
ဒီလို programming ေတြလည္း auto cad ကရတယ္လား။ ??? ???
တကယ္ မသိဘူးေတာ္။ မသိတဲ႔ သူကုိ ၀င္ေရာက္ ေမးလုိ႔ရပါသလားရွင္။ :-\ :-\

saiaung
12-08-2008, 10:11 PM
ဟုတ္ကဲ႔ခင္ပါ မေနညဳိ ကၽြန္ေတာ္ထပ္တင္ေပးထားပါတယ္... အစ္မေဒါင္းၾကည္႔လိုက္ပါ... ၿပီးရင္ PH-EX10.CPP ဆုိတာေလးကုိ run ၾကည္႔လိုက္ပါ....
dxf_out.cpp ဆုိတာေလးကေတာ႔.... dxf file ေတြrun လို႔ရေအာင္ပါ.. အဲဒါကုိေတာ႔ ကၽြန္ေတာ္တုိ႔ကုိ ဆရာကေပးထားတာ ... အစ္မ စိတ္ဝင္စားရင္ run ၾကည္႔လုိက္ပါ.... အဆင္မေျပတာရွိရင္ ျပန္ေဆြးေႏြးေပါ႔.....
http://ifile.it/83lrxfede9fbc50abfca8a1416ab86516c4a67a

chan09
12-16-2008, 06:08 PM
ခ်န္းခ်န္းက programming ဆိုရင္ ေတာ္ေတာ္အားနည္းပါတယ္..
coding ကိုဘယ္ေတာ့မွ အမွားကင္းေအာင္မေရးႏိုင္ေသးပါ၀ူး
အဲ့ဒါေၾကာင့္သူမ်ားေတြကို ခ်ျပရမွာလည္းမ၀ံပါ၀ူး..
ခုေျပာခ်င္တာက auto CAD ေပၚမွာ ေဗဒင္ program ေလးတခု ေရးၾကည့္မိလို့ပါ...
ဒီေဗဒင္ က ဦးပုညရဲ့ေတးထပ္တခုက ယူထားတာပါ...
ေတးထပ္မွာပါတာက အိမ္ေထာင္ျပဳၾကမယ့္ ေယာက်ၤားေလးရဲ့ ေမြးနဲ့ နဲ့ မိန္းကေလးရဲ့ ေမြးနံကိုေပါင္း.. ငါးနဲ့ေျမွာက္ ၇ နဲ့စား ျပီးအၾကြင္းကို ေဟာတာပါ..
ေတးထပ္ကို ေတာ့မရြတ္ျပေတာ့၀ူးေနာ္..
တြက္ၾကည့္ခ်င္ရင္ေတာ့ attach လုပ္ထားတဲ့ astro.vlx.txt ကို download လုပ္ျပီး .txt ကို rename နဲ့ဖ်က္လိုက္ပါ..
ျပီးရင္ Auto CAD command line မွာ astro လိုရိုက္ျပီး enter ေခါက္ရံုပါပဲ..
Enter your date: ဆိုရင္ တနဂၤေႏြဆို ၁ enter , တနလၤာဆို ၂ enter ....အဲ့လိုပါ...
အပ်င္းေျပေပါ့ဗ်ာ...

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

chan09
12-16-2008, 09:56 PM
dxf file ဆိုတာ က Drawing Interchange format ကိုဆိုလိုတာပါ..
အဓိက ရည္ရြယ္ခ်က္က ေတာ့ drawing file ေတြကို CNC ( computer numerical control) machine ေတြမွာသံုးႏိုင္ဖို့ အတြက္
dxf တခုကပဲ အဆင္ေျပလို့ပါ... cnc machine ေတြရဲ့ database က auto cad ရဲ့ dwg format ကို မသိပါ၀ူး..
dxf format ကေတာ့ ဘယ္ text editor နဲ့မဆို ဖြင့္ၾကည့္လို့ရတဲ့ edit လုပ္လို့ရတဲ့ cnc machine dabase က read ႏိုင္တဲ့တခုတည္းေသာ drawing file format မို့လို CAD/CAM ပိုင္းမွာပိုအသံုးမ်ားပါတယ္

CreateDxf::~CreateDxf()
{
cout <<"Destructor called..." << endl;

}
void CreateDxf::DxfBegin ()
{
// Creation of an output stream object in text mode.
// Header section of every dxf file.
ofstream To_Dxf ("Drawing1.dxf", ios::out);

To_Dxf << 0 << endl;
To_Dxf << "SECTION" << endl;
To_Dxf << 2 << endl;
To_Dxf << "ENTITIES" << endl;

To_Dxf.close();
}
void CreateDxf::DxfEnd ()
{
// Creation of an output stream objet in text mode.
// end of sequence objects of dxf file.
ofstream To_Dxf ("Drawing1.dxf", ios::app);

To_Dxf << 0 << endl;
To_Dxf << "ENDSEC" << endl;
To_Dxf << 0 << endl;
To_Dxf << "EOF";

To_Dxf.close();
}

void CreateDxf::Circle (float radius, float x, float y)
{
// Propeties of a circle not bound in any AutoCAd version
//In AutoCAD 2000 we can have more less 4000 lines of code here.

// Creation of an output stream objet in text mode.

ofstream To_Dxf ("Drawing1.dxf", ios::app);

// Draw the circle
To_Dxf << 0 << endl;
To_Dxf << "CIRCLE" << endl;
To_Dxf << 8 << endl;
To_Dxf << 0 << endl; // Layer number (default layer in autocad)
To_Dxf << 10 << endl; // XYZ is the Center point of circle
To_Dxf << x << endl; // X in UCS (User Coordinate System)coordinates
To_Dxf << 20 << endl;
To_Dxf << y << endl; // Y in UCS (User Coordinate System)coordinates
To_Dxf << 30 << endl;
To_Dxf << 0.0 << endl; // Z in UCS (User Coordinate System)coordinates
To_Dxf << 40 << endl;
To_Dxf << radius << endl; // radius of circle

To_Dxf.close();

}

ဒါကေတာ့ c++ နဲ့ေရးထားတဲ့ dxf sample coading တခုပါ

chan09
02-07-2009, 08:24 PM
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)

chan09
02-07-2009, 09:36 PM
ခ်န္းခ်န္းတို့ 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 တေယာက္ရဲ့ ပထမေျခလွမ္း ဆိုတဲ့အေၾကာင္း ကမၻာၾကီးကို ႏႈတ္ဆတ္လိုက္တာ
လို့ပဲထားပါစို့....

chan09
02-07-2009, 10:12 PM
(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)

chan09
02-09-2009, 08:43 PM
-Integer--> 1, 2, 35, 778 စသည့္ ကိန္းျပည့္မ်ား....
-Real Number--> 0.2, 3.34,.... စသည့္ ဒသမကိန္းမ်ား...
-String--> "Chan Chan" , "Hero",.... စသည့္ စကားတြဲမ်ား...
-List --> (1.2 2.0 6.8) ကဲ့သို့ေသာ data list မ်ား...list ကို အျမဲတန္း ကြင္း အဖြင့္အပိတ္ထဲမွာထားပါတယ္..(1.2 2.0 6.8)ကေတာ့ (x,y,z) ရဲ့ cordinate list တခုျဖစ္ပါတယ္...
-File Descriptor--> <File: a620> File Descriptorကိုသံုးျပီး ဖိုင္ေတြကို access လုပ္ႏိုင္ပါတယ္...
-Object Name--> <600000014c> auto cad နဲ့ဖန္တီးျဖစ္ေပၚလာသမွ် object ေတြမွာ <600000014c> လို alphanumeric code ကိုယ္စီရိွပါတယ္..အဲ့ဒါကိုသံုးျပီး object ေတြကို access လုပ္ႏိုင္ပါတယ္..
-Selection Set --> <selection set:1> 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)

papagyi
02-09-2009, 11:03 PM
ကိုခ်န္းေရ ...autolisp အေၾကာင္း တိုက္ရုိက္္စမေရးပဲ ..micro lisp ေလးေတြေရးပံုေရးနည္းေလးေတြ
၊အသံုးခ်ပံုေလးေတြမိတ္ဆက္ေပးပါလား။ဒါဆို user ေတြလည္း အသံုးဝင္ပံုသိျပီး basic ကို friendly ျဖစ္ျပီး
ပိုစိတ္ဝင္စားလာမယ္ထင္တယ္ေနာ္။....ေက်းဇူးပါ.....

chan09
02-10-2009, 06:04 PM
ကိုခ်န္းေရ ...autolisp အေၾကာင္း တိုက္ရုိက္္စမေရးပဲ ..micro lisp ေလးေတြေရးပံုေရးနည္းေလးေတြ
၊အသံုးခ်ပံုေလးေတြမိတ္ဆက္ေပးပါလား။ဒါဆို user ေတြလည္း အသံုးဝင္ပံုသိျပီး basic ကို friendly ျဖစ္ျပီး
ပိုစိတ္ဝင္စားလာမယ္ထင္တယ္ေနာ္။....ေက်းဇူးပါ.....


ဟုတ္ကဲ့ ကိုpapagyi ေရ... ေက်းဇူးပါ...
macro ကို အရင္မိတ္ဆတ္သြားပါ့မယ္... language ရဲ့ က်န္တဲ့ အပိုင္းေတြကို အဲ့ဒါျပီးမွ ဆက္တာေပါ့...
အၾကံဥာဏ္ ေပးတဲ့အတြက္ေက်းဇူးအထူးပါ...
တျခားလိုအပ္တာေတြရိွေနတာကိုလည္း၀င္ေရာက္ေဆြးေႏြးေပးပါအံုးေနာ္...
ခ်န္းခ်န္းလည္း ခုမွေလ့လာဆဲပါ...
စျပီး ေလ့လာစက အဲ့ဒါၾကီးက အင္မတန္ ဂႏၻီရဆန္လွပါတယ္.. သင္ေပးမယ့္ဆရာလည္းမရိွေတာ့ တခုခုဆိုဘာဆက္လုပ္ရေတာ့မယ္မွန္း
မသိေတာ့ဘူး.... ခ်န္းခ်န္းကေတာ့ လြယ္လြယ္ကူကူ ေလ့လာႏိုင္ေအာင္ အတတ္ႏိုင္ဆံုး ေဆြးေႏြးခ်င္ပါတယ္...

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

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

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

(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)
)

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

chan09
02-10-2009, 06:52 PM
ဒါၾကီးကအလုပ္ပိုပါတယ္လို့ေတာ့မထင္ပါနဲ့ေနာ္... (လြယ္လြယ္ေလး 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 ျဖစ္သြားျပန္ပါျပီ...

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

chan09
02-10-2009, 07:43 PM
(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)

papagyi
02-11-2009, 03:03 AM
:) :)ကိုခ်န္းေရ ...micro lisp ေတြက autocad advance user ေတြအတြက္ ေတာ္ေတာ္တန္ဖိုးၾကီးပါတယ္။
ခက္တာက programing ထဲျဖစ္ေနေတာ့ autocad user member ေတြ အလြယ္တကူမျမင္နိုင္ပဲျဖစ္ေနတယ္။
Autocad ထဲက acad programing ေခါင္းစဥ္ထဲေျပာင္းရင္ပိုေကာင္းမယ္ထင္တယ္ေနာ္။
lisp အေၾကာင္းပဲထားခဲ႕ေပါ့ ....acad programingထဲမွာလဲ lisp ရဲ႕ history ပါထပ္ေရးေပးရင္ ..autolisp
ဘယ္ကလာသလဲ သိရတာေပါ့။ဒါမွမဟုတ္ ...autolisp ေခါင္းစဥ္သစ္ဖြင့္ရင္လဲေကာင္းတာပဲ။...
ေသေသခ်ာခ်ာ သိေစနိုင္ေအာင္ပိုအဆင္ေျပမလားလို႕ေပါ့။ကၽြန္ေတာ္လဲ micro ေတာ့ ကူေရးေပးမယ္ေလ။
:) :) :)

ကိုဆန္း
02-11-2009, 10:08 AM
ကိုpapagyi အၾကံျပဳသလိုပဲ ကိုchan09 ေရးသားထားတဲ႔ Autolisp အေၾကာင္း ေဆြးေႏြးခ်က္ေတြကို AutoCAD နဲ႔ programming ထဲကိုေရႊ ႔ထားေပးလိုက္ပါတယ္ေနာ္။
ဒါမွ ေလ႔လာလိုသူေတြ AutoCAD ေခါင္းစဥ္ေအာက္မွာပဲ အလြယ္တကူရွာေတြ႔နုိင္ေအာင္ပါ။
အခုလို အဖုိးတန္ ပညာရပ္ေတြမွ်ေ၀သင္ၾကားေပးေနတဲ႔ ကိုchan09 နဲ႔ ကိုpapagyi ကိုလည္း ေက်းဇူးအမ်ားၾကီးတင္ပါတယ္ဗ်ာ။ :)

chan09
02-11-2009, 10:03 PM
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))



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

chan09
02-11-2009, 10:05 PM
ေနာက္ဆက္တြဲ macros code ေလးေတြ ပါ...(words၂၀၀၀၀ ေက်ာ္လို့ exceeded ျဖစ္ျပီးတခါတည္းတင္မရလို့ပါ....)

(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)
)

chan09
02-12-2009, 09:32 PM
program တပုဒ္ရဲ့ source code ေတြကိုဖတ္တဲ့ေနရာမွာ အေရးအၾကီးဆံုးကေတာ့ အဲ့ဒါကိုေရးသားခဲ့တဲ့ programmer ရဲ့ comment ေလးေတြပါ..
စနစ္တက် comment ေလးေတြေရးထားမယ္ဆိုရင္ ေနာင္လာေနာက္သားေတြ ျပန္လည္ ေလ့လာ မြမ္းမံ အသံုးျပဳရတာ လြယ္ကူ အဆင္ေျပေစႏိုင္ပါတယ္..
ၾကံုဖူးပါတယ္ ခ်န္းခ်န္း ကိုယ့္ဘာသာ ကိုယ္ေရးထားခဲ့ တဲ့ program တခုကို ေနာက္ေတာ္ေတာ္ၾကာမွ ျပန္ဖတ္တဲ့ အခါ ဘာေၾကာင့္ဒီေန့ရာမွာဒါကို သံုးခဲ့ပါလိမ့္ဆိုတာမနည္းစဥ္းစားရပါတယ္.. ကုဒ္ေတြမ်ားလာတာနဲ့အမွ် အဲ့ဒိအခ်ိန္က အဲ့ဒိျပသနာကို ရွင္းခဲ့တဲ့စဥ္းစားမႈမ်ိဳး ျပန္လည္ရရိွဖို့ဆို တာ အခ်ိန္အတိုင္းအတာတစ္ခု ျပန္လည္း ေပးဆပ္ရႏိုင္ပါတယ္... programming language တခုစီတိုင္းမွာ comment အတြက္ သီးသန့္သတ္မွတ္ထားတာေလးေတြရိွပါတယ္.. ဥပမာ.. c++ အတြက္ // ။ fortran အတြက္ c ဒါမွမဟုတ္ asterisk '*' သံုးသလိုပါပဲ..
autoLisp အတြက္ေတာ့ semi column ' ; ' ကို comment ေရးဖို့ သံုးပါတယ္...
coding ရဲ့ လိုင္း တလိုင္းအတြင္း semi column';' ရဲ့ အေနာက္မွာရိွတဲ့ေဖၚျပခ်က္ေတြကို autoLisp ရဲ့ compiler က program code အျဖစ္ထည့္သြင္း တြက္ခ်က္ အလုပ္လုပ္မွာမဟုတ္ပါ၀ူး....

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

chan09
02-15-2009, 09:15 AM
;Follow Linear Dimension with Continued Dimension
( ;start program
defun c:dlc () ;function name
(command “_dimlinear” pause pause pause) ;for dim linear
(command “_dimcontinue”) ;for dim continuous
) ; end program

နမူနာေပးတာပါ.. အဲ့လိုလုပ္ရမယ္လို့ေျပာတာမဟုတ္ပါ၀ူး...

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

saiaung
02-16-2009, 05:32 AM
အခုလုိ ဒီဖိုရမ္ေလးမွာ အားလုံး ေလ႔လာလုိ႔ရေအာင္ ေဆြးေႏြးေပးတဲ႔ အစ္ကုိ ကုိခ်န္းခ်န္း ကုိေက်းဇူးပါတယ္။ အစ္ကုိ႔မွာ စာအုပ္ေလးေတြ ရွိရင္လဲ မွ်ေဝေပးပါအုံးအစ္ကုိ.. ကၽြန္ေတာ္႔မွာလဲ ဒီစာအုပ္ေလးေတာ႔ ဖတ္ျဖစ္ပါတယ္... လုိအပ္တဲ႔သူေတြလဲ ဖတ္လို႔ရေအာင္ ဒီေအာက္မွာပဲတင္ေပးထားပါတယ္ ခင္ဗ်..
http://www.mediafire.com/?b9479dd6ad7bedabd2db6fb9a8902bda (http://www.mediafire.com/?sharekey=b9479dd6ad7bedabd2db6fb9a8902bda)

chan09
02-17-2009, 09:14 PM
ခ်န္းခ်န္းတို့ ငယ္ငယ္တည္းက ေက်ာင္းက သခၤ်ာမွာသင္ခဲ့ ၾကတဲ့ function ေလးေတြကို ျပန္ေနာက္ေၾကာင္းျပန္ရင္..
f(x)=a+b ဆိုပါေတာ့... အဲ့ဒါကို ဖတ္ရင္ function of 'x' equal to 'a' plus 'b'.. မွတ္မိၾကအံုးမွာပါ..
သခၤ်ာမွာေတာ့ a+b လို့တိုက္ရိုက္ေရး ရင္ function တစ္ခု ျဖစ္ပါတယ္..autolisp မွာေတာ့ သခၤ်ာတြက္ေတြအတြက္ + , -, *, / ေတြကိုယ္တိုင္က function လို့သတ္မွတ္ထားပါတယ္.. အဲ့ဒိေတာ့ mathematical expression အတြက္ format ဟာ (function atom atom ..) အဲ့လိုျဖစ္ပါမယ္..
တကယ္လို့ f(x)=a+b ဆိုတာကို autolisp format နဲ့ေရးရမယ္ဆိုရင္ေတာ့
(defun x()
(+ a b)
)
အဲ့ဒိလိုျဖစ္သြားပါတယ္..
auto cad ရဲ့ command line မွာ expression ေတြကို တိုက္ရိုက္စမ္းၾကည့္လို့ ရပါတယ္... ဆိုလိုတာက
(+ 2 3) ဆိုျပီး command line မွာ ရုိက္ enter ေခါက္ရင္ 5 ဆိုတဲ့ အေျဖကို ရပါလိမ့္မယ္... auto CAd က
လက္သည္းကြင္းအဖြင့္နဲ့ စလာတဲ့ character ေတြကို expression ဆိုတာသိပါတယ္.. သာမာန္အားျဖင့္ command line မွာ space ပုတ္တာဟာ enter ျဖစ္ေပမယ့္ လက္သည္းကြင္းဖြင့္ထားရင္ေတာ့ space ကို space လို့ပဲauto CAD ကနားလည္ေပးပါတယ္...
match expression နမူနာေတြကေတာ့
+ ..... Adds
(+ 2 3) returns 5
(+ 4 5.6 -2) returns 7.6
(setq a 20 b 9)
(+ a b) returns 29
- ..... Subtracts
(- 9 7) returns 2
(- 8 4 0.5) returns 3.5
After (setq a 20 b 9)
(- a b) returns 11
(- b a) returns -11
(- a) returns -20. တကယ္လို့ argument တခုပဲေပးတာဆိုရင္ေတာ့ 0 ထဲကေန ႏႈတ္ျပီး အဲ့ဒိတန္ဖိုးကို ျပေပးတာပါ..
* ..... Multiplies
(* 6 7) returns 42
(* 2 -3 1.5) returns -9.0
After (setq a 3 b 4.5)
(* a b) returns 13.5
(* a a) returns 9

/ ..... Divides
(/ 12 6) returns 2
(/ 11 6) returns 1 integer ကို integer နဲ့ စားရင္ integer ပဲရပါတယ္..
(/ 11 6.0) returns 1.833333
(/ 12 3 2) returns 2
(/ 12 -2.0) returns -6.0

rem ..... Returns a remainder resulting from division
(rem 10 3) returns 1
(rem 10 5) returns 0
(rem 6.2 1.2) returns 0.2

1+ ..... Increments by 1
(1+ 16) returns 17
After (setq a 21)
(1+ a) returns 22. Used with setq, this serves as a loop counter for iteration. For example, (setq c (1+ c)).
(1+ -4) returns -3

1- ..... Decrements by 1
(1- 16) returns 15
After (setq a -8)
(1- a) returns -9

abs ..... Returns the absolute of a number
(abs 7.0) returns 7.0
(abs -6) returns 6

fix ..... Discards fractional portion of a number and returns an integer
(fix 7. 1) returns 7
(fix 7.9) returns 7
(fix -4.6) returns -4

float ..... Converts a number to a real number (floating point decimal number)
(float 5) returns 5.0
(float 5.82) returns 5.82

gcd ..... Returns the greatest factor (divisor) common to two or more integers. Arguments must be positive integers.
(gcd 21 39) returns 3
(gcd 102 138) returns 6
(gcd 30 45 60) returns 15
Autodesk says this function returns the "greatest common denominator" (a meaningless phrase). It is better to think of it as "greatest common divisor."

min ..... Returns the smallest (lowest) of two or more numbers
(min 8 3 11.88 14 6) returns 3.0
(min 13 -28 2 66) returns -28

max ..... Returns the greatest of two or more numbers
(max 8 3 11.88 14 6) returns 14.0
(max -22 -2 16) returns 16

sqrt ..... Returns the square root of a number as a real
(sqrt 16) returns 4.0
(sqrt 2.0) returns 1.414214

expt ..... Raises a given number to a given power
(expt 3 4) returns 81
(expt 2.0 5.0) returns 32
(expt 3 -2) returns 0 (negative exponents applied to integers can appear to give incorrect results because of integer division)
(expt 3.0 -2.0) returns 0.111111
(expt 256 0.25) returns 4.0
After (setq a 2.25 b 0.5)
(expt a b) returns 1.5

exp ..... Returns e raised to a given power
(exp 1.0) returns 2.71828
(exp 2.14) returns 8.49944
(exp 0.4) returns 1.49182
(exp -2.0) returns 0.135335
Euler's number, e, is the base of natural logarithms, and equals approximately 2.71828. It is used to simplify certain formulas in calculus. Compare log below.

log ..... Returns the natural log (base e) of a number. Compare exp above.
(log 3) returns 1.09861
(log 1.82) returns 0.598837
(log 0.25) returns -1.38629

cvunit ..... ယူနစ္conversion function ကေတာ့ auto CAD ရဲ့ built in command တခုလည္းျဖစ္ပါတယ္...
(cvunit 10 "inch" "mm") returns 254.0
(cvunit 100 "mm" "inch") returns 3.93701
(cvunit 25 "lb" "kg") returns 11.3398
(cvunit (list 6 5 24) "inch" "feet") returns (0.5 0.416667 2.0)
After (setq a 1 b 2)
(cvunit a "inch" "mm") returns 25.4
(cvunit (list (eval a) (eval b)) "inch" "mm") returns (25.4 50.8)

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

papagyi
02-18-2009, 02:07 AM
ကိုခ်န္းေရ micro file ေတြကို ဘယ္လို auto load ျဖစ္ေအာင္တင္မလဲ ၊ ဘယ္လို file ေတြစုထားျပီးသံုးမလဲ။
သူမ်ားဆီယူသြားတဲ႕ အခါကိုယ့္ micro file ကိုဘယ္လို ထည့္မလဲဆိုတာေလးေတြ ေရးေပးပါဦး။
ဥပမာ ..acad.lsp file လုပ္ျပီး options မွာ check လုပ္ထားတာမ်ိဳး သို႕မဟုတ္ content ထဲပဲထည့္ျပီးသံုးမလားေပါ့။
..ေက်းဇူးပါ။ :) :)

chan09
02-18-2009, 08:18 PM
macro အေနနဲ့ပဲသံုးမွာမ်ိဳးဆိုရင္ေတာ့ ဖိုင္ေတြကို အမ်ားၾကီး မလုပ္ထားပဲ .lsp တစ္ဖိုင္တည္းမွာပဲ မိမိသံုးေနၾက function ေတြကိုစုထား ျပီးသံုးတာပိုသင့္ေတာ္မယ္ထင္ပါတယ္... သံုးေနၾကလို့ေျပာရတာကေတာ့ macro ထဲက function name ေတြဟာ မိမိသံုးေနၾကမဟုတ္ ေသေသခ်ာခ်ာသိထားျပီးသားမဟုတ္ရင္ တခါတေလ မွာ auto cad ရဲ့ acad.pgp မွာ assign လုပ္ထားတဲ့ အတိုေကာက္ေတြနဲ့ ေရာေႏွာတတ္လို့ မိမိအလုပ္လုပ္ရာမွာ ေရာေထြးႏိုင္ပါတယ္... ဥပမာေျပာရရင္ေတာ့ ခ်န္းခ်န္း အေပၚမွာတင္ေပးထားတဲ့ code ေတြထဲမွာ
(defun c:t () (command "trim") (princ))
အဲ့ဒါေလးက function name ကို t လို့ေပးထားပါတယ္... acad.pgp မွာ t ကို text (single line text) command ျဖစ္ပါတယ္.. မိမိက text command အတြက္ t enter လို့ရုိက္ေပမယ့္ ဒီ function ေလး load ျဖစ္ေနရင္ေတာ့ trim ပဲျဖစ္မွာပါ...
(defun c:aa () (command "-array") (princ)) မွာ aa ဟာ acad.pgp မွာ area ဆိုတဲ့ command ပါ .. (အဲ့လိုမ်ိဳးေလးေတြေပါ့ခင္ဗ်ာ)
.lsp နဲ့ .pgp မွာ auto CAD က .lsp ကို ပထမ ဦးစားေပး ေခၚယူသံုးပါတယ္....(ေျပာရင္းနဲ့ လမ္းလြဲကုန္ေတာ့မွာပဲ) ေျပာခ်င္တာက တစ္ဖိုင္တည္းဆိုရင္ မိမိအသံုးျပဳေနက်စက္မွာဆို auto cad ရဲ့ command line မွာ ap enter လို့ရိုက္ျပီး ေပၚလာတဲ့ load/unload dialog မွာ content ဆိုတဲ့ start up suit ထဲကို ထည့္ထားတာကသင့္ေတာ္ပါတယ္... တကယ္လို့ မိမိသံုးေနက်စက္မဟုတ္ပဲ တျခားတေနရာရာမွာသံုးဖို့ ၾကံုလာရင္ေတာ့ (အထူးသျဖင့္အင္တာဗ်ဴးလက္ေတြ့ ဆြဲျပတဲ့အခါမ်ိဳး...) မိမိ ရဲ့ flash drive(tumb drive) ဒါမွမဟုတ္ cd , floopy တခုခုထဲမွာ အျပင္ဘက္မွာပဲ ခ်ထားတာရွာရလြယ္ေစပါတယ္.. ျပီးရင္ auto CAD ဖြင့္ျပီးျပီဆိုတာနဲ့ window explorer ကိုသံုးျပီး drawing area ထဲကို drug ဆြဲခ် ျပီးသံုးတာပိုမိုျမန္ဆန္ေစႏိုင္ပါတယ္...တကယ္လို့ auto Lisp ဖိုင္ေတြအမ်ားၾကီး ျဖစ္လာျပီဆိုရင္ေတာ့ folder တခုခုထဲစုထဲ့ထားျပီး auto CAD ရဲ့ command line မွာ op enter လို့ ေခါက္ျပီး ေပၚလာတဲ့ option dialog ရဲ့ file tab ကေန support file search path မွာမိမိ folder ကို add cmd button ကို သံုးျပီး add လုပ္ထားတာက သင့္ေတာ္မယ္ထင္ပါတယ္... acad.lsp နဲ့ acaddoc.lsp ဆိုတဲ့ နာမည္မ်ိဳးေပးျပီးေတာ့ search path မွာ ျပထားတာကလည္း တူတူပါပဲ...

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

(p.s စာဖတ္ရမွာပ်င္းတဲ့သူေတြအတြက္ macro ဖန္တီးအသံုးျပဳပံုေလးကို flash file ေလးနဲ့ ေျပာျပထားပါတယ္.. links ကေတာ့
http://www.esnips.com/doc/cd7d2cb8-0ce7-458a-99f5-e4799a2f97d9/9.2macro1ဒါက macro အေၾကာင္းပါ...
http://www.esnips.com/doc/25e41a9d-fbd1-4c82-8ea4-a3396da871fc/9.1lspeditor ဒါကေတာ့ visual lisp editor အေၾကာင္းျဖစ္ပါတယ္)

chan09
02-21-2009, 08:25 PM
autolisp ကို ပိုင္ပိုင္ႏိုင္ႏိုင္ေရးသားႏိုင္ဖို့ ဆိုရင္ ေအာက္က ၂၁ ခုကို သိရိွထားဖို့ေတာ့လိုပါမယ္..
1 Mathematics (ေရွ့ပိုစ္မွာေဖၚျပျပီးပါျပီ)
2 Geometry & trigonometry
3 Setting variables
4 User input
5 Conditionals
6 Arithmetic tests
7 Logic & category tests
8 Iteration (repetition)
9 List manipulation
10 Text strings
11 Printing to screen
12 Converting data types
13 Function related
14 Working with AutoCAD
15 Files
16 Entity access
17 Symbol tables
18 Selection sets
19 Bitwise
20 Debugging
21 Miscellaneous (အေပၚမွာမပါခဲ့တဲ့ ဟာေတြကို ဒီထဲထည့္ထားတယ္ ဟိဟိ)
တကယ္ေတာ့ အဲ့ဒါေတြခ်ည္းပဲေတာက္ေလွ်ာက္ေရးသြားရင္ ဖတ္ရတဲ့သူေတြျငီးေငြ့ပါလိမ့္မယ္..
ပရိုဂရမ္တခုခ်င္းစီကို တေၾကာင္းစီျပန္ရွင္းျပီးဘာေၾကာင့္ဒီေနရာမွာဒါကို သံုးရတယ္ ဆိုတာမ်ိဳးျပန္ရွင္းရင္ေတာ့ စိတ္၀င္စားဖြယ္မ်ားျဖစ္ႏိုင္မလားမသိ၀ူး
(ကို papagyi ေရအၾကံေပးပါအံုး ... :)) ခ်န္းခ်န္း ပရိုဂရမင္း ေလ့လာေတာ့ ဆရာတေယာက္ကဆူဖူးပါတယ္... ခ်န္းခ်န္းက အင္မတန္ အဆင့္ေက်ာ္ျခင္တာကိုး.. basic simple code ေလးေတြေရးတာေတာင္စံုေအာင္မသိေသး၀ူး database ပိုင္းကို လွမ္းခ်င္ေနလို့.. ဆရာကမင္းေတာ့ဘယ္ေတာ့မွ programmer ေကာင္းတေယာက္ျဖစ္လာမွာမဟုတ္၀ူးတဲ့.. အဲ့ဒိဆရာေျပာခဲ့သလိုပါပဲ (ခ်န္းခ်န္း ပရိုဂရမ္မာေကာင္းတေယာက္ျဖစ္မလာခဲ့ပါ၀ူး) ခ်န္းခ်န္းက programming ကို tool တခုအေနနဲ့ပဲသံုးခ်င္တာပါ.. ခ်န္းခ်န္းဒါမ်ိဳးလုပ္ခ်င္တယ္.. ဒီLanguage ကိုသံုးတယ္.. ခ်န္းခ်န္းလိုခ်င္သလိုေတာ့ျဖစ္သြားႏုိင္ေပမယ့္ စနစ္မက်ပါ၀ူး.. programming ကိုေလ့လာတဲ့သူေတြကို ခ်န္းခ်န္းလို မျဖစ္ေစခ်င္တာ တကယ္ေစတနာအစစ္ပါ.. ဒါေပမယ့္လည္း ဒီsubject ကေလ့လာရတဲ့သူေတြအတြက္ အင္မတန္ပ်င္းဖို့ေကာင္းလွပါတယ္..
ခ်န္းခ်န္းတို့ေက်ာင္းမွာ တတိယႏွစ္အထိသခ်ၤာပါပါတယ္.. အဲ့ဓိ သခၤ်ာမွာ programming (fortran) ကိုသင္ေတာ့ စာအုပ္ထဲမွာပဲ coding ကိုေရးရပါတယ္.. coding ေတြစုထားျပီး practical ခ်ိန္က်မွ computer rooom ဆိုတဲ့ အခန္းမွာ ၂ေယာက္ကို စက္တလံုးစီနဲ့ မိမိကုဒ္ေတြကို run ၾကည့္ရပါတယ္.. မွတ္မိသေလာက္အဲ့ဒိ computer room က computer ကို ကိုင္ဖူးတာ ေက်ာင္းတက္ခဲ့တဲ့ ေနာက္ဆံုး ဆဌမႏွစ္အထိ ၁၀ ၾကိမ္မေက်ာ္ပါ၀ူး.. ဒါေပမယ့္ စတုတၳႏွစ္မွာ programming ကို ခ်န္းခ်န္းေမဂ်ာဘာသာအျဖစ္ ယူရပါတယ္.. စာေမးပြဲမွာ ခ်န္းခ်န္း distinction နဲ့ေအာင္တယ္.. မွတ္မိသေလာက္အဓိအခ်ိန္တုန္းက ခ်န္းခ်န္းတို့မ်ား microsoft word, excel ဘာမွန္းမသိေသးပါ၀ူး... (အာလူးေလွ်ာက္ဖုတ္ေနတာ ဘယ္ေတြေရာက္ကုန္ျပီလည္းမသိ၀ူး... ဟိဟိ)

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

chan09
02-21-2009, 08:35 PM
ခ်န္းခ်န္း comment အေၾကာင္းေရွ့ပိုစ္မွာေျပာခဲ့တုန္းက က်န္ေနခဲ့လို့ပါ..
semicolon က တေၾကာင္းခ်င္စီကို program မွာ မrun ေအာင္ တတ္ႏိုင္ပါတယ္..
တခါတေလ ကုဒ္ေတြေရးေနရင္းနဲ့ အဲ့ဒိထဲက function တခုလံုးစာ .. ဒါမွမဟုတ္ looping တခုလံုးစာကို temporary ပိတ္ခ်င္ရင္ေတာ့ block comment ကိုသံုးႏိုင္ပါတယ္..
code ကေတာ့ .... ;|............|; ပါ..
ကြင္းစ ကြင္းပိတ္သေဘာမ်ိဳးပါပဲ...
ဘယ္ႏွလိုင္းျဖစ္ျဖစ္ ;| နဲ့စထားျပီးရင္ |; နဲ့ဆံုးတဲ့ေနရာထိကို compiler က ေက်ာ္ေပးပါတယ္...

chan09
02-21-2009, 09:23 PM
အနားသံုးနားသိတဲ့ ျတိဂံရဲ့ ဧရိယာ ရွာတဲ့ ပရိုဂရမ္ေလးပါ..
အစမွာ block comment ေလးနဲ့ သံုးထားတဲ့variable ေတြကို ေျပာျပထားတာပါ program code မဟုတ္ပါ၀ူး
line 1 ကေတာ့ထံုးစံအတိုင္း function name ေပါ့ခင္ဗ်ာ..
line 2-4 က data input အတြက္ပါ..
Line 5-7 ကေတာ့ တြက္နည္းပါ..
line 8-11 က return ျပန္ဖို့ပါ..

;| Variables:
a Side a
area Area of triangle
b Side b
c Side c
p Perimeter
s Intermediate value |;
(defun c:area3 (/ a area b c p s) ;line 1
(setq a (getreal "\nLength of side a: ")) ;line 2
(setq b (getreal "\nLength of side b: ")) ;line 3
(setq c (getreal "\nLength of side c: ")) ;line 4
(setq p (+ a b c)) ;line 5
(setq s (/ p 2)) ;line 6
(setq area (sqrt (* s (- s a) (- s b) (- s c)))) ;line 7
(princ "\nThe area is ") ;line 8
(princ area) ;line 9
(princ "\nThe perimeter is ") ;line 10
(princ p) ;line 11
(princ) ;line 12
)
ဒီမွာ ေျပာစရာရိွလာတာ က setq ဆိုတဲ့ function ပါ..(setq a 1) ဆိုတာက 1 ဆိုတဲ့ ကိန္းတန္ဖိုးကို a ဆိုတဲ့ variable မွာ set လုပ္တယ္ ဆိုတဲ့ အဓိပၼါယ္ပါ...getreal ဆိုတဲ့ function ကေတာ့ user input ကို real no.အေနနဲ့ေတာင္းတာပါ.. c++ ရဲ့ cin နဲ့နဲနဲဆင္ပါတယ္.. ဒါေပမယ့္ မတူပါ၀ူး..
User input
initget --- Controls input allowed in next user input function
getint ---- Allows user to enter an integer
getreal --- Allows user to enter a real
getpoint -- Allows user to pick a point (rubber-band is a line)
osnap ----- Returns a point snapped to some feature of existing geometry
getcorner - Allows user to pick a point (rubber-band is a rectangle)
getdist --- Allows user to pick a distance
getangle -- Allows user to pick an angle
getorient - Allows user to pick a Cartesian angle
getstring - Allows user to enter a string
getkword -- Allows user to enter selected key word options
autoLisp ရဲ့ user input function ေတြပါ..
princ ဆိုတာကေတာ့ c++ ရဲ့ cout နဲ့ ဆင္ပါတယ္.. တူေတာ့ သိပ္မတူပါ၀ူး..
Printing to screen
prin1 ----- Prints text to the command line or to a file
princ ----- Prints text to the command line or to a file
print ----- Prints text to the command line or to a file
prompt ---- Prints a string to the command line
terpri ---- Terminates a line of print, returns cursor to beginning of next line

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

papagyi
02-21-2009, 09:53 PM
ကိုခ်န္းေရ ဒီအတိုင္းအဆင္ေျပပါတယ္။ :)...
Autolisp ကိုေရးဖို႕လိုအပ္တဲ႕ code ေတြခ်ည္းပဲဆိုရင္ ေခါင္းမူးျပီး ခ်ာခ်ာလည္သြားနိုင္ပါတယ္။
ျဖစ္နိုင္ရင္ ေခါင္းစဥ္ ၂ခုေလာက္ေပါင္းျပီး program အေသးေလးေရးျပတာမ်ိဳးေလးေပါ့ ...
ေနာက္ အဲဒီေခါင္းစဥ္ ေလး ၂ ခု နဲ႕ ေနာက္အသစ္တစ္ခုေပါင္းျပီး program အေသးေလးထပ္ေရးေပးတာမ်ိဳးေပါ့။
ကၽြန္ေတာ္ကေတာ့ autolisp ကိုအၾကံပဲေပးတတ္ေတာ့တယ္။..ေတာ္ေတာ္ေမ႕ ေနျပီ။ :D :D

chan09
02-23-2009, 09:02 PM
Algebraic formula AutoLISP expression
1. Area of triangle
Area = bh/2 (setq area (/ (* base hei) 2.0))
[hei = height]
2. Area of circle
Area = pr^2 (setq area (* pi rad rad))
[rad = radius]
3. Volume of cylinder
Volume = pr^2h (setq vol (* pi rad rad hei))
[vol = volume, rad = radius, hei = height]
4. Volume of sphere
Volume = (4/3)pr^3 (setq vol (/ (* 4 pi rad rad rad) 3))
[vol = volume, rad = radius]
5. Pythagoras theorem
c = (a^2 + b^2)½ (setq c (sqrt (+ (* a a) (* b b))))
[c = hypotenuse, a = side a, b = side b]
6. Fahrenheit
F = (9/5)C + 32 (setq far (+ (* 1.8 cel) 32))
[far = Fahrenheit, cel = celsius]
သခ်ၤာ formula ေလးတခ်ိဳ့ကို auto Lisp Expression နဲ့ေဖၚျပတာပါ.....
(Auto CAD နဲ့ Programming ဆိုျပီး ခုထိလည္း ပံုဆြဲတဲ့ဆီမေရာက္ေသး၀ူးေနာ္...ဟိဟိ )

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

chan09
02-28-2009, 03:29 PM
;written by ko phoesan.......
(defun C:mynuth() ;function name ကို သတ္မွတ္ပါတယ္...
(setq cmdecho (getvar "cmdecho")) ;လက္ရိွရိွေနတဲ့ cmdecho variable ကို cmdecho မွာ set လုပ္ပါတယ္..
(setvar "cmdecho" 0) ;လက္ရိွ တန္ဖိုးကို 0 မွာထားလိုက္ပါတယ္... 0ျဖစ္ေနတဲ့ ေနာက္ပိုင္း လုပ္ေဆာင္ခ်က္ေတြကို
;user ရဲ့ cmd line မွာေတြ့ျမင္မွာမဟုတ္ပါ၀ူး...
(setq osmode (getvar "osmode")) ;osmode ကိုလည္း ခုနလိုပဲ ခနသိမ္းပါမယ္..
(setvar "osmode" 0) ;0မွာ ထားပါတယ္
(setq Radius (getreal "Enter Radius of Nut: ")) ;နပ္ရဲ့ အခ်င္း၀က္ user ဘက္ကို data input လုပ္ခိုင္းတယ္
(setq Height (getreal "Enter Height of Nut: ")) ;အျမင့္ေရာေပါ့...
(setq HoleDiameter (getreal "Enter Diameter of hole of the Nut:")) ;bolt အတြက္ nult မွာရိွရမယ့္ hole အခ်င္းေတာင္းပါတယ္..
(setq Sides (getint "Enter the number of sides of the nut:")) ;ပံုမွန္ဆိုရင္ ဆဌဂံ(ရုပ္ရွင္ မဟုတ္ပါ) ပါပဲ... ၆နား နဲ့ေပါ့
(setq NutCenter (getpoint "\nPick the center point of the Nut:")) ;ေပၚေစခ်င္တဲ့ ေနရာျပခိုင္းပါတယ္...
(setq Z_NutCenter (caddr NutCenter)) ;နပ္ ဗဟိုရဲ့ cordinat မွ z တန္ဖိုးကိုကိုမွတ္ပါတယ္
(setq CenterPointUpperCircle (list (car NutCenter) (cadr NutCenter) (+ Z_NutCenter Height)))
;ခုနက ေပးခဲ့တဲ့ ဗဟို point ရဲ့ နပ္အျမင့္ေနရာမွာရိွေနတယ္ cordiante ကို မွတ္ပါတယ္...
(command "_.Polygon" Sides NutCenter "C" Radius) ;user က specify လုပ္ထားတဲ့ေနရာမွာ polygon ဆြဲပါတယ္
;user ေပးထားတဲ့ data သံုးျပီးေတာ့ေပါ့ေလ
(setq Polygon (entlast)) ;အဲ့ဒိ polygon ကို ေနာင္ျပန္လည္ select လုပ္သံုးႏိုင္ေအာင္ viarable တခုနဲ့ set လုပ္ထားပါတယ္...
(command "_.circle" NutCenter Radius) ;စက္၀ိုင္းဆြဲပါတယ္
(setq CircleLower (entlast)) ;စက္၀ိုင္းကိုလဲ ခုနကလိုပဲ set လုပ္ပါတယ္
(command "copy" CircleLower "" NutCenter CenterPointUpperCircle "") ;နပ္ရဲ့ အျမင့္ ေနရာဆီ အဲ့ဒိစက္၀ိုင္းကို ေကာ္ပီ..
(setq CircleUpper (entlast)) ;variable မွာ set လုပ္ပါတယ္..
(command "_.extrude" Polygon "" Height) ;polygon ကို user ေပးတဲ့ အျမင့္နဲ့ extrude လုပ္ပါတယ္...
(setq Polygon (entlast)) ;အဲ့ဒိ polygon solid ကို လည္း variable တခုနဲ့ set လုပ္ပါတယ္
(command "_.extrude" CircleLower "" "t" -45 Height) ;အေျခစက္၀ိုင္းကို tapper angle -၄၅ ဒီဂရီနဲ့ extrude
(setq CircleLower (entlast)) ;အေျခကေတာ့ပံုထုကို variable တခုနဲ့ set လုပ္ပါတယ္..
(command "_.extrude" CircleUpper "" "t" -45 (* Height -1)) ;အေပၚစက္၀ိုင္းကို ေတာ့ z axis ရဲ့ အႏုတ္တန္ဖိုးအတိုင္း -၄၅ ဒီဂရီနဲ့ extrude
(setq CircleUpper (entlast)) ;အေပၚကေတာ့ပံုထုကို မွတ္ပါတယ္
(command "_.intersect" Polygon CircleLower CircleUpper "") ;ရရိွလာတဲ့ polygon ထုထည္ အေျခကေတာ့ပံု နဲ့အေပၚကေတာ့ပံုတို့ကို
; intersect လုပ္ပါတယ္
(setq FilledNut (entlast)) ;ရလာတဲ့ နပ္ပံုထုကို variable တခုနဲ့ set လုုပ္ပါတယ္..
(command "_.circle" NutCenter "d" HoleDiameter) ;အေပါက္ေဖါက္ဖို့အတြက္ စလင္ဒါရဲ့စက္၀ိုင္းပါ
(setq Hole (entlast)) ;မွတ္ပါတယ္
(command "_.extrude" Hole "" Height) ;ထုတင္ပါတယ္
(setq Hole (entlast)) ;စလင္ဒါကို set လုပ္ပါတယ္
(command "_.subtract" FilledNut "" Hole "") ;ခုနက ရထားတဲ့ nut ပံု ထုထည္ ထဲက ေန စလင္ဒါကို subtract လုပ္ပါတယ္
;(ဟူး...ေမာလုိက္တာ) လုိခ်င္တဲ့ နပ္ကေလးျပီးပါျပီ...
(setvar "cmdecho" cmdecho) ;comdecho ကို နဂိုရိွေနတဲ့ variable မွာျပန္ထားေပးပါတယ္ program အစမွာ 0 လုပ္ခဲ့တာမွတ္မိမွာပါ
(setvar "osmode" osmode) ;osmode ကိုေရာေပါ့
) ;the end :):)

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

chan09
02-28-2009, 04:59 PM
ဒီပရိုဂရမ္ျဖစ္ေပၚလာပံုကေတာ့ ခ်န္းခ်န္းရဲ့ http://chan09.blogspot.com/2008/02/auto-cad-nut.html အဲ့ဒိမွာ nut ဆြဲတဲ့ အေၾကာင္း
ေလးတင္လိုက္ေတာ့ ကိုဖိုးဆန္းက စိတ္၀င္စားျပီး Lisp နဲ့ေရးဖို့ ခ်န္းခ်န္းရဲ့ ဆီဗံုးေလးမွာ ေျပာခဲ့တာေၾကာင့္.. ခ်န္းခ်န္းေအာက္က ကုဒ္ေလးေတြေရးျပီး ကိုဖိုးဆန္းကို testing လုပ္ေစခဲ့ပါတယ္... ကိုဖိုးဆန္းက ခ်န္းခ်န္းရဲ့ coding အားနဲခ်က္ေတြကို ျပင္ေပးျပီး ေရွ့ပိုစ္က ကုဒ္ေလးေတြ ခ်န္းခ်န္းကို ျပန္လည္ေလ့လာေစခဲ့ပါတယ္... ခ်န္းခ်န္းက ပံုေတြေတာ္ေတာ္မ်ားမ်ားဆြဲခဲ့ဖူးပါတယ္.. အလြယ္လမ္းေတြ၊ ျဖတ္လမ္းနည္းေတြလိုက္ရတာကို ေပ်ာ္ေမြ့ေနခဲ့တာၾကာပါျပီ.. ကိုဖိုးဆန္းေရးေပးတဲ့ coding ေတြကိုၾကည့္ျပီး ခ်န္းခ်န္းအေနနဲ့ programming source code ေတြကို အပ်င္းထူအလြယ္မလိုက္သင့္၀ူး ကို မိမိကိုယ္ကို ဆံုးမမိပါတယ္.. ပံုဆြဲတာက ပံုေပၚဖို့အဓိကေပမယ့္ programming နဲ့ ကုဒ္ေတြဖန္တီးျပီဆိုရင္ေတာ့ ေနာက္အသံုးျပဳမယ့္လူေတြအတြက္ ပါ အစစ ထည့္စဥ္းစားထားေပးသင့္တယ္ဆိုတာ ခ်န္းခ်န္း ယံုၾကည့္လက္ခံထားပါတယ္.. ေအာက္မွာေဖၚျပေပးထားတဲ့ ကုဒ္ေတြကို ဖတ္ၾကည့္ျပီး အေပၚက ကုဒ္ေတြနဲ့ compare လုပ္ၾကည့္ရင္း မိမိအလွည့္ ကုဒ္ေတြေရးတဲ့အခ်ိန္မွာအမွားကင္း အမ်ားအသံုး၀င္ တဲ့ စိတ္ကူးမ်ိဳးေတြျဖစ္ေပၚႏိုင္ေစဖို့ ခ်န္းခ်န္းရဲ့ အားနဲခ်က္ေတြနဲ့ကုဒ္ေလးကိုတင္ေပးထားပါတယ္...
(defun C:nuth()
(setvar "cmdecho" 0)
(setq r (getdist "\nEnter Nut Radius: "))
(setq h (getdist "\Enter Nut Height: "))
(command "polygon" "6" "0,0,0" "c" r)
(command "extrude" "l" "" h "")
(command "circle" "0,0,0" r "")
(command "extrude" "l" "" "t""-45" h "")
(command "intersect" "all" "")
(command "-view" "_swiso" "")
(setvar "cmdecho" 1)
(princ)
)
;ဒီကုဒ္ေတြက နပ္တလံုးျဖစ္လာဖို့ idea ကိုပဲေပးပါတယ္ တကယ္သံုးရင္ေတာ့ အဆင္မေျပတာေတြ ၾကံဳေတြ့ရႏိုင္ပါတယ္....

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

လိပ္ႀကီး
06-13-2009, 09:01 PM
အကိုတို႔ေရ
အကိုတို႔ေျပာတဲ့ အၾကာင္းအရာနဲ႔ စပ္စပ္မလားေတာ့ မသိဘူး ကၽြန္ေတာ့ Drawing ေတြမွာ စဖြင့္လိုက္ ရင္

http://img41.imageshack.us/img41/7489/autocadmicros.jpg]http://img41.imageshack.us/img41/7489/autocadmicros.jpg

အထက္ကအတိုင္းေပၚလာပါတယ္ အဲဒါ ဘယ္လိုျဖစ္ လို႔လဲဟင္ သိရင္ ေျပာျပပါ ခင္ဗ်ာ

ေလးစားခင္မင္စြာျဖင့္
lakegyi

chan09
06-13-2009, 10:08 PM
တကယ္လို့ အဲ့ဒိ dwg file ထဲမွာ macro ဖိုင္မသံုး၀ူးဆိုရင္ vbarun ဆိုတဲ့ command ကိုသံုးျပီး ( vba manager ကို click လည္းတူတူေပါ့) ေျဖရွင္းၾကည့္ပါခင္ဗ်ာ... တခါတရံမွသာ ဗိုင္းရပ္ျဖစ္ေနတတ္တာပါ... Enable Macro Virus Protection option ေၾကာင့္ ဖိုင္ထဲမွာ macro ပါလာတယ္ဆိုရင္ ကိုယ္သိထားလား မသိထားလား ဆိုတာ confirm လုပ္တဲ့ သေဘာမိ်ဳးပါပဲ.... vista မွာ ခနခန ေပၚေလ့ရိွတဲ့ allow ႏွိပ္ရေလ့ရိွတဲ့ dialog box မ်ိဳးပါပဲ... ကိုယ္မသိတဲ့ ဟာမိ်ဳးဆိုရင္ေတာ့ do not load , disable တခုခုေပးလိုက္ဖို့ပါပဲ...
ေအာက္မွာ auto desk ကေျပာထားတာေလးတြဲထည့္ေပးလိုက္ပါတယ္...
http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2880499&linkID=9240617
Issue

You want to protect your computer against a virus which may have been included in a Visual Basic macro that has been embedded in a drawing file.

Solution

To turn on macro virus protection:

1. Type vbaman on the command line to open the VBA Manager.
2. Choose Macros. The Macros dialog box will be displayed.
3. In the Macros dialog box, choose Options.
4. In the Options dialog box, checkmark the Enable macro virus protection setting.

When you load a drawing, the Macro Virus Protection feature automatically detects whether a virus exists in an embedded VBA macro. Before the embedded macros are run you will be prompted to choose to either enable or disable the macro.

If the Macro Virus Protection feature is turned off, embedded macros in a drawing may automatically run when you load the drawing, potentially exposing your computer to a security risk.

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

လိပ္ႀကီး
06-13-2009, 10:21 PM
ကိုခ်န္းခ်န္း,
အရမ္းေက်းဇူးတင္ ပါတယ္။
ေနာ္ Office မွာ ႀကိဳးစားၾကည့္လိုက္ပါ့မယ္။

ေက်းဇူးတင္ေလးစားလွ်က္
lakegyi

saiaung
11-17-2009, 11:09 PM
ဒီပုိစ္.ကေတာ့ Autolisp မွာ polar function ကုိသုံးၿပီးေတာ့ ပုံဆြဲတာေလး ပါ..
polar function အလုပ္လုပ္ပုံကေတာ့ (polar point angle distance) ျဖစ္ပါတယ္..
ေအာက္က ကုဒ္မွာဆုိရင္ p2 pkor ဟာစမွတ္ျဖစ္ပါတယ္.. အဲလိုပဲ p3 ဟာ P2 ကစၿပီးသြားပါ့မယ္.. 0 (သုည) ဒီဂရီ အတုိင္း dk အတုိ္င္းအတာကုိ သြားပါ့မယ္..
(pi ဟာ ၁၈၀ ဒီဂရီ ျဖစ္တဲ့အတြက္ (/ pi 2) ၉၀ ဒီဂရီပါ)
က်န္တဲ့အမွတ္ေတြလဲ ဒီလိုပါပဲ အမွတ္ေတြ အားလုံးသတ္မွတ္ၿပီးရင္ line command နဲ. ဆြဲလုိက္ပါတယ္.. "" ကေတာ့ autocad မွာ Enter ပါ..
point ေတြကုိ ျပန္စစ္ခ်င္တယ္ဆုိရင္တာ့ autocad မွာ format point style ကုိ ျမင္သာတဲ့အမွတ္တစ္ခုေရြးၿပီး autocad command prompt မွာ point ရုိက္ထည့္ၿပီး အမွတ္ေတြကုိ !p1 !p2 !p3 ဆုိၿပီး ရုိက္ထည့္လုိက္ရင္ အမွတ္ေတြရွိတဲ့ေနရာကုိ အမွတ္ေလးေတြ ျပေနပါလိမ္.မယ္..
run ပုံ run နည္းကေတာ့ ေအာက္မွာေပးထားတဲ့ ကုဒ္ကုိကူးၿပီး notepad နဲ. .lsp ဆုိၿပီး သိမ္းပါ.. ၿပီးရင္ autocad မွာ vlisp လို.ရုိက္ပါ.. ၿပီးရင္ open ယူ ခုနက သိမ္းခဲ.တဲ့ဖုိင္ကုိ ဖြင့္ပါ... ၿပီးရင္ load active edit window ဆုိရပါၿပီ.
autocad command မွာ draw ဆုိၿပီး ရိုက္ထည့္လုိက္ရင္ ပုံေပၚလာပါမယ္.. ကဲစမ္းၾကည့္က်ပါအုံး အားလုံးအဆင္ေျပပါေစ..

(defun C:draw ()
(setq ak 40.0 ; အတုိင္းအတာေတြပါ
bk 90.0
hk 120.0
dk 50.0
pkor '(100.0 100.0) ;စမွတ္
)
(command "erase" "all" "")
(command "osnap" "off")
(setq pi_2 (/ pi 2))
; ပထမပုံ(ညာဖက္)
(setq p2 pkor)
(setq p3 (polar p2 0 dk))
(setq p4 (polar p3 pi_2 (- dk ak)))
(setq p5 (polar p4 0 (- dk bk)))
(setq p6 (polar p5 pi_2 (/ hk 3)))
(setq p1 (polar p6 0 (- ak dk)))
;ဒုတိယပုံ (ဘယ္ဖက္)
(setq p7 (polar p2 0 (- ak dk)))
(setq p8 (polar p7 pi_2 dk))
(setq p9 (polar p8 0 (- ak dk)))
(setq p10 (polar p9 pi_2 (- dk bk)))
(setq p11 (polar p10 0 (- ak hk)))
(setq p12 (polar p11 pi_2 (- ak dk)))
(setq p13 (polar p12 0 bk))
(command "line" p1 p2 p3 p4 p5 p6 p1"")
(command "line" p7 p8 p9 p10 p11 p12 p13 "")
(command "zoom" "extents")
)

saiaung
11-18-2009, 12:19 AM
http://img4.imageshack.us/img4/9345/20091117204125.png (http://img4.imageshack.us/i/20091117204125.png/)
အေပၚကပုဒ္မွာ ေလာေလာနဲ. ေရးတင္လုိက္တာ အစီအစဥ္မက်ဘူးျဖစ္သြားတယ္ အားနာလုိက္တာဗ်ာ...
အခုဒီေအာက္က ကုဒ္ေတြကုိေတာ့ ေဘးနားမွာ comment ပုံစံနဲ.ပဲ ရွင္းသြားပါ့မယ္.. လိုအပ္မယ္ထင္တာပဲ ရွင္းသြားပါ့မယ္ခင္ဗ်
အဆင္မေျပရင္ျပန္ေဆြးေႏြးေပးပါ..
(defun C:fun ()
(command "_zoom" "_all")
(command "_erase" "_all" "")
(setq d (getreal "input d=")) ;ပုံမွာျပထားတဲ့ အတုိင္းပဲ အကြက္တစ္ကြခ်င္းရဲ. အေရအတြက္ပါ..
(setq h (getreal "input h=")) ;အျမင့္ပါ
(setq n (getint "input n=")) ;အကြက္ အေရအတြက္စုစုေပါင္းပါ
(setq pi_2 (/ pi 2)) ; pi_2 ကု ၉၀ ဒီဂရီပါ
(setq p0 '(100 100)) ;စမွတ္ပါ
(setq p1 p0) ;စမွတ္ကုိ p1 အေနနဲ. ထပ္ယူထားပါတယ္ ဘာလို.လဲဆုိေတာ့ p0 ကပုံေသအမွတ္မုိ.လို.ပါ..
(setq p2 (polar p1 0 d));p2 က p1 ကေန သုည ဒီဂရီ အတုိင္း d အတုိင္းအတာနဲ. ေရွ.ကုိဆြဲပါမယ္
(setq p3 (polar p1 pi_2 h)); P3 ကေတာ့ p1 ကေနပါပဲ အေပၚကုိ ၉၀ ဒီဂရီ h အျမင့္အတုိင္းဆြဲပါမယ္..
(setq p4 (polar p3 0 d)); p4 ကလဲ p3 ကေန ဒီဂရီ အတုိင္း d အတုိင္းအတာနဲ. ေရွ.ကုိဆြဲပါမယ္။ မရွင္းရင္ ပုံကုိၾကည့္ပါ။
(repeat (/ n 2) ; repeat ကေတာ့ repeat ဆိုတဲ့အတုိင္း n/2 အၾကိမ္အေရအတြက္ထိ ေအာက္ကဖန္ရွင္ကုိဆက္လုပ္ေနပါမယ္..
(command "_line" p4 p3 p2 p1 p3 "") ;line ဆြဲလိုက္တာ ပထမ အကြက္ရပါတယ္ ျမင္လားမသိဘူးခင္ဗ်....
(setq p1 p2 ) ;ၿပီးမွ ပထမ အကြက္ p2 ကုိ p1 အျဖစ္ ျပန္သတ္မွတ္လိုက္ပါတယ္ ဒီေနရာေလးမွာ အဓိကပါ နားလည္မယ္လို.ထင္ပါတယ္
(setq p2 (polar p1 0 d)) ;က်န္တာကေတာ့ အေပၚကအတုိင္းပါပဲ
(setq p3 (polar p1 pi_2 h))
(setq p4 (polar p3 0 d))
) ;repeat ကေနထြက္ပါတယ္..
(command "_line" p1 p3 "") ;ဒါကေတာ့ အလယ္က ေထာင္ေနတဲ့မ်ဥ္းပါ..
(command "_mirror" "_crossing" p0 p4 "" p1 p3 "No") ;ပုံကုိကၽြန္ေတာ္တုိ. တစ္ဝက္ပဲ ဆြဲခဲ့တာပါ အဲဒါေၾကာင့္ က်န္တဲ့ တစ္ဖက္ကုိ mirror ယူလိုက္တာပါ
(command "_zoom" "_extents")
(princ)
)

papagyi
11-18-2009, 07:23 AM
ေတာ္ေတာ္ အဆင္ေျပတယ္ဗ်ာ....အခုလိုေ၀မွ်ေပးတာ...အားလံုးကိုယ္စားေက်းဇူးတင္တယ္...
ကၽြန္ေတာ့္စိတ္ထဲေရးေပးခ်င္တာ အဲလိုမ်ိဳးေလးေတြ..မလုပ္ႏိုင္ေသးတာ..အခုအဲလိုမ်ိ္ဳးေလးေတြေရးတာ
၀မ္းသာစရာပါ... :)

saiaung
11-19-2009, 02:52 AM
ဟုတ္ကဲ့ခင္ဗ် ခုလို အားေပးတဲ့အတြက္ ကုိ pargyi ကုိေက်းဇူးတင္ပါတယ္္။ ကၽြန္ေတာ္လဲ တတ္သေလာက္ မွတ္သေလာက္ေလး
ေဆြးေႏြးတာပါ မွားတာရွိရင္ ျပင္ေပးဖုိ. ေတာင္းဆုိပါတယ္... ကၽြန္ေတာ္က autocad ကုိ သိပ္မကၽြမ္းက်င္ေတာ့ အမွားေတြပါလာနုိင္ပါတယ္..
တတ္သေလာက္ေလးေတာ့ ေဆြးေႏြးပါ့မယ္...

saiaung
11-19-2009, 03:08 AM
http://img4.imageshack.us/img4/9988/captaure.jpg (http://img4.imageshack.us/i/captaure.jpg/)
ကၽြန္ေတာ္တုိ. အရင္ပုိ.စ္ေတြမွာလဲ အေျခခံေတာ္ေတာ္မ်ားမ်ားကုိ ေလ့လာၿပီးၿပီ ျဖစ္တဲ့အတြက္
ဒီေန.ေတာ့ autocad command ေတြျဖစ္တဲ့ polar,line,fillet,extrude,region,mass properties ,rotate3d,move
စတဲ့ command ေတြကုိ အသုံးျပဳၿပီးေတာ့ ပုံဆြဲမယ္... တြက္ထုတ္မယ္ အဲဒါေတြ အားလုံးကုိ program ေလးေရးၿပီးေတာ့
လုပ္ၾကည့္ပါ့မယ္.. အခု post မွာေတာ့ polar နဲ. အေပၚက ရွင္းၿပီးသားေတြကုိ မရွင္းေတာ့ပါဘူး ၾကည့္ရတာ ရႈပ္ေနမွာဆုိးလို.ပါ။
ဒီေအာက္က ကုဒ္ေတြဟာ ကၽြန္ေတာ္ တတ္သေလာက္ ေရးထားတာ ျဖစ္တဲ့အတြက္ pro မက်နုိင္ပါဘူး
ကၽြန္ေတာ္လဲ ေလ့လာေနဆဲပါ.. pro တစ္ေယာက္ အေနနဲ. ၾကည့္မယ္ဆုိရင္ေတာ့ အဆင္ေျပမယ္မထင္ဘူးဗ်..
ဘာလုိ.လဲ ဆုိေတာ့ ကၽြန္ေတာ္ နားလည္သလိုေရးထားေရးျပျခင္းသာ ျဖစ္ပါတယ္..
ဘာပဲျဖစ္ျဖစ္ ဒီဖုိရမ္ေလးမွာ ေလ့လာခ်င္တဲ့၊ ခုမွ စေလ့လာမဲ့ ကၽြန္ေတာ့္လုိ အေျခခံသမားေတြ အတြက္ ကၽြန္ေတာ္သိသေလာက္
မွ်ေဝတဲ့ သေဘာပါ.. မွားတာရွိရင္ ျပင္ေပးပါလုိ.လဲ ေတာင္းဆုိခ်င္ပါတယ္..
ဒီေအာက္က post မွာေတာ့ polar နဲ. အေပၚက ရွင္းၿပီးသားေတြကုိ မရွင္းေတာ့ပါဘူး ၾကည့္ရတာ ရႈပ္ေနမွာဆုိးလို.ပါ


(defun c:alisp () ;function နာမည္ပါ
(setq ol 50.0
il 40.0
ih 80.0
oh 100.0
pkor '(100.0 100.0)
ra 5.0
ext 300.0
)
(command "osnap" "off")
(command "vpoint" "0,0,1");ဒါကေတာ့ ဘယ္view ကဖြင့္ဖြင့္ အဆင္ေျပေအာင္ေရးထည့္ထားတာပါ
(command "zoom" "all")
(command "erase" "all" "")
(setq pi2 (/ pi 2))
(setq p3 pkor )
(setq p4 (polar p3 0 ol))
(setq p5 (polar p4 pi2 (- ol il)))
(setq p6 (polar p5 0 (- il)))
(setq p7 (polar p6 pi2 ih))
(setq p8 (polar p7 0 il))
(setq p1 (polar p8 pi2 (- ol il)))
(setq p2 (polar p1 0 (- ol)))
(command "line" p1 p2 "")
(setq lin1 (entlast)) ;entlast ဆိုတာကေတာ့ p1 နဲ. p2 ဆက္ထားတာကုိ lin1 ဆုိၿပီး နာမည္ သတ္မွတ္လိုက္တာပါ
(command "line" p2 p3 "");နာမည္သတ္မွတ္ရတဲ့ အေၾကာင္းရင္းကေတာ့ fillet လုပ္လုိ.အဆင္ေျပေအာင္ပါ
(setq lin2 (entlast))
(command "line" p3 p4 "")
(setq lin3 (entlast))
(command "line" p4 p5 "")
(setq lin4 (entlast))
(command "line" p5 p6 "")
(setq lin5 (entlast))
(command "line" p6 p7 "")
(setq lin6 (entlast))
(command "line" p7 p8 "")
(setq lin7 (entlast))
(command "line" p8 p1 "")
(setq lin8 (entlast))
;fillet
(command "fillet" "r" ra "fillet" lin4 lin5);fillet ပါ ကၽြန္ေတာ္တုိ. acad မွာသုံးတာနဲ.တူတူပါပဲ "r" radius
(command "fillet" "r" ra "fillet" lin6 lin7); ra က အေပၚမွာသတ္မွတ္ထားပါတယ္ 5.0 ပါ
(command "fillet" "r" ra "fillet" lin7 lin8)
(command "fillet" "r" ra "fillet" lin5 lin6)
;region
(command "region" "crossing" p4 p2 "");region ပါ crossing p4 p2 အမွတ္ကုိ select လုပ္လုိက္ပါတယ္
(command "massprop" p3 "" "yes" "H:/lisp_post/reg1.mpr") ;massprop ရွာတာပါ P3 အမွတ္ select လုပ္ပါတယ္ yes ဆုိတာကေတာ့ သိမ္းမယ္လုိ.ေျပာတာပါ ; ေနာက္က ဖုိင္သိမ္းမဲ. လမ္းၾကာင္းေလးပါ
(command "_extrude" "crossing" p4 p2 "" ext ""); extrude ပါ crossing p4 p2 အမွတ္ကုိ select လုပ္လုိက္ပါတယ္ တန္ဖုိးကေတာ့ အေပၚက ေပးထားတဲ့တန္ဖုိးပါ
(setq reg1 (entlast)) ;region လုပ္ထားတာကုိ reg1 ဆုိၿပီး နာမည္သတ္မွတ္ပါတယ္..
;ဒုတိယပုံအတြက္ပါ
(setq p9 (polar p3 0 (- il ol)))
(setq p10 (polar p9 pi2 ol))
(setq p11 (polar p10 0 (- il ol)))
(setq p12 (polar p11 pi2 (- il)))
(setq p13 (polar p12 0 (- ih)))
(setq p14 (polar p13 pi2 (- il ol)))
;line ဆြဲပါတယ္
(command "line" p9 p10 "")
(setq lin9 (entlast))
(command "line" p10 p11 "")
(setq lin10 (entlast))
(command "line" p11 p12 "")
(setq lin11 (entlast))
(command "line" p12 p13 "")
(setq lin12 (entlast))
(command "line" p13 p14 "")
(setq lin13 (entlast))
(command "line" p14 p9 "")
(setq lin14 (entlast))
;fillet လုပ္ပါတယ္
(command "fillet" "r" ra "fillet" lin10 lin11)
(command "fillet" "r" ra "fillet" lin11 lin12)
(command "fillet" "r" ra "fillet" lin12 lin13)
;region
(command "region" "c" p10 p14 "")
(command "massprop" p9 "" "yes" "H:/lisp_post/reg2.mpr")
(command "extrude" "crossing" p9 p11 "" ext "")
(setq reg2 (entlast))
(command "rotate3d" reg2 "" p9 p4 90) ;rotate3d နဲ.၉၀ ဒီဂရီ လွည့္ပါတယ္..
(setq pm1 (polar p9 (- pi2) (/ ext 2))) ;move လုပ္ခ်င္တဲ. အမွတ္ကုိ သတ္သတ္ရွာလုိက္တာပါ
(setq pm2 (polar p3 pi2 (/ oh 2)))
(command "_move" reg2 "" pm1 pm2) ;အေပၚက အမွတ္အတုိင္း ေရြ.ပါတယ္..
(command "zoom" "extents")
(command "vpoint" "-1,-1,1")
); end
Englis version မဟုတ္ဘူးဆိုရင္ ကုိသုံးခ်င္တဲ့ ေအာ္တုိကဒ္ commande ေရွ.မွာ "_" ခံေပးမွ အဆင္ေျပပါတယ္..

safe.strong
01-29-2010, 02:12 PM
Short cut solutions in Auto lisp (autoCAD),DCL.
I have been used LSP since 1997 (version 12 & 13)
NOw, I am not, but i know a little
This is , Just to share some thing.
Sorry for some mistake happening on my ...........

At AutoCAD 10, LSP is introduced as extension module, like as 3D commands ( at this time, 3D features are not built in autocad).
At auto CAD 12 ( DOS version), Lsp is built in ( I noticed). but, there is no help files for LSP.
AT AutoCAD version 13 ( window version), Lsp help files are ready to learn.
Sorry, Above those are what i noticed on lsp.

LSP is formally used for AI facilities ( research ). so called fifth generation.
LSP language is design to handle for complex data types.
(symbolic understanding) < like as brain memories>

The data formats of autocad are complex.
Link list data structure : Series of data
Tree->branches->leaves & others
(how to say: group of data with difference index) <example: type at command line -> (entget (car (entsel)))
data structure of selected object is return at command line.
So, Lsp is easy to handle those type of data.

Language is easy:
Function call -> (
Function end-> )

For calculation like as: 1+2+3=6
how to write in lsp :
Verb + nouns pattern
Do plus 1 and 2 and 3.
Type at command line of autoCAD
(+ 1 2 3)
So, it will return 6.

(function variables)
OK, It may become a long story.

Here is a simple lsp
That is to change ploy line width of selected object.
------------------------------------------------------------------------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;Pline or Line Width editing to be fixed width. ;
;;; ;
;;;If you want to update this program or to improve your autoCAD section, ;
;;;complex or not. TYPE: plws at command line ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Thank you:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Start of program
(DEFUN C:PLWS ( / w selo i seloi cmdold) ;
(setq cmdold (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq i 0)
(SETQ w (GETREAL "\nEnter Line Width:"))
(command "_undo" "g")
(setq w (rtos w 2 2 ))
(princ "\nSelect Lines or Pline")
(setq selo (ssget))
(while (< i (sslength selo))

(if (= "LINE" (cdr (assoc 0 (entget (setq seloi (ssname selo i))))))
(progn
(command "_pedit" seloi "" "Width" w "")
(command)
)
)
(if (= "LWPOLYLINE" (cdr (assoc 0 (entget (setq seloi (ssname selo i))))))
(progn
(command "_pedit" seloi "Width" w "")
(command)
)
)
(if (= "ARC" (cdr (assoc 0 (entget (setq seloi (ssname selo i))))))
(progn
(command "_pedit" seloi "Width" w "")
(command)
)
)
(setq i (+ i 1))
);while end
(command "_undo" "e")
(setvar "cmdecho" cmdold)
)
; end of program
------------------------------------------------------------------------------------------------------------------------
Good luck every body, See you

tinmyo
03-06-2010, 06:45 PM
အကိုတိူ႕ေရ offset command အတြက္ code ေလးနမူနာေရးျပပါလားဗ်ာ။ အဓိက ကေတာ့ဘယ္side ကိုပစ္မလဲဆိုတာ point ဘယ္လိုျပရမလဲဆိုတာပါ။
offset 3" ပစ္ခ်င္တာကိုဒီလိုေရးထားတာေရးထားတာအဆင္မေျပဘူးျဖစ္ေနတယ္။ကူညီၾကပါဦး
(defun c:or () (command "o" "3" (ssget)"" (pause)""
(princ))

saiaung
03-06-2010, 09:12 PM
(defun c:ce (/ ent pt)
(while (and
(setq ent (car (entsel "\nSelect object to offset or <exit>:")))
(setq pt (getpoint "\nSpecify point on side to offset:"))
)
(command "._offset" 3 ent "_non" pt "")
(command "._change" (entlast) "" "_P" "_LA" "0" "")
)
(princ)
)

saiaung
03-06-2010, 09:47 PM
ဒါေလးကေတာ့ ပုိလြယ္မယ္ထင္ပါတယ္..
(defun c:or (/ d l s )

(setq d (getdist "\n Offset distance: ")
l (entsel "\n Select line to offset: ")
s (getpoint "\n pick up point to offset: ")
)
(command "offset" d l s "")

(princ)
)

saiaung
03-07-2010, 12:08 AM
ဒါကေတာ့ array offset လုပ္တာေလးပါ.....
(defun c:aroff (/ a d l s )
(initget 7) ;ဒါကေတာ့ အေပါင္းကိန္းမွ အလုပ္လုပ္မယ္ဆုိတဲ့ သေဘာပါ
(setq a (getint "\n Number of offsets: ") ;offset လုပ္မဲ့ အေရအတြက္ ကုိေတာင္းတာပါ
d (getdist "\n Offset distance: ") ;offset လုပ္မဲ့ အကြာအေဝးကုိေတာင္းတာပါ
l (entsel "\n Select line to offset: ") ; line ျဖစ္ျဖစ္ entity ျဖစ္ျဖစ္ select လုပ္ခုိင္းတာပါ
s (getpoint "\n pick up point to offset: ") ;offset လုပ္ခ်င္တဲ့ side ဖက္ အမွတ္ကုိမွတ္ေပးတာပါ
oecho (getvar "cmdecho")
)
(setvar "cmdecho" 0)
(while (> a 0) ;a ရဲ.တန္ဖုိးဟာ သုညငယ္မွ while looping ထဲကထြက္ပါမယ္
(command "offset" d l s "") ; ဒါကေတာ့ offset လုပ္တာပါပဲ
(setq a (- a 1) ;a ရဲ.တန္ဖုိးကုိ ၁ နႈတ္ၿပီးေတာ့မွ ဆက္လုပ္သြားမွာပါ
l (entlast) ; l ဆုိတာက select လုပ္တာပါ ေနာက္ဆုံးဆြဲခဲ့တဲ့ offset ကုိ ျပန္မွတ္သားထားတဲ့သေဘာပါ
))
(setvar "cmdecho" oecho)
(princ)
)
;ဒီေနရာမွ တစ္ခုေျပာခ်င္တာက point ကုိယူတဲ့အခ်ိန္မွာ အေဝးၾကီးယူဖုိ.လိုပါမယ္ နုိ.မုိ.ဆုိ အကုန္ေပၚမွာမဟုတ္ပါဘူး
ဥပမာ။ ။ offset လုပ္ခ်င္တဲ့ အေရအတြက္က 10 ခု အကြာအေဝးက 10 ဆုိရင္ point ယူတဲ့အခ်ိန္မွာ ၁၀၀ ထက္ပုိတဲ့ အကြာအေဝးမွာ ယူဖုိ.လိုပါမယ္

with regards
saiaung

tinmyo
05-29-2010, 12:18 PM
အကိုတို႕ေရ ဒီေခါင္းစဥ္ကို ဒီ႕ထက္အက်ယ္တ၀င္႕ဆက္ျပီးေဆြးေႏြးေစခ်င္ပါတယ္။ျဖစ္နိူင္ရင္ AutoCAD အေျခခံ command ေလးေတြဘယ္လုိေရးထားတယ္ဆိုတာကစျပီး ေျပာျပေပးေစခ်င္ပါတယ္


ေလးစားအားကိုးလ်က္

febb
06-16-2010, 03:27 PM
hi everyone,

how to create Autolisp for dimordinate like attach file?
please help.

thanks and regards,
Febb

aung hlaing
12-11-2010, 07:25 PM
အကိုေရ...

ကြ်န္ေတာ္အကိုတို႕ရဲ႕ .lsp ဖိုင္ေလးေတြကို AP လုပ္ၾကည္႕တာ.. အဆင္မေျပဘူးျဖစ္ေနတယ္ဗ်ာ..."; error: malformed list on input" အဲ့ဒီလို႕ေပၚ ေနတယ္... ကြ်န္ေတာ္ လည္း သူငယ္ခ်င္းတစ္ေယာက္ဆီကေန ၿပီး list ေရးနည္းေလး တစ္ခု သင္ေနတာ..ဗ်ာ.. သူဟာေလးကေတာ့ တစ္မ်ိဳးဗ်.. ကြ်န္ေတာ္ M&E အတြက္ Layer ေလးေတြလုပ္ထားတယ္...အကိုနည္းေတြကို ေလ႕လာေနပါတယ္...

ကိုအင္းသား
12-30-2010, 10:33 PM
Autocad မွာ programing language တစ္မ်ိဳးမက run နိုင္ပါတယ္။..Visual , C ++...စသျဖင့္ေပါ့။
ဘယ္လိုပဲျဖစ္ျဖစ္ autocad user စစ္တစ္ေယာက္အတြက္ကေတာ့ အက်ိဳးရွိဆံုးကေတာ့ Lisp programing ေပၚအေျခခံတဲ႕
Autolisp programing ပါ။..ကၽြန္ေတာ္တို႕သံုးေနတဲ႕ autocad command ေတြက autolisp နဲ႕ပဲေရးျပီး
လုပ္ထားတဲ႕ edit လုပ္လို႕ရတဲ႕ .lisp file ေတြ၊ autolisp file ကို edit လုပ္ခြင့္မရေအာင္ complied လုပ္ထားတဲ႕
.fas file ေတြနဲ႕ run ေနတာအမ်ားဆံုးပါ။ဒါေၾကာင့္ autolisp programing ရဲ႕ တစ္စိတ္ပိုင္း ျဖစ္တဲ႕
Micro lisp အတိုေလးေတြ စေရးဖို႕ၾကိဳးစားသင့္ပါတယ္။လုပ္ငန္းခြင္မွာ မ်ားစြာ အေထာက္အကူျဖစ္ပါလိမ့္မယ္။
ေလ့လာၾကည့္ၾကပါလို႕ပဲ တိုက္တြန္းလိုက္ပါတယ္။

AutoCAD မွာLisp File ေရးတာေတာ့ နည္းနည္း တီးမိေခါက္မိပါတယ္၊ *.fas File ကိုေတာ့ ဘယ္လုိေရးမွန္း မသိဘူး။ နည္းနည္းေလာက္ ေျပာျပေပးပါလား

papagyi
01-01-2011, 10:39 PM
Sorry ပါဗ်ာ....ကၽြန္ေတာ္ အေတာ္ ေ၀းေနျပီဗ်...lisp နဲ႔ ..... အမွားပါမွာ စိုးလို႔ပါ။ ကၽြန္ေတာ္ မွတ္မိသေလာက္က *.fas ဆိုတာ lisp editor ထဲကေန ထုတ္လိုက္ရုံပဲထင္တယ္ဗ်။
သူက ေရးစရာမလိုပါဘူး...autolisp file ေတြ ကို ေပါင္းစပ္ျပီး အေသ တစ္ဖိုင္တည္း edit လုပ္မရေအာင္ ေျပာင္းလိုက္တဲ့ file type တစ္မ်ိဳးပါ..
တစ္ကယ္ ၀ါသနာပါရင္ autocad help ထဲက တင္ အမ်ားၾကီး ေလ့လာလို႔ရပါတယ္....ထပ္ျပီး ေဆြးေႏြးခ်င္ ..ေမးခ်င္ရင္ ..ေလ့လာခ်င္ရင္ http://www.cadtutor.net/forum/forumdisplay.php?21-AutoLISP-Visual-LISP-amp-DCL
အဲဒီမွာ free account လုပ္ျပီး ေလ့လာပါ။အမ်ားၾကီး အဆင္ေျပပါလိမ့္မယ္ ...:peace:

ကိုဖိုးေဇာ္
01-04-2011, 05:19 PM
အေပၚမွာ ကို papagyi ေျပာသလို ပါဘဲ fas file ေတြကို သီးသန္႕ ေရးယူလို႕ မရပါဘူး.. နည္းနည္းေလး ထပ္ျဖည့္ခ်င္လို႕ပါ...

fas file ေတြက machine understandable only ပါ.. lsp file ကေန ေျပာင္းယူရပါတယ္.. သူ႕ ရဲ႕ အားသာခ်က္က load လုပ္ရာမွာ lsp file ထက္ပိုၿပီး ျမန္ဆန္ပါတယ္... လူ နားမလည္ ေအာင္ ေျပာင္းပစ္တဲ့ အတြက္ ကိုယ္ေရးထားတဲ့ source code ကို လုံျခဳံမႈ ပိုေကာင္းေစပါတယ္.. commercial လုပ္မယ္ဆိုရင္ source code ေပးမသုံးဘဲ program ဘဲ ေပးသုံးမယ္ ဆိုတာမ်ိဳးမွာ အသုံး၀င္ပါတယ္..

visual lisp editor မွာ make application / rebuild application အစရွိတဲ့ program ေတြကို compile လုပ္ေပးႏိုင္တဲ့ facility ေတြ ပါ ပါတယ္.. သူက တခုထက္ ပိုတဲ့ lisp file ေတြကို application package တခု အေနနဲ႕ လုပ္ေပးပါတယ္.. အဲဒီ application package ကို *.VLX extension နဲ႕ သိမ္းေပးပါတယ္.. တခ်ိန္တည္းမွာဘဲ lsp extension file ေတြကို fas file အသီးသီး ေျပာင္းေပးပါတယ္.. lsp file တခုကို fas file တခု ေျပာင္းေပးတာပါ..

ူlisp program package လုိက္ လုပ္ထားတဲ့ *.vlx ကို ဘဲ ျဖစ္ျဖစ္.. complie လုပ္ရာမွာ ရလာတဲ့ fas file ေတြ တခုခ်င္း ကိုဘဲ ျဖစ္ျဖစ္.. ပင္ရင္း lisp file ေတြကို ဘဲ ျဖစ္ျဖစ္ loap application wizard နဲ႕ ေခၚၿပီးသုံးႏုိင္ပါတယ္..

လုပ္ေဆာင္ခ်က္က မူရင္း lisp file မွာ ေရးထားတဲ့ အတုိင္းဘဲ လုပ္ေဆာင္မွာ ျဖစ္ၿပီး အားသာခ်က္ကေတာ့ vlx က ကုိယ္ သုံးခ်င္တဲ့ file အမ်ားအျပားကို တစုတေ၀းတည္း တခါတည္း နဲ႕ တင္ႏုိင္ပါတယ္... fas file ကေတာ့ အထက္မွာ ေရးထားသလိုပါဘဲ.. fast loading နဲ႕ security ပိုေကာင္းပါတယ္...