Showing posts with label Rules. Show all posts
Showing posts with label Rules. Show all posts

Wednesday, June 15, 2011

Via Rules

Get the details of the via routing style rule.

Sub GetViaRule

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_RoutingViaStyle Then
 tmpStr = "Name: " & Rule.Name & vbcrlf
 tmpStr = tmpStr & "Pref Via Width: " & CoordtoMils(Rule.PreferedWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Min Via Width: " & CoordtoMils(Rule.MinWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Max Via Width: " & CoordtoMils(Rule.MaxWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Pref Via Hole Width: " & CoordtoMils(Rule.PreferedHoleWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Min Via Hole Width: " & CoordtoMils(Rule.MinHoleWidth)
 tmpStr = tmpStr & "mils" & vbcrlf
 tmpStr = tmpStr & "Max Via Hole Width: " & CoordtoMils(Rule.MaxHoleWidth)
 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

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