Код скрипта:
Код
Procedure DeleteBodies;
var
CurrentPCBBoard : IPCB_Board;
Iterator : IPCB_BoardIterator;
Body : IPCB_ComponentBody;
BodyList : TInterfaceList;
I : Integer;
Begin
CurrentPCBBoard := PCBServer.GetCurrentPCBBoard;
If CurrentPCBBoard = Nil Then Exit;
Iterator := CurrentPCBBoard.BoardIterator_Create;
If Iterator = Nil Then Exit;
Iterator.AddFilter_ObjectSet(MkSet(eComponentBodyObject));
Iterator.AddFilter_LayerSet(AllLayers);
Iterator.AddFilter_Method (eProcessAll);
BodyList := TInterfaceList.Create;
Try
Body := Iterator.FirstPCBObject;
While Body <> Nil Do
Begin
BodyList.Add(Body);
Body := Iterator.NextPCBObject;
End;
Finally
CurrentPCBBoard.BoardIterator_Destroy(Iterator);
End;
Try
PCBServer.PreProcess;
For I := 0 to BodyList.Count - 1 Do
Begin
Body := BodyList.items[I];
CurrentPCBBoard.RemovePCBObject(Body);
End;
Finally
PCBServer.PostProcess;
BodyList.Free;
End;
CurrentPCBBoard.ViewManager_FullUpdate;
Client.SendMessage('PCB:Zoom', 'Action=Redraw' , 255, Client.CurrentView);
End;
var
CurrentPCBBoard : IPCB_Board;
Iterator : IPCB_BoardIterator;
Body : IPCB_ComponentBody;
BodyList : TInterfaceList;
I : Integer;
Begin
CurrentPCBBoard := PCBServer.GetCurrentPCBBoard;
If CurrentPCBBoard = Nil Then Exit;
Iterator := CurrentPCBBoard.BoardIterator_Create;
If Iterator = Nil Then Exit;
Iterator.AddFilter_ObjectSet(MkSet(eComponentBodyObject));
Iterator.AddFilter_LayerSet(AllLayers);
Iterator.AddFilter_Method (eProcessAll);
BodyList := TInterfaceList.Create;
Try
Body := Iterator.FirstPCBObject;
While Body <> Nil Do
Begin
BodyList.Add(Body);
Body := Iterator.NextPCBObject;
End;
Finally
CurrentPCBBoard.BoardIterator_Destroy(Iterator);
End;
Try
PCBServer.PreProcess;
For I := 0 to BodyList.Count - 1 Do
Begin
Body := BodyList.items[I];
CurrentPCBBoard.RemovePCBObject(Body);
End;
Finally
PCBServer.PostProcess;
BodyList.Free;
End;
CurrentPCBBoard.ViewManager_FullUpdate;
Client.SendMessage('PCB:Zoom', 'Action=Redraw' , 255, Client.CurrentView);
End;