Quantcast
Channel: Mentor Graphics Communities: Message List
Viewing all articles
Browse latest Browse all 4541

Re: Assembly and Silkscreen Ref Des rearrange

$
0
0

Hi,

yes, thats also currently my problem. But here I have a small macro for you doing exactely that job.

It is written in VB.Net, but it is easy to transfer to VBS. It is a cutout of something bigger I have here.

So a few things are missing here, like inizialization of the ocbDoc Object, and the Licensing, but this

Snippet is working.

 

   Sub syncRefDesPos()        Dim fabLayerTexts As MGCPCB.FabricationLayerTexts        fabLayerTexts = pcbDoc.FabricationLayerTexts(MGCPCB.EPcbFabricationType.epcbFabSilkscreen, MGCPCB.EPcbSelectionType.epcbSelectAll, MGCPCB.EPcbSide.epcbSideTopOrBottom, True)        fabLayerTexts = pcbDoc.FabricationLayerTexts(MGCPCB.EPcbFabricationType.epcbFabAssembly, MGCPCB.EPcbSelectionType.epcbSelectAll, MGCPCB.EPcbSide.epcbSideTopOrBottom, True)        Dim cnt As Integer        cnt = fabLayerTexts.Count        Dim str As String        str = String.Empty        Dim sb As StringBuilder        sb = New StringBuilder        Dim fabLayerText As MGCPCB.FabricationLayerText            Dim activeComp As MGCPCB.Component        For i As Integer = 1 To cnt            fabLayerText = fabLayerTexts.Item(i)            activeComp = fabLayerText.Component            If activeComp.RefDes.StartsWith("TP") Then                'Test Point                Continue For            ElseIf activeComp.RefDes.StartsWith("BH") Then                'Black Hole                Continue For            Else            End If            Dim PosX As Double            PosX = activeComp.CenterX(MGCPCB.EPcbUnit.epcbUnitMM)            Dim PosY As Double            PosY = activeComp.CenterY(MGCPCB.EPcbUnit.epcbUnitMM)            fabLayerText.PositionX(pcbUnit) = PosX            fabLayerText.PositionY(pcbUnit) = PosY        Next    End Sub

 

at the beginning of the macro you specify, if you like to work on Silkscreen or Assembly Layer

 

ciao /Stefan


Viewing all articles
Browse latest Browse all 4541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>