Altium教程焊盘和过孔特性设置_第1页
Altium教程焊盘和过孔特性设置_第2页
Altium教程焊盘和过孔特性设置_第3页
Altium教程焊盘和过孔特性设置_第4页
Altium教程焊盘和过孔特性设置_第5页
已阅读5页,还剩59页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Pad And Via of Type第一部分 Pad And Via of Type in PCB Design1 Pad And Via of Type . Summary Demo How to find and list all connection lines in the PCB and display the connection line data on the Messages panel. Version 1.0 Copyright (c 2008 by PurPer Limited . Procedure DisplayResultsInMessagePanel (Res

2、ults : TStringList ;VarWSM : IWorkSpace ;MM : IMessagesManager ;ImageIndex : Integer;F : Boolean;I : Integer;BeginWSM := GetWorkSpace ;If WSM = Nil Then Exit;/ Obtain the Messages Panel interfaceMM := WSM .DM_MessagesManager;If MM = Nil Then Exit;/ Tick Icon for the lines in the Message panelImageIn

3、dex := 3;/ Clear out messages from the Message panel.MM .ClearMessages;MM .BeginUpdate;F := False;For I := 0 to Results .Count - 1 DoBeginMM .AddMessage(MessageClass 'Connection Line: ' + IntToStr (I + 1, MessageText Results .StringsI ,MessageSource '' ,MessageDocument '' ,Me

4、ssageCallBackProcess '' ,MessageCallBackParameters '' ,ImageIndex ,F ;End ;MM .EndUpdate;/ Display the Messages panel in PurPer Designer.WSM .DM_ShowMessageView;End ;. Procedure CountAndFindConnections ;VarBoard : IPCB_Board;Connect : IPCB_Connection;Iterator : IPCB_BoardIterator;Con

5、nectionList : TStringList ;ConnectNumber : Integer;Document : IServerDocument ;FileName : TPCBString;BeginConnectNumber := 0;/ Retrieve the current boardBoard := PCBServer .GetCurrentPCBBoard;If Board = Nil Then Exit;ConnectionList := TStringList .Create;/ retrieve the iteratorIterator := Board .Boa

6、rdIterator_Create;Iterator .AddFilter_ObjectSet(MkSet (eConnectionObject;Iterator .AddFilter_LayerSet(AllLayers;Iterator .AddFilter_Method(eProcessAll;Try/ Search and count connection linesConnect := Iterator .FirstPCBObject;While (Connect <> Nil DoBeginInc(ConnectNumber ;/ Makes a string list

7、 of connectionsConnectionList .Add('Connection Line Owner Net: ' + Connect .Net.Name + ' ' + 'X1:' + IntToStr (CoordToMils (Connect .X1 + ' ' +'Y1:' + IntToStr (CoordToMils (Connect .Y1 + ' ' +'X2:' + IntToStr (CoordToMils (Connect .X2 + '

8、' +'Y2:' + IntToStr (CoordToMils (Connect .Y2;/ Fetch the next connection line objectConnect := Iterator .NextPCBObject;End ;/ Free the iterator from memoryBoard .BoardIterator_Destroy(Iterator ;/ List the total of connection lines found from the current PCBConnectionList .Add(#13 + '

9、;Total Connection Lines: ' + IntToStr (ConnectNumber ;/ Get the filename of the current PCB and change its file extension to TXT FileName := ChangeFileExt (Board . FileName , '.txt' ;/ Save list of connection lines to a fileConnectionList .SaveToFile(Filename ;/ Display the results in th

10、e Message panel.DisplayResultsInMessagePanel (ConnectionList ;FinallyConnectionList .Free;End ;End ;. Summary Create a new Via object on a PCB document. Copyright (c 2005 by PurPer Limited .Procedure ViaCreation ;VarBoard : IPCB_Board;BR : TCoordRect ;Sheet : IPCB_Sheet;Via : IPCB_Via;PadCache : TPa

11、dCache ;Begin/ Grab the board interface representing the current PCB document in DXP.Board := PCBServer .GetCurrentPCBBoard;/ If the board interface doesnt exist (no PCB document then exit.If Board = Nil Then Exit;/ Initialize the systems in the PCB Editor.PCBServer .PreProcess;Sheet := Board .PCBSh

12、eet;/ Create a Via object with the PCBObjectFactory method/ and then with the new attributes./ Note we convert values in Mils to internal coordinates/ using the MilsToCoord function. All PCB objects locations and sizes/ have internal coordinate units where 1 mil = 10000 internal unitsVia := PCBServe

13、r .PCBObjectFactory(eViaObject, eNoDimension, eCreate_Default;/ obtain the bottom left coordinates of the board outlineBR := Board .BoardOutline.BoundingRectangle;Via .x := BR .Left + MilsToCoord (500;Via .y := BR .Bottom + MilsToCoord (500;/ Via.x := Sheet.SheetX + MilsToCoord(500;/ Via.y := Sheet.

14、SheetY + MilsToCoord(500;Via . Size := MilsToCoord (50;Via .HoleSize := MilsToCoord (20;/ Assign Via to the Top layer and bottom layer.Via .LowLayer := eTopLayer;Via .HighLayer := eBottomLayer;/ Set up Cache info for Via/ which consists mainly solder mask, paste mask and power plane values from desi

15、gn rulesPadcache := Via .GetState_Cache;Padcache .ReliefAirGap := MilsToCoord (11;Padcache .PowerPlaneReliefExpansion := MilsToCoord (11;Padcache .PowerPlaneClearance := MilsToCoord (11;Padcache .ReliefConductorWidth := MilsToCoord (11;Padcache .SolderMaskExpansion := MilsToCoord (11;Padcache .Solde

16、rMaskExpansionValid := eCacheManual;Padcache .PasteMaskExpansion := MilsToCoord (11;Padcache .PasteMaskExpansionValid := eCacheManual;/ Assign the new pad cache to the viaVia .SetState_Cache := Padcache ;/ Put the new Via object on the boardBoard .AddPCBObject(Via ;/ Update the Undo System in DXP th

17、at a new VIa object has been added to the boardPCBServer .SendMessageToRobots(Board .I_ObjectAddress, c_Broadcast, PCBM_BoardRegisteration, Via .I_ObjectAddress;/ Finalize the systems in the PCB Editor.PCBServer .PostProcess;/ Refresh PCB screenClient . SendMessage ('PCB:Zoom', 'Action=R

18、edraw' , 255, Client .CurrentView;End ;. Summary Demo how to create a new component on the PCB 1/ Run CreateAComponentOnPCB procedure first to create a new component 2/ Then run CreateANewCompHeight procedure to set a new height for this comp. 3/ Then run the FetchComponentMidPoints procedure to

19、 fetch mid points. 4/ Run the RotateAComponent procedure to rotate and flip this new comp. Copyright (c 2007 by PurPer Limited .VarBoard : IPCB_Board;WorkSpace : IWorkSpace ;.Function PlaceAPCBTrack (AX1, AY1, AX2, AY2 : TCoord; AWidth : TCoord; ALayer : TLayer : IPCB_Track;VarT : IPCB_Track;BeginPC

20、BServer .PreProcess;T := PCBServer .PCBObjectFactory(eTrackObject,eNoDimension,eCreate_Default;T .X1 := MilsToCoord (AX1;T .Y1 := MilsToCoord (AY1;T .X2 := MilsToCoord (AX2;T .Y2 := MilsToCoord (AY2;T .Layer := ALayer ;T .Width := MilsToCoord (AWidth ;PCBServer .PostProcess;Result := T ;End ;.Functi

21、on PlaceAPCBPad (AX,AY : TCoord; ATopXSize, ATopYSize : TCoord; AHoleSize : TCoord; ALayer : TLayer; AName : String : IPCB_Pad; VarP : IPCB_Pad;PadCache : TPadCache ;BeginResult := Nil ;TryPCBServer .PreProcess;P := PcbServer .PCBObjectFactory(ePadObject,eNoDimension,eCreate_Default;If P = Nil Then

22、Exit;P .X := MilsToCoord (AX ;P .Y := MilsToCoord (AY ;P .TopXSize := MilsToCoord (ATopXSize ;P .TopYSize := MilsToCoord (ATopYSize ;P .HoleSize := MilsToCoord (AHoleSize ;P .Layer := ALayer ;P .Name := AName ;(* Setup a pad cache *Padcache := P .GetState_Cache;Padcache .ReliefAirGap := MilsToCoord

23、(11;Padcache .PowerPlaneReliefExpansion := MilsToCoord (11;Padcache .PowerPlaneClearance := MilsToCoord (11;Padcache .ReliefConductorWidth := MilsToCoord (11;Padcache .SolderMaskExpansion := MilsToCoord (11;Padcache .SolderMaskExpansionValid := eCacheManual;Padcache .PasteMaskExpansion := MilsToCoor

24、d (11;Padcache .PasteMaskExpansionValid := eCacheManual;(* Assign the new pad cache to the pad*P .SetState_Cache(Padcache ;FinallyPCBServer .PostProcess;End ;Result := P ;End ;.Procedure Place4Tracks (NewComp : IPCB_Component;VarNewTrack : IPCB_Track;Begin/ Create a first trackNewTrack := PlaceAPCBT

25、rack (50,50,250,50,10,eTopOverlay;NewComp .AddPCBObject(NewTrack ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewTrack .I_ObjectAddress;/ Create a second trackNewTrack := PlaceAPCBTrack (250,50,250,-150,10,eTopOverlay;NewComp .AddPCBObject(NewTrack ;PC

26、BServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewTrack .I_ObjectAddress;/ Create a third trackNewTrack := PlaceAPCBTrack (250,-150,50,-150,10,eTopOverlay;NewComp .AddPCBObject(NewTrack ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PC

27、BM_BoardRegisteration,NewTrack .I_ObjectAddress;/ Create a second trackNewTrack := PlaceAPCBTrack (50,-150,50,50,10,eTopOverlay;NewComp .AddPCBObject(NewTrack ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewTrack .I_ObjectAddress; End ;.Procedure Place

28、4Pads (NewComp : IPCB_Component;VarNewPad : IPCB_Pad;Begin/ Create a first padNewPad := PlaceAPCBPad (0,0,62,62,28,eMultiLayer,'1' ;NewComp .AddPCBObject(NewPad ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewPad .I_ObjectAddress;/ Create a sec

29、ond padNewPad := PlaceAPCBPad (0,-100,62,62,28,eMultiLayer,'2' ;NewComp .AddPCBObject(NewPad ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewPad .I_ObjectAddress;/ Create a third padNewPad := PlaceAPCBPad (300,0,62,62,28,eMultiLayer,'3'

30、 ;NewComp .AddPCBObject(NewPad ;PCBServer .SendMessageToRobots(NewComp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewPad .I_ObjectAddress;/ Create a fourth padNewPad := PlaceAPCBPad (300,-100,62,62,28,eMultiLayer,'4' ;NewComp .AddPCBObject(NewPad ;PCBServer .SendMessageToRobots(New

31、Comp .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,NewPad .I_ObjectAddress; End ;.Procedure PlaceAPCBComponent (AX,AY : TCoord;VarComp : IPCB_Component;BeginPCBServer .PreProcess;Comp := PCBServer .PCBObjectFactory(eComponentObject, eNoDimension, eCreate_Default;If Comp = Nil Then Exit;Place4

32、Tracks (Comp ;Place4Pads (Comp ;/ Set the reference point of the ComponentComp .X := MilsToCoord (AX ;Comp .Y := MilsToCoord (AY ;Comp .Layer := eTopLayer;/ Make the designator text visible;Comp .NameOn := True;Comp .Name.Text := 'Custom' ;Comp .Name.XLocation := MilsToCoord (AX - MilsToCoor

33、d (220;Comp .Name.YLocation := MilsToCoord (AY - MilsToCoord (220;/ Make the comment text visible;Comp .CommentOn := True;Comp .Comment.Text := 'Comment' ;Comp .Comment.XLocation := MilsToCoord (AX - MilsToCoord (220;Comp .Comment.YLocation := MilsToCoord (AY - MilsToCoord (300;PCBServer .Se

34、ndMessageToRobots(Board .I_ObjectAddress,c_Broadcast,PCBM_BoardRegisteration,Comp .I_ObjectAddress; Board .AddPCBObject(Comp ;PCBServer .PostProcess;End ;.Procedure CreateAComponentOnPCB ;VarOffSetX : Integer;OffSetY : Integer;NewPad : IPCB_Pad;NewTrack : IPCB_Track;BR : TCoordRect ;BeginClient .Sta

35、rtServer('PCB' ;/ Create a new pcb documentWorkSpace := GetWorkSpace ;If WorkSpace = Nil Then Exit;Workspace .DM_CreateNewDocument('PCB' ;/ Check if PCB document existsIf PCBServer = Nil Then Exit;Board := PCBServer .GetCurrentPCBBoard;If Board = Nil then exit;/ obtain the offsets so

36、 we can place objects inside the PCB board outline.BR := Board .BoardOutline.BoundingRectangle;OffsetX := Trunc(CoordToMils (BR .Left;OffsetY := Trunc(CoordToMils (BR .Bottom; /TReal to IntegerPlaceAPCBComponent (OffsetX + 3000, OffsetY + 1000;Board .ViewManager_FullUpdate;/ Refresh PCB screenClient

37、 .CommandLauncher.LaunchCommand('PCB:Zoom', 'Action=Redraw' , 255, Client .CurrentView; End ; .Procedure RotateAComponent ;VarBoard : IPCB_Board;Iterator : IPCB_BoardIterator;Component : IPCB_Component;Layer : TLayer;BeginBoard := PCBServer .GetCurrentPCBBoard;If Board = Nil Then Exi

38、t;/ Initialize the PCB editor.PCBServer .PreProcess;/Grab the first component from the PCB only.Iterator := Board .BoardIterator_Create;Iterator .AddFilter_ObjectSet(MkSet (eComponentObject;Iterator .AddFilter_LayerSet(AllLayers;Iterator .AddFilter_Method(eProcessAll;Component := Iterator .FirstPCBO

39、bject;/ If no components found, exit.If Component = Nil ThenBeginBoard .BoardIterator_Destroy(Iterator ;Exit;End ;/ Notify the PCB that the pcb object is going to be modifiedPCBServer .SendMessageToRobots(Component .I_ObjectAddress, c_Broadcast, PCBM_BeginModify , c_NoEventData;/ Set the reference p

40、oint of the component./ Note that IPCB_Component is inherited from IPCB_Group/ and thus the X,Y properties are inherited.Component .X := Component .X + MilsToCoord (100;Component .Y := Component .Y + MilsToCoord (100;/ Rotate a component 45 degrees.Component .Rotation := 45;/ If Component is on Top

41、layer, its placed on bottom layer and vice versa.Layer := Component . Layer ;If (Layer = eTopLayer ThenBeginComponent . Layer := eBottomLayer;EndElse If (Layer = eBottomLayer ThenComponent . Layer := eTopLayer;/ Notify the PCB editor that the pcb object has been modifiedPCBServer .SendMessageToRobot

42、s(Component .I_ObjectAddress, c_Broadcast, PCBM_EndModify , c_NoEventData;Board .BoardIterator_Destroy(Iterator ;/ Reset the PCBPCBServer .PostProcess;Client . SendMessage ('PCB:Zoom', 'Action=Redraw' , 255, Client .CurrentView;End ;.VarMinX , MinY , MaxX , MaxY : Integer;.Procedure

43、ProcessObjectsOfAComponent (Const P : IPCB_Primitive;VarR : TCoordRect ;Begin/ check for comment / name objectsIf P .ObjectId <> eTextObject ThenBeginR := P .BoundingRectangle;If R .left < MinX Then MinX := R .left;If R .bottom < MinY Then MinY := R .bottom;If R .right > MaxX Then Max

44、X := R .right;If R .top > MaxY Then MaxY := R .top;End ;End ;.Procedure FetchComponentMidPoints ;VarMidX, MidY : Double;Component : IPCB_Component;Iterator : IPCB_BoardIterator;Board : IPCB_Board;S : TPCBString;GroupIterator : IPCB_GroupIterator;GroupHandle : IPCB_Primitive;BeginBoard := PCBServe

45、r .GetCurrentPCBBoard;If Board = Nil Then Exit;BeginHourGlass ;/ setting extreme constants.MinX := 2147483647;MinY := 2147483647;MaxX := -2147483647;MaxY := -2147483647;/ set up filter for component objects onlyIterator := Board .BoardIterator_Create;Iterator .AddFilter_ObjectSet(MkSet (eComponentOb

46、ject;Iterator .AddFilter_LayerSet(AllLayers;Iterator .AddFilter_Method(eProcessAll;/ Looks for the first component and then calculates the Mid X and MidY/ of this component taking all the prims of this component into account.Component := Iterator .FirstPCBObject;If Component <> Nil ThenBeginGr

47、oupIterator := Component .GroupIterator_Create;GroupIterator .AddFilter_ObjectSet(AllObjects;GroupHandle := GroupIterator .FirstPCBObject;While GroupHandle <> Nil DoBeginProcessObjectsOfAComponent (GroupHandle ;GroupHandle := GroupIterator .NextPCBObject;End ;Component .GroupIterator_Destroy(G

48、roupIterator ;End ;Board .BoardIterator_Destroy(Iterator ;MidX := (MinX + MaxX /2;MidY := (MinY + MaxY /2;EndHourGlass ;S := Component .Name.Text;ShowInfo ('Component''s ' + S + ' midpoint X and Y are : '+ #13 +'MidX = ' + FloatToStr (MidX + ', MidY = ' + FloatToStr (MidY ;End ;.Procedure Crea

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论