Вот, что я писал на другом языке дя другого CAD'а. Может поможет.
// Shaft-31 .
// Macro, which creates figure "Shaft - cylinder"
// Author ++++++++++ July 1997
// Copyright ? ++++++++ 3d-forma
// Phone (000) +++++++
// Compuserve ------------------
// ****** DATA DECLARATION ******
HANDLE hDlg;
NUMBER d,l,n1ci,n2co,CheckPrj,CheckDim,nCheckAxis;
STRING sText, lText,sNumber;
XY xyStart;
//d1=0
Undo("start");
// ****** DIALOG BOX ******
hDlg = Open("dialog", "Shaft-cylinder", "font Arial 8", 150, 48,110,95);
AddControl(hDlg, "bitmap",1, 1, 108,39,"c:/Softdesk/Macros-3/W_31B.BMP","" ,""); //stretch
AddControl(hDlg, "gray", 0,0, 110, 35, "", "", "");
AddControl(hDlg, "ltext", 4, 42, 20, 10, "D=", "", "");
AddControl(hDlg, "ledit", 20, 40, 30,12, "", "NUMBER", "d");
AddControl(hDlg, "ltext", 54, 42, 20, 10, "L=", "", "");
AddControl(hDlg, "ledit", 70, 40, 30,12, "", "NUMBER", "l");
AddControl(hDlg, "checkbox left", 4, 60, 25, 15, "Prj", "Number", "CheckPrj");
AddControl(hDlg, "checkbox left", 40, 60, 30, 15, "Axis", "Number", "nCheckAxis");
AddControl(hDlg, "checkbox left", 80, 60, 25, 15, "Dim", "Number", "CheckDim");
AddControl(hDlg, "defaultbutton", 26, 80, 30, 12, "OK", "%ok", ""); //highlighted "ok" box
AddControl(hDlg, "pushbutton", 60, 80, 30, 12, "Cansel", "%cancel", ""); //unhighlighted "cancel" box
//Display dialog box
Ok = Display("dialog", hDlg, "%center"); // by typing %center inside the last quotes
// the entire box will appear in the center
Close("dialog", hDlg); // this closes the dialog box and removes it from view
if(Ok != %ok) // Continue if OK
{
Undo("end");
Exit(%ok, "User Canceled !");
}
// Information from User
sText = sText+" ";
i = Value("scalar", sNumber);
// Major Loop
if(!GetUser("xy", "Select position for figure", &xyStart))
{
Undo("end");
Exit(%ok, "Done !");
}
SetData("PenColor",-1);
SetData("PenStyle", -1);
SetData("PenWidth",-1);
hEntity = AddEntity("line", xyStart.x,xyStart.y+d/2,xyStart.x,xyStart.y-d/2);
hEntity = AddEntity("line", xyStart.x,xyStart.y+d/2,xyStart.x+l,xyStart.y+d/2);
hEntity = AddEntity("line", xyStart.x,xyStart.y-d/2,xyStart.x+l,xyStart.y-d/2);
hEntity = AddEntity("line", xyStart.x+l,xyStart.y+d/2,xyStart.x+l,xyStart.y-d/2);
if(nCheckAxis==1)
{
SetData("PenColor", 4);
SetData("PenStyle", 6);
SetData("PenWidth",0);
hEntity = AddEntity("line", xyStart.x-3,xyStart.y,xyStart.x+l+3,xyStart.y);
}
if(CheckPrj==1)
{
SetData("PenColor",-1);
SetData("PenStyle", -1);
SetData("PenWidth",-1);
hEntity = AddEntity("circle", xyStart.x+l+d,xyStart.y,d/2);
if(nCheckAxis==1)
{
SetData("PenColor", 4);
SetData("PenStyle", 6);
SetData("PenWidth",0);
hEntity = AddEntity("line", xyStart.x+l+d/2-3,xyStart.y,xyStart.x+l+1.5*d+3,xyStart.y);
hEntity = AddEntity("line", xyStart.x+l+d,xyStart.y+d/2+3,xyStart.x+l+d,xyStart.y-d/2-3);
}
}
if(CheckDim==1)
{
hEntity = AddEntity("dimlin", "horizontal", xyStart.x,xyStart.y-d/2,xyStart.x+l,xyStart.y-d/2,2.5,xyStart.y-d/2-8,0);
hEntity = AddEntity("dimlin", "vertical", xyStart.x,xyStart.y+d/2,xyStart.x,xyStart.y-d/2,xyStart.x-8,0);
}
sText = MakeString("long", d);
lText = MakeString("long", l);
//SetData("Font",14);
SetData("PenColor", 6);
hEntity = AddEntity("text", "D="+sText, xyStart.x+2, xyStart.y+d/5,1.6,2,0);
hEntity = AddEntity("text", "L="+lText, xyStart.x+16, xyStart.y+d/5,1.6,2,0);
//SetData("PenStyle", 0);
// Exit if in error
Exit(%ok, "OK !");