function acAddMLine(IAcad:IAcadApplication;MStyle:string;MJust:integer;MScale:double):IAcadMLine;
label 1;
var Point:OleVariant;
n,
i,
cJust:integer;
sSet:IAcadSelectionSet;
cStyle,
s,
sCoord:string;
cScale:double;
begin
Result:=nil;
n:=1;
Point:=EmptyParam;
try
1: Point:=IAcad.ActiveDocument.Utility.GetPoint(Point, 'Укажите '+IntToStr(n)+'-ю точку');
Str(Point[0]:0:4,s); sCoord:=sCoord+s+',';
Str(Point[1]:0:4,s); sCoord:=sCoord+s+' ';
Inc(n);
goto 1;
except
end;
if n>=3 then
begin
cStyle:=IAcad.ActiveDocument.GetVariable('CMLSTYLE');
cJust:=IAcad.ActiveDocument.GetVariable('CMLJUST');
cScale:=IAcad.ActiveDocument.GetVariable('CMLSCALE');
IAcad.ActiveDocument.SetVariable('CMLSTYLE',MStyle);
IAcad.ActiveDocument.SetVariable('CMLJUST',MJust);
IAcad.ActiveDocument.SetVariable('CMLSCALE',MScale);
IAcad.ActiveDocument.SendCommand('mline '+sCoord+' ');
sSet:=IAcad.ActiveDocument.SelectionSets.Add('ssSet');
sSet.Select(acSelectionSetLast,EmptyParam,EmptyParam,EmptyParam,EmptyParam);
Result:=sSet.Item(0) as IAcadMLine;
sSet.Delete;
IAcad.ActiveDocument.SetVariable('CMLSTYLE',cStyle);
IAcad.ActiveDocument.SetVariable('CMLJUST',cJust);
IAcad.ActiveDocument.SetVariable('CMLSCALE',cScale);
end;
end;
Пример:
acAddMLine(IAcad,'standart',1,50).Update;