Var
Board : IPCB_Board;
WorkSpace : IWorkSpace;
Procedure PlaceASimplePad(x,y:double,des:string,xSize,ySize:double);
Var
Pad : IPCB_Pad;
Padcache : TPadCache;
Begin
(* Create a Pad object*)
Pad := PCBServer.PCBObjectFactory(ePadObject, eNoDimension, eCreate_Default);
// Location of pad on the PCB document.
Pad.X := MilsToCoord(x);
Pad.Y := MilsToCoord(y);
// set up attributes of pad.
Pad.HoleSize := MilsToCoord(0);
Pad.Name := des;
Pad.Mode := ePadMode_Simple;
// For a simple pad, only need TopShape, TopXSize, TopYSize
Pad.TopShape := eRounded;
Pad.TopXSize := MilsToCoord(xSize);
Pad.TopYSize := MilsToCoord(ySize);
(* Assign the new pad cache to the pad*)
Pad.SetState_Cache := Padcache;
Board.AddPCBObject(Pad);
End;
(*create a new pcb document *)
WorkSpace := GetWorkSpace;
If WorkSpace = Nil Then Exit;
Workspace.DM_CreateNewDocument('PCB');
If PCBServer = Nil Then Exit;
Board := PCBServer.GetCurrentPCBBoard;
If Board = Nil then exit;
(* Place new PCB objects*)
x := 33; //行间距 mil
y := 16.5;//列间距 mil
xSize := 12.650; //焊盘大小 mil
ySize := 12.650; //焊盘大小 mil
pads:=1;
For Col:=1 to 50 do //列焊盘数
begin
if(col mod 2) = 1 then
x := 33
else
x := 49.5;
For Row := 1 to 50 do //行焊盘数
begin
if ((Row mod 2) = 1) and ((Col mod 2) = 1) then
begin
PlaceASimplePad(x,y,des[Col] + IntToStr(Row),xSize,ySize);
x := x + 33; //行间距 自行修改 mil
end else
begin
if((Col mod 2) = 0) and ((Row mod 2 )= 0) then
begin
PlaceASimplePad(x,y,des[Col] + IntToStr(Row),xSize,ySize);
x := x + 33; //行间距,自行修改 mil
end;
end;
end;
pads := 1;
y:=y + 16.5; //列间距 mil 自行修改
end;
(* Refresh PCB workspace *)
ResetParameters;
AddStringParameter('Action', 'All');
RunProcess('PCB:Zoom');
End;
[/hide]
[此贴子已经被作者于2009-2-12 12:07:00编辑过]