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
Thanks for the answer...
Can you upload the file as VBS? I tried to convert online and got many errors and i'm new with the script's option.
I am not good in working / creating vbs files. The Mentor Editor is not convenient enough, thats also the reason,
why I am using VB.Net / Visual Studio. Anyway, I have converted / modified the code above and here it is.
Hope its doing its job. No gaurantee, If you have any doubts, create a project backup or test it on a
RefDesSync-05.zip 1.1 KB