Quick way to renumber pads, mostly useful in the pcb library editor.
Click on the pad with the first number and then click on the other pads and they will incremently change numbers.
Sub RenumberPads
Dim Board
Dim Rpad
Dim PadNumber
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Pcbserver.PreProcess
Set PadObject = Board.GetObjectAtCursor(MkSet(ePadObject),_
AllLayers,"Select Pad To Start With")
PadNumber = PadObject.Name + 1
While Board.ChooseLocation(x,y, "Click Next Pad To Renumber") = True
Set Rpad = Board.GetObjectAtXYAskUserIfAmbiguous(x,y,MkSet(_
ePadObject),AllLayers,eEditAction_Change)
If Not(Rpad is Nothing) Then
Call PCBServer.SendMessageToRobots(Rpad.I_ObjectAddress,_
c_Broadcast, PCBM_BeginModify, c_NoEventData)
Rpad.Name = PadNumber
Call PCBServer.SendMessageToRobots(Rpad.I_ObjectAddress,_
c_Broadcast, PCBM_EndModify , c_NoEventData)
End If
PadNumber = PadNumber + 1
Wend
Pcbserver.PostProcess
ResetParameters
Call AddStringParameter("Action", "Redraw")
RunProcess("PCB:Zoom")
End Sub
www.tdpcb.com
Altium Designer Script Information in VB for PCB Layout and Schematic Capture by Bill Smock from Tru Designs, San Diego, CA.
Showing posts with label PCB. Show all posts
Showing posts with label PCB. Show all posts
Friday, June 17, 2011
Monday, June 13, 2011
PCB rules and how to access them.
Get access to the PCB rules. Get the width rules and list the details.
Sub GetWidthRule
Dim Board
Dim tmpStr
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Iterator = Board.BoardIterator_Create
Iterator.AddFilter_ObjectSet(MkSet(eRuleObject))
Iterator.AddFilter_LayerSet(AllLayers)
Iterator.AddFilter_Method(eProcessAll)
Set Rule = Iterator.FirstPCBObject
While Not (Rule Is Nothing)
If Rule.Rulekind = eRule_MaxMinWidth Then
tmpStr = "Name: " & Rule.Name & vbcrlf
tmpStr = tmpStr & "Preferred: " & CoordtoMils(Rule.FavoredWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Minimum: " & CoordtoMils(Rule.MinWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Maximum: " & CoordtoMils(Rule.MaxWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Scope1: " & Rule.Scope1Expression & vbcrlf
tmpStr = tmpStr & "Scope2: " & Rule.Scope2Expression
ShowMessage( tmpStr )
End If
Set Rule = Iterator.NextPCBObject
Wend
Board.BoardIterator_Destroy(Iterator)
End Sub
www.tdpcb.com
A list of available rules:
eRule_Clearance,
eRule_ParallelSegment,
eRule_MaxMinWidth,
eRule_MaxMinLength,
eRule_MatchedLengths,
eRule_DaisyChainStubLength,
eRule_PowerPlaneConnectStyle,
eRule_RoutingTopology,
eRule_RoutingPriority,
eRule_RoutingLayers,
eRule_RoutingCornerStyle,
eRule_RoutingViaStyle,
eRule_PowerPlaneClearance,
eRule_SolderMaskExpansion,
eRule_PasteMaskExpansion,
eRule_ShortCircuit,
eRule_BrokenNets,
eRule_ViasUnderSMD,
eRule_MaximumViaCount,
eRule_MinimumAnnularRing,
eRule_PolygonConnectStyle,
eRule_AcuteAngle,
eRule_ConfinementConstraint,
eRule_SMDToCorner,
eRule_ComponentClearance,
eRule_ComponentRotations,
eRule_PermittedLayers,
eRule_NetsToIgnore,
eRule_SignalStimulus,
eRule_Overshoot_FallingEdge,
eRule_Overshoot_RisingEdge,
eRule_Undershoot_FallingEdge,
eRule_Undershoot_RisingEdge,
eRule_MaxMinImpedance,
eRule_SignalTopValue,
eRule_SignalBaseValue,
eRule_FlightTime_RisingEdge,
eRule_FlightTime_FallingEdge,
eRule_LayerStack,
eRule_MaxSlope_RisingEdge,
eRule_MaxSlope_FallingEdge,
eRule_SupplyNets,
eRule_MaxMinHoleSize,
eRule_TestPointStyle,
eRule_TestPointUsage
Sub GetWidthRule
Dim Board
Dim tmpStr
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
Iterator = Board.BoardIterator_Create
Iterator.AddFilter_ObjectSet(MkSet(eRuleObject))
Iterator.AddFilter_LayerSet(AllLayers)
Iterator.AddFilter_Method(eProcessAll)
Set Rule = Iterator.FirstPCBObject
While Not (Rule Is Nothing)
If Rule.Rulekind = eRule_MaxMinWidth Then
tmpStr = "Name: " & Rule.Name & vbcrlf
tmpStr = tmpStr & "Preferred: " & CoordtoMils(Rule.FavoredWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Minimum: " & CoordtoMils(Rule.MinWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Maximum: " & CoordtoMils(Rule.MaxWidth(eTopLayer))
tmpStr = tmpStr & "mils" & vbcrlf
tmpStr = tmpStr & "Scope1: " & Rule.Scope1Expression & vbcrlf
tmpStr = tmpStr & "Scope2: " & Rule.Scope2Expression
ShowMessage( tmpStr )
End If
Set Rule = Iterator.NextPCBObject
Wend
Board.BoardIterator_Destroy(Iterator)
End Sub
www.tdpcb.com
A list of available rules:
eRule_Clearance,
eRule_ParallelSegment,
eRule_MaxMinWidth,
eRule_MaxMinLength,
eRule_MatchedLengths,
eRule_DaisyChainStubLength,
eRule_PowerPlaneConnectStyle,
eRule_RoutingTopology,
eRule_RoutingPriority,
eRule_RoutingLayers,
eRule_RoutingCornerStyle,
eRule_RoutingViaStyle,
eRule_PowerPlaneClearance,
eRule_SolderMaskExpansion,
eRule_PasteMaskExpansion,
eRule_ShortCircuit,
eRule_BrokenNets,
eRule_ViasUnderSMD,
eRule_MaximumViaCount,
eRule_MinimumAnnularRing,
eRule_PolygonConnectStyle,
eRule_AcuteAngle,
eRule_ConfinementConstraint,
eRule_SMDToCorner,
eRule_ComponentClearance,
eRule_ComponentRotations,
eRule_PermittedLayers,
eRule_NetsToIgnore,
eRule_SignalStimulus,
eRule_Overshoot_FallingEdge,
eRule_Overshoot_RisingEdge,
eRule_Undershoot_FallingEdge,
eRule_Undershoot_RisingEdge,
eRule_MaxMinImpedance,
eRule_SignalTopValue,
eRule_SignalBaseValue,
eRule_FlightTime_RisingEdge,
eRule_FlightTime_FallingEdge,
eRule_LayerStack,
eRule_MaxSlope_RisingEdge,
eRule_MaxSlope_FallingEdge,
eRule_SupplyNets,
eRule_MaxMinHoleSize,
eRule_TestPointStyle,
eRule_TestPointUsage
Subscribe to:
Posts (Atom)