549 lines
29 KiB
ObjectPascal
549 lines
29 KiB
ObjectPascal
Var
|
|
CurrentSCHLib : ISch_Lib;
|
|
CurrentLib : IPCB_Library;
|
|
|
|
Function CreateAComponent(Name: String) : IPCB_LibComponent;
|
|
Var
|
|
PrimitiveList: TInterfaceList;
|
|
PrimitiveIterator: IPCB_GroupIterator;
|
|
PrimitiveHandle: IPCB_Primitive;
|
|
I: Integer;
|
|
|
|
Begin
|
|
// Check if footprint already in library
|
|
Result := CurrentLib.GetComponentByName(Name);
|
|
If Result = Nil Then
|
|
Begin
|
|
// Create New Component
|
|
Result := PCBServer.CreatePCBLibComp;
|
|
Result.Name := Name;
|
|
End
|
|
Else
|
|
Begin
|
|
// Clear existin component
|
|
Try
|
|
// Create List with all primitives on board
|
|
PrimitiveList := TInterfaceList.Create;
|
|
PrimitiveIterator := Result.GroupIterator_Create;
|
|
PrimitiveIterator.AddFilter_ObjectSet(AllObjects);
|
|
PrimitiveHandle := PrimitiveIterator.FirstPCBObject;
|
|
While PrimitiveHandle <> Nil Do
|
|
Begin
|
|
PrimitiveList.Add(PrimitiveHandle);
|
|
PrimitiveHandle := PrimitiveIterator.NextPCBObject;
|
|
End;
|
|
|
|
// Delete all primitives
|
|
For I := 0 To PrimitiveList.Count - 1 Do
|
|
Begin
|
|
PrimitiveHandle := PrimitiveList.items[i];
|
|
Result.RemovePCBObject(PrimitiveHandle);
|
|
Result.GraphicallyInvalidate;
|
|
End;
|
|
|
|
Finally
|
|
Result.GroupIterator_Destroy(PrimitiveIterator);
|
|
PrimitiveList.Free;
|
|
End;
|
|
End;
|
|
End;
|
|
|
|
Procedure CreateSMDComponentPad(NewPCBLibComp : IPCB_LibComponent, Name : String, Layer : TLayer, X : Real, Y : Real, OffsetX : Real, OffsetY : Real,
|
|
TopShape : TShape, TopXSize : Real, TopYSize : Real, Rotation: Real, CRRatio : Real, PMExpansion : Real, SMExpansion : Real,
|
|
PMFromRules : Boolean, SMFromRules : Boolean);
|
|
Var
|
|
NewPad : IPCB_Pad2;
|
|
PadCache : TPadCache;
|
|
|
|
Begin
|
|
NewPad := PcbServer.PCBObjectFactory(ePadObject, eNoDimension, eCreate_Default);
|
|
NewPad.HoleSize := MMsToCoord(0);
|
|
NewPad.Layer := Layer;
|
|
NewPad.TopShape := TopShape;
|
|
if TopShape = eRoundedRectangular then
|
|
NewPad.SetState_StackCRPctOnLayer(eTopLayer, CRRatio);
|
|
NewPad.TopXSize := MMsToCoord(TopXSize);
|
|
NewPad.TopYSize := MMsToCoord(TopYSize);
|
|
NewPad.RotateBy(Rotation);
|
|
NewPad.MoveToXY(MMsToCoord(X), MMsToCoord(Y));
|
|
NewPad.Name := Name;
|
|
|
|
Padcache := NewPad.GetState_Cache;
|
|
if (PMExpansion <> 0) or (PMFromRules = False) then
|
|
Begin
|
|
Padcache.PasteMaskExpansionValid := eCacheManual;
|
|
Padcache.PasteMaskExpansion := MMsToCoord(PMExpansion);
|
|
End;
|
|
if (SMExpansion <> 0) or (SMFromRules = False) then
|
|
Begin
|
|
Padcache.SolderMaskExpansionValid := eCacheManual;
|
|
Padcache.SolderMaskExpansion := MMsToCoord(SMExpansion);
|
|
End;
|
|
NewPad.SetState_Cache := Padcache;
|
|
|
|
NewPCBLibComp.AddPCBObject(NewPad);
|
|
PCBServer.SendMessageToRobots(NewPCBLibComp.I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewPad.I_ObjectAddress);
|
|
End;
|
|
|
|
Procedure CreateComponentTrack(NewPCBLibComp : IPCB_LibComponent, X1 : Real, Y1 : Real, X2 : Real, Y2 : Real, Layer : TLayer, LineWidth : Real, IsKeepout : Boolean);
|
|
Var
|
|
NewTrack : IPCB_Track;
|
|
|
|
Begin
|
|
NewTrack := PcbServer.PCBObjectFactory(eTrackObject,eNoDimension,eCreate_Default);
|
|
NewTrack.X1 := MMsToCoord(X1);
|
|
NewTrack.Y1 := MMsToCoord(Y1);
|
|
NewTrack.X2 := MMsToCoord(X2);
|
|
NewTrack.Y2 := MMsToCoord(Y2);
|
|
NewTrack.Layer := Layer;
|
|
NewTrack.Width := MMsToCoord(LineWidth);
|
|
NewTrack.IsKeepout := IsKeepout;
|
|
NewPCBLibComp.AddPCBObject(NewTrack);
|
|
PCBServer.SendMessageToRobots(NewPCBLibComp.I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewTrack.I_ObjectAddress);
|
|
End;
|
|
|
|
Procedure CreateComponentArc(NewPCBLibComp : IPCB_LibComponent, CenterX : Real, CenterY : Real, Radius : Real, StartAngle : Real, EndAngle : Real, Layer : TLayer, LineWidth : Real, IsKeepout : Boolean);
|
|
Var
|
|
NewArc : IPCB_Arc;
|
|
|
|
Begin
|
|
NewArc := PCBServer.PCBObjectFactory(eArcObject,eNoDimension,eCreate_Default);
|
|
NewArc.XCenter := MMsToCoord(CenterX);
|
|
NewArc.YCenter := MMsToCoord(CenterY);
|
|
NewArc.Radius := MMsToCoord(Radius);
|
|
NewArc.StartAngle := StartAngle;
|
|
NewArc.EndAngle := EndAngle;
|
|
NewArc.Layer := Layer;
|
|
NewArc.LineWidth := MMsToCoord(LineWidth);
|
|
NewArc.IsKeepout := IsKeepout;
|
|
NewPCBLibComp.AddPCBObject(NewArc);
|
|
PCBServer.SendMessageToRobots(NewPCBLibComp.I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewArc.I_ObjectAddress);
|
|
End;
|
|
|
|
Function ReadStringFromIniFile(Section: String, Name: String, FilePath: String, IfEmpty: String) : String;
|
|
Var
|
|
IniFile : TIniFile;
|
|
|
|
Begin
|
|
result := IfEmpty;
|
|
If FileExists(FilePath) Then
|
|
Begin
|
|
Try
|
|
IniFile := TIniFile.Create(FilePath);
|
|
|
|
Result := IniFile.ReadString(Section, Name, IfEmpty);
|
|
Finally
|
|
Inifile.Free;
|
|
End;
|
|
End;
|
|
End;
|
|
|
|
Procedure EnableMechanicalLayers(Zero : Integer);
|
|
Var
|
|
Board : IPCB_Board;
|
|
MajorADVersion : Integer;
|
|
|
|
Begin
|
|
End;
|
|
|
|
Procedure DeleteFootprint(Name : String);
|
|
var
|
|
CurrentLib : IPCB_Library;
|
|
del_list : TInterfaceList;
|
|
I : Integer;
|
|
S_temp : TString;
|
|
Footprint : IPCB_LibComponent;
|
|
FootprintIterator : Integer;
|
|
|
|
Begin
|
|
// ShowMessage('Script running');
|
|
CurrentLib := PCBServer.GetCurrentPCBLibrary;
|
|
If CurrentLib = Nil Then
|
|
Begin
|
|
ShowMessage('This is not a PCB library document');
|
|
Exit;
|
|
End;
|
|
|
|
// store selected footprints in a TInterfacelist that are to be deleted later...
|
|
del_list := TInterfaceList.Create;
|
|
|
|
// For each page of library Is a footprint
|
|
FootprintIterator := CurrentLib.LibraryIterator_Create;
|
|
FootprintIterator.SetState_FilterAll;
|
|
|
|
// Within each page, fetch primitives of the footprint
|
|
// A footprint Is a IPCB_LibComponent inherited from
|
|
// IPCB_Group which Is a container object storing primitives.
|
|
Footprint := FootprintIterator.FirstPCBObject; // IPCB_LibComponent
|
|
|
|
while (Footprint <> Nil) Do
|
|
begin
|
|
S_temp :=Footprint.Name;
|
|
|
|
// check for specific footprint, to delete them before (0=equal string)
|
|
If Not (CompareText(S_temp, Name)) Then
|
|
begin
|
|
del_list.Add(Footprint);
|
|
//ShowMessage('selected footprint ' + Footprint.Name);
|
|
end;
|
|
Footprint := FootprintIterator.NextPCBObject;
|
|
end;
|
|
|
|
CurrentLib.LibraryIterator_Destroy(FootprintIterator);
|
|
|
|
Try
|
|
PCBServer.PreProcess;
|
|
For I := 0 To del_list.Count - 1 Do
|
|
Begin
|
|
Footprint := del_list.items[i];
|
|
// ShowMessage('deleted footprint ' + Footprint.Name);
|
|
CurrentLib.RemoveComponent(Footprint);
|
|
End;
|
|
Finally
|
|
PCBServer.PostProcess;
|
|
del_list.Free;
|
|
End;
|
|
End;
|
|
|
|
Procedure CreateComponentLM63635CA5QDRRRQ1(Zero : integer);
|
|
Var
|
|
NewPCBLibComp : IPCB_LibComponent;
|
|
NewPad : IPCB_Pad2;
|
|
NewRegion : IPCB_Region;
|
|
NewContour : IPCB_Contour;
|
|
STEPmodel : IPCB_ComponentBody;
|
|
Model : IPCB_Model;
|
|
TextObj : IPCB_Text;
|
|
TextObj2 : IPCB_Text;
|
|
|
|
Begin
|
|
Try
|
|
PCBServer.PreProcess;
|
|
|
|
EnableMechanicalLayers(0);
|
|
|
|
NewPcbLibComp := CreateAComponent('LM63635CA5QDRRRQ1');
|
|
NewPcbLibComp.Name := 'LM63635CA5QDRRRQ1';
|
|
NewPCBLibComp.Description := 'Small Outline Flat No-Lead (SON) with tab, 0.50 mm pitch; 13 pin, 3.00 mm L X 3.00 mm W X 0.80 mm H body';
|
|
NewPCBLibComp.Height := MMsToCoord(0.8);
|
|
|
|
// Create text object for .Designator
|
|
TextObj := PCBServer.PCBObjectFactory(eTextObject, eNoDimension, eCreate_Default);
|
|
TextObj.UseTTFonts := True;
|
|
TextObj.Layer := eMechanical9;
|
|
TextObj.Text := '.Designator';
|
|
TextObj.Size := MMsToCoord(1.2);
|
|
TextObj.Width := MMsToCoord(0.12);
|
|
NewPCBLibComp.AddPCBObject(TextObj);
|
|
PCBServer.SendMessageToRobots(NewPCBLibComp.I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,TextObj.I_ObjectAddress);
|
|
|
|
// Create text object for .Designator
|
|
TextObj2 := PCBServer.PCBObjectFactory(eTextObject, eNoDimension, eCreate_Default);
|
|
TextObj2.UseTTFonts := True;
|
|
TextObj2.Layer := eMechanical3;
|
|
TextObj2.Text := '.Designator';
|
|
TextObj2.Size := MMsToCoord(2);
|
|
TextObj2.Width := MMsToCoord(0.2);
|
|
NewPCBLibComp.AddPCBObject(TextObj2);
|
|
PCBServer.SendMessageToRobots(NewPCBLibComp.I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,TextObj2.I_ObjectAddress);
|
|
|
|
CreateSMDComponentPad(NewPCBLibComp, '1', eTopLayer, -1.25, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '2', eTopLayer, -0.75, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '3', eTopLayer, -0.25, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '4', eTopLayer, 0.25, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '5', eTopLayer, 0.75, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '6', eTopLayer, 1.25, -1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 270, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '7', eTopLayer, 1.25, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '8', eTopLayer, 0.75, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '9', eTopLayer, 0.25, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '10', eTopLayer, -0.25, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '11', eTopLayer, -0.75, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '12', eTopLayer, -1.25, 1.37, 0, 0, eRoundedRectangular, 0.76, 0.3, 90, 53.33, 0, 0, True, True);
|
|
CreateSMDComponentPad(NewPCBLibComp, '13', eTopLayer, 0, 0, 0, 0, eRectangular, 1.3, 1.9, 90, 0, -1.9, -1.9, True, True);
|
|
|
|
NewRegion := PCBServer.PCBObjectFactory(eRegionObject, eNoDimension, eCreate_Default);
|
|
NewContour := PCBServer.PCBContourFactory;
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(-0.35));
|
|
NewContour.AddPoint(MMsToCoord(1.2463), MMsToCoord(-0.3969));
|
|
NewContour.AddPoint(MMsToCoord(1.2353), MMsToCoord(-0.4427));
|
|
NewContour.AddPoint(MMsToCoord(1.2173), MMsToCoord(-0.4862));
|
|
NewContour.AddPoint(MMsToCoord(1.1927), MMsToCoord(-0.5263));
|
|
NewContour.AddPoint(MMsToCoord(1.1621), MMsToCoord(-0.5621));
|
|
NewContour.AddPoint(MMsToCoord(1.1263), MMsToCoord(-0.5927));
|
|
NewContour.AddPoint(MMsToCoord(1.0862), MMsToCoord(-0.6173));
|
|
NewContour.AddPoint(MMsToCoord(1.0427), MMsToCoord(-0.6353));
|
|
NewContour.AddPoint(MMsToCoord(0.9969), MMsToCoord(-0.6463));
|
|
NewContour.AddPoint(MMsToCoord(-0.95), MMsToCoord(-0.65));
|
|
NewContour.AddPoint(MMsToCoord(-1.25), MMsToCoord(-0.35));
|
|
NewContour.AddPoint(MMsToCoord(-1.25), MMsToCoord(0.35));
|
|
NewContour.AddPoint(MMsToCoord(-1.2463), MMsToCoord(0.3969));
|
|
NewContour.AddPoint(MMsToCoord(-1.2353), MMsToCoord(0.4427));
|
|
NewContour.AddPoint(MMsToCoord(-1.2173), MMsToCoord(0.4862));
|
|
NewContour.AddPoint(MMsToCoord(-1.1927), MMsToCoord(0.5263));
|
|
NewContour.AddPoint(MMsToCoord(-1.1621), MMsToCoord(0.5621));
|
|
NewContour.AddPoint(MMsToCoord(-1.1263), MMsToCoord(0.5927));
|
|
NewContour.AddPoint(MMsToCoord(-1.0862), MMsToCoord(0.6173));
|
|
NewContour.AddPoint(MMsToCoord(-1.0427), MMsToCoord(0.6353));
|
|
NewContour.AddPoint(MMsToCoord(-0.9969), MMsToCoord(0.6463));
|
|
NewContour.AddPoint(MMsToCoord(0.95), MMsToCoord(0.65));
|
|
NewContour.AddPoint(MMsToCoord(0.9969), MMsToCoord(0.6463));
|
|
NewContour.AddPoint(MMsToCoord(1.0427), MMsToCoord(0.6353));
|
|
NewContour.AddPoint(MMsToCoord(1.0862), MMsToCoord(0.6173));
|
|
NewContour.AddPoint(MMsToCoord(1.1263), MMsToCoord(0.5927));
|
|
NewContour.AddPoint(MMsToCoord(1.1621), MMsToCoord(0.5621));
|
|
NewContour.AddPoint(MMsToCoord(1.1927), MMsToCoord(0.5263));
|
|
NewContour.AddPoint(MMsToCoord(1.2173), MMsToCoord(0.4862));
|
|
NewContour.AddPoint(MMsToCoord(1.2353), MMsToCoord(0.4427));
|
|
NewContour.AddPoint(MMsToCoord(1.2463), MMsToCoord(0.3969));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0.35));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0));
|
|
NewRegion.SetOutlineContour(NewContour);
|
|
NewRegion.Layer := eTopLayer;
|
|
NewPCBLibComp.AddPCBObject(NewRegion);
|
|
|
|
NewRegion := PCBServer.PCBObjectFactory(eRegionObject, eNoDimension, eCreate_Default);
|
|
NewContour := PCBServer.PCBContourFactory;
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(-0.35));
|
|
NewContour.AddPoint(MMsToCoord(1.2463), MMsToCoord(-0.3969));
|
|
NewContour.AddPoint(MMsToCoord(1.2353), MMsToCoord(-0.4427));
|
|
NewContour.AddPoint(MMsToCoord(1.2173), MMsToCoord(-0.4862));
|
|
NewContour.AddPoint(MMsToCoord(1.1927), MMsToCoord(-0.5263));
|
|
NewContour.AddPoint(MMsToCoord(1.1621), MMsToCoord(-0.5621));
|
|
NewContour.AddPoint(MMsToCoord(1.1263), MMsToCoord(-0.5927));
|
|
NewContour.AddPoint(MMsToCoord(1.0862), MMsToCoord(-0.6173));
|
|
NewContour.AddPoint(MMsToCoord(1.0427), MMsToCoord(-0.6353));
|
|
NewContour.AddPoint(MMsToCoord(0.9969), MMsToCoord(-0.6463));
|
|
NewContour.AddPoint(MMsToCoord(-0.95), MMsToCoord(-0.65));
|
|
NewContour.AddPoint(MMsToCoord(-1.25), MMsToCoord(-0.35));
|
|
NewContour.AddPoint(MMsToCoord(-1.25), MMsToCoord(0.35));
|
|
NewContour.AddPoint(MMsToCoord(-1.2463), MMsToCoord(0.3969));
|
|
NewContour.AddPoint(MMsToCoord(-1.2353), MMsToCoord(0.4427));
|
|
NewContour.AddPoint(MMsToCoord(-1.2173), MMsToCoord(0.4862));
|
|
NewContour.AddPoint(MMsToCoord(-1.1927), MMsToCoord(0.5263));
|
|
NewContour.AddPoint(MMsToCoord(-1.1621), MMsToCoord(0.5621));
|
|
NewContour.AddPoint(MMsToCoord(-1.1263), MMsToCoord(0.5927));
|
|
NewContour.AddPoint(MMsToCoord(-1.0862), MMsToCoord(0.6173));
|
|
NewContour.AddPoint(MMsToCoord(-1.0427), MMsToCoord(0.6353));
|
|
NewContour.AddPoint(MMsToCoord(-0.9969), MMsToCoord(0.6463));
|
|
NewContour.AddPoint(MMsToCoord(0.95), MMsToCoord(0.65));
|
|
NewContour.AddPoint(MMsToCoord(0.9969), MMsToCoord(0.6463));
|
|
NewContour.AddPoint(MMsToCoord(1.0427), MMsToCoord(0.6353));
|
|
NewContour.AddPoint(MMsToCoord(1.0862), MMsToCoord(0.6173));
|
|
NewContour.AddPoint(MMsToCoord(1.1263), MMsToCoord(0.5927));
|
|
NewContour.AddPoint(MMsToCoord(1.1621), MMsToCoord(0.5621));
|
|
NewContour.AddPoint(MMsToCoord(1.1927), MMsToCoord(0.5263));
|
|
NewContour.AddPoint(MMsToCoord(1.2173), MMsToCoord(0.4862));
|
|
NewContour.AddPoint(MMsToCoord(1.2353), MMsToCoord(0.4427));
|
|
NewContour.AddPoint(MMsToCoord(1.2463), MMsToCoord(0.3969));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0.35));
|
|
NewContour.AddPoint(MMsToCoord(1.25), MMsToCoord(0));
|
|
NewRegion.SetOutlineContour(NewContour);
|
|
NewRegion.Layer := eTopSolder;
|
|
NewPCBLibComp.AddPCBObject(NewRegion);
|
|
|
|
|
|
NewRegion := PCBServer.PCBObjectFactory(eRegionObject, eNoDimension, eCreate_Default);
|
|
NewContour := PCBServer.PCBContourFactory;
|
|
NewContour.AddPoint(MMsToCoord(1.0825), MMsToCoord(-0.42));
|
|
NewContour.AddPoint(MMsToCoord(0.0995), MMsToCoord(-0.42));
|
|
NewContour.AddPoint(MMsToCoord(0.0995), MMsToCoord(0.46));
|
|
NewContour.AddPoint(MMsToCoord(1.0825), MMsToCoord(0.46));
|
|
NewContour.AddPoint(MMsToCoord(1.0825), MMsToCoord(-0.42));
|
|
NewRegion.SetOutlineContour(NewContour);
|
|
NewRegion.Layer := eTopPaste;
|
|
NewPCBLibComp.AddPCBObject(NewRegion);
|
|
|
|
NewRegion := PCBServer.PCBObjectFactory(eRegionObject, eNoDimension, eCreate_Default);
|
|
NewContour := PCBServer.PCBContourFactory;
|
|
NewContour.AddPoint(MMsToCoord(-0.0995), MMsToCoord(-0.3815));
|
|
NewContour.AddPoint(MMsToCoord(-1.0685), MMsToCoord(-0.3815));
|
|
NewContour.AddPoint(MMsToCoord(-1.0685), MMsToCoord(0.4595));
|
|
NewContour.AddPoint(MMsToCoord(-0.0995), MMsToCoord(0.4595));
|
|
NewContour.AddPoint(MMsToCoord(-0.0995), MMsToCoord(-0.3815));
|
|
NewRegion.SetOutlineContour(NewContour);
|
|
NewRegion.Layer := eTopPaste;
|
|
NewPCBLibComp.AddPCBObject(NewRegion);
|
|
|
|
CreateComponentTrack(NewPCBLibComp, -1.125, -1.5, -1.125, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -1.25, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.375, -1.205, -1.375, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.375, -1.5, -1.125, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.625, -1.5, -0.625, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.75, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.875, -1.205, -0.875, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.875, -1.5, -0.625, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.125, -1.5, -0.125, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.25, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.375, -1.205, -0.375, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.375, -1.5, -0.125, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.375, -1.5, 0.375, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.25, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.125, -1.205, 0.125, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.125, -1.5, 0.375, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.875, -1.5, 0.875, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.75, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.625, -1.205, 0.625, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.625, -1.5, 0.875, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.375, -1.5, 1.375, -1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 1.25, -1.205, 0.125, 0, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.125, -1.205, 1.125, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.125, -1.5, 1.375, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.125, 1.5, 1.125, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 1.25, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.375, 1.205, 1.375, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.375, 1.5, 1.125, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.625, 1.5, 0.625, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.75, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.875, 1.205, 0.875, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.875, 1.5, 0.625, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.125, 1.5, 0.125, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.25, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.375, 1.205, 0.375, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.375, 1.5, 0.125, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.375, 1.5, -0.375, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.25, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.125, 1.205, -0.125, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.125, 1.5, -0.375, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.875, 1.5, -0.875, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.75, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.625, 1.205, -0.625, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.625, 1.5, -0.875, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.375, 1.5, -1.375, 1.205, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -1.25, 1.205, 0.125, 180, 360, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.125, 1.205, -1.125, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.125, 1.5, -1.375, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.25, -0.35, -1.25, 0.35, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.95, 0.35, 0.3, 90, 180, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.95, 0.65, 0.95, 0.65, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.95, 0.35, 0.3, 0, 90, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.25, 0.35, 1.25, -0.35, eMechanical5, 0.025, False);
|
|
CreateComponentArc(NewPCBLibComp, 0.95, -0.35, 0.3, -90, 0, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0.95, -0.65, -0.95, -0.65, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.95, -0.65, -1.25, -0.35, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.5, -1.5, -1.5, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.5, 1.5, 1.5, 1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.5, 1.5, 1.5, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.5, -1.5, -1.5, -1.5, eMechanical5, 0.025, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.55, -1.55, -1.55, 1.55, eMechanical3, 0.12, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.55, 1.55, 1.55, 1.55, eMechanical3, 0.12, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.55, 1.55, 1.55, -1.55, eMechanical3, 0.12, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.55, -1.55, -1.55, -1.55, eMechanical3, 0.12, False);
|
|
CreateComponentArc(NewPCBLibComp, -0.84, -0.84, 0.44, 0, 360, eMechanical3, 0.12, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.625, -1.625, 1.625, 1.625, eTopOverlay, 0.15, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.625, -1.625, -1.625, 1.625, eTopOverlay, 0.15, False);
|
|
CreateComponentArc(NewPCBLibComp, -1.8, -2.1, 0.125, 0, 360, eTopOverlay, 0.25, False);
|
|
CreateComponentTrack(NewPCBLibComp, 0, 0.35, 0, -0.35, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -0.35, 0, 0.35, 0, eMechanical7, 0.05, False);
|
|
CreateComponentArc(NewPCBLibComp, 0, 0, 0.25, 0, 360, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.75, -1.75, 1.75, 1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.75, 1.75, 1.6, 1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.6, 1.75, 1.6, 1.95, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.6, 1.95, -1.6, 1.95, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.6, 1.95, -1.6, 1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.6, 1.75, -1.75, 1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.75, 1.75, -1.75, -1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.75, -1.75, -1.6, -1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.6, -1.75, -1.6, -1.95, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, -1.6, -1.95, 1.6, -1.95, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.6, -1.95, 1.6, -1.75, eMechanical7, 0.05, False);
|
|
CreateComponentTrack(NewPCBLibComp, 1.6, -1.75, 1.75, -1.75, eMechanical7, 0.05, False);
|
|
|
|
STEPmodel := PcbServer.PCBObjectFactory(eComponentBodyObject, eNoDimension, eCreate_Default);
|
|
Model := STEPmodel.ModelFactory_FromFilename('C:\Users\korisnik\Downloads\LM63635CA5QDRRRQ1\LM63635CA5QDRRRQ1.STEP', false);
|
|
STEPModel.Layer := eMechanical1;
|
|
STEPmodel.Model := Model;
|
|
STEPmodel.SetState_Identifier('LM63635CA5QDRRRQ');
|
|
NewPCBLibComp.AddPCBObject(STEPmodel);
|
|
|
|
CurrentLib.RegisterComponent(NewPCBLibComp);
|
|
CurrentLib.CurrentComponent := NewPcbLibComp;
|
|
Finally
|
|
PCBServer.PostProcess;
|
|
End;
|
|
|
|
CurrentLib.Board.ViewManager_UpdateLayerTabs;
|
|
CurrentLib.Board.ViewManager_FullUpdate;
|
|
|
|
// Code By Vincent Himpe
|
|
TextObj.BeginModify; // Let the PCBserver know we are going To modify
|
|
TextObj.AdvanceSnapping := True; // turn On the advanced snapping capabilities
|
|
TextObj.UnderlyingString := '.Designator'; // Not strictly necessary but clean
|
|
TextObj.TTFInvertedTextJustify := eAutoPos_CenterCenter; // allow the text To autoposition inside the container
|
|
TextObj.XLocation := NewpcbLibComp.x; // Set the text inside the container To origin Of he component
|
|
TextObj.yLocation := NewpcbLibComp.y;
|
|
TextObj.Snappointx := NewpcbLibComp.x; // Set the container itself into the origin Of the component
|
|
TextObj.Snappointy := NewpcbLibComp.y;
|
|
TextObj.endModify; // Let PCBserver know we are finished
|
|
Textobj.GraphicallyInvalidate; // force a graphical repaint
|
|
|
|
TextObj2.BeginModify;
|
|
TextObj2.AdvanceSnapping := True;
|
|
TextObj2.UnderlyingString := '.Designator';
|
|
TextObj2.TTFInvertedTextJustify := eAutoPos_CenterCenter;
|
|
TextObj2.XLocation := NewpcbLibComp.x;
|
|
TextObj2.yLocation := NewpcbLibComp.y;
|
|
TextObj2.Snappointx := NewpcbLibComp.x;
|
|
TextObj2.Snappointy := NewpcbLibComp.y;
|
|
TextObj2.endModify; // Let PCBserver know we are finished
|
|
Textobj2.GraphicallyInvalidate;
|
|
//
|
|
|
|
Client.SendMessage('PCB:Zoom', 'Action=All' , 255, Client.CurrentView)
|
|
End;
|
|
|
|
Procedure CreateAPCBLibrary(Zero : integer);
|
|
Var
|
|
View : IServerDocumentView;
|
|
Document : IServerDocument;
|
|
TempPCBLibComp : IPCB_LibComponent;
|
|
|
|
Begin
|
|
If PCBServer = Nil Then
|
|
Begin
|
|
ShowMessage('No PCBServer present. This script inserts a footprint into an existing PCB Library that has the current focus.');
|
|
Exit;
|
|
End;
|
|
|
|
CurrentLib := PcbServer.GetCurrentPCBLibrary;
|
|
If CurrentLib = Nil Then
|
|
Begin
|
|
ShowMessage('You must have focus on a PCB Library in order for this script to run.');
|
|
Exit;
|
|
End;
|
|
|
|
View := Client.GetCurrentView;
|
|
Document := View.OwnerDocument;
|
|
Document.Modified := True;
|
|
|
|
// Create And focus a temporary component While we delete items (BugCrunch #10165)
|
|
TempPCBLibComp := PCBServer.CreatePCBLibComp;
|
|
TempPcbLibComp.Name := '___TemporaryComponent___';
|
|
CurrentLib.RegisterComponent(TempPCBLibComp);
|
|
CurrentLib.CurrentComponent := TempPcbLibComp;
|
|
CurrentLib.Board.ViewManager_FullUpdate;
|
|
|
|
CreateComponentLM63635CA5QDRRRQ1(0);
|
|
|
|
// Delete Temporary Footprint And re-focus
|
|
CurrentLib.RemoveComponent(TempPCBLibComp);
|
|
CurrentLib.Board.ViewManager_UpdateLayerTabs;
|
|
CurrentLib.Board.ViewManager_FullUpdate;
|
|
Client.SendMessage('PCB:Zoom', 'Action=All', 255, Client.CurrentView);
|
|
|
|
DeleteFootprint('PCBCOMPONENT_1'); // code by Randy C - Delete PCBCOMPONENT_1
|
|
|
|
End;
|
|
|
|
Procedure CreateALibrary;
|
|
Begin
|
|
Screen.Cursor := crHourGlass;
|
|
|
|
CreateAPCBLibrary(0);
|
|
|
|
Screen.Cursor := crArrow;
|
|
End;
|
|
|
|
End.
|