procedure TForm1.Button2Click(Sender: TObject);
var
obj_polyline,obj_line,Rectangularpolyline:Variant;
DistBetweenRows, DistBetweenColumns, DistBetweenLevels:double;
NumberOfRows,NumberOfColumns,NumberOfLevels:integer;
fitpoints:Variant;
point1,point2:Variant;
intPoints:Variant; //保存交点
k,i,num:integer;
str:string;
begin
k:=0;
point1:=VarArrayCreate([0,2],VarDouble);
point2:=VarArrayCreate([0,2],VarDouble);
for i:=0 to 5 do
begin
fitpoints:=VarArrayCreate([0,5],VarDouble);
fitpoints[0]:=0+3*i;fitpoints[1]:=0;fitpoints[2]:=0;
fitpoints[3]:=5+3*i;fitpoints[4]:=5;fitpoints[5]:=0;
obj_Polyline:=obj_ModelSpace.AddPolyline(fitpoints);
point1[0]:=i+0.0;point1[1]:=0.0;point1[2]:=0.0;
point2[0]:=i+0.0;point2[1]:=5.0;point2[2]:=0.0;
obj_line:=obj_ModelSpace.Addline(point1,point2);
intPoints:=obj_line.IntersectWith(obj_polyline, 0);
if VarIsArray(intPoints) then
k:=k+1;
if k<>2 then
obj_line.Delete
else
Exit;
end;
end;
end.红色的代码不能实现,也是问题的关键,有哪位朋友可以帮忙解决下