3 Replies Latest reply on Feb 26, 2009 3:07 AM by Snap_Boy

    Silk Screen Ref Des orientation report

    Snap_Boy

       

      Hi All,

       

       

      I am trying to genenrate 'Silk Screen reference designator's orientation report' (Based on ExcelCompList.xls)

       

       

      But with following code

       

       

      Range("C" & i).Select

      ActiveCell.FormulaR1C1 = cmp.FabricationLayerTexts(epcbFabSilkscreen).Item(cmp.Name).Format.Orientation(epcbAngleUnitDegrees)

       

       

      I am getting this error.

       

       

       

       

       

       

       

      Any clue? ?:|

       

       

        • 1. Re: Silk Screen Ref Des orientation report
          Snap_Boy

          I got an alternate route!

          • 2. Re: Silk Screen Ref Des orientation report

            I wrote some code a while back that would look at the orientation of the ref des and change any that are at 180 to 0 and any that are at 270 to 90.  I wouldn't be too difficult to change this to get a report.

             

             

             
            ' ====================================================================
            ' This program looks at all of the silkcreen reference designators and
            ' changes any that are at 180 to 0 and at 270 to 90.
            '
            ' This code is based on MoveAssemblyRef.vbs that is part of AATK 4.0
            ' from Mentor Graphics
            ' ====================================================================

            Option Explicit

            Dim pcbDoc 'As MGCPCB.Document
            Dim pcbApp
            Dim fabtxts 'As FabricationLayerTexts
            Dim fabtxt 'As FabricationLayerText
            Dim cnt

            '---------------------------------------
            'Begin Main program
            '---------------------------------------

            ' Get the application object
            Set pcbApp = GetObject(,"MGCPCB.ExpeditionPCBApplication")

            ' Get the active document
            Set pcbDoc = pcbApp.ActiveDocument

            ' License the document
            If (ValidateServer(pcbDoc) = 1) Then

            Set fabtxts = pcbDoc.FabricationLayerTexts(epcbFabAll, epcbSelectAll, epcbSideTopOrBottom, True)
            cnt = fabtxts.Count

            Call pcbApp.Gui.ProgressBarInitialize(True, "Progess", cnt, 0)
            Call pcbApp.Gui.StatusBarText("Running Ref Designator Rotation Fix",epcbStatusField1)
            cnt = 0
            pcbApp.LockServer

            For Each fabtxt In fabtxts

            If Not fabtxt.Component Is Nothing Then

            fabtxt.Component.Selected = True

            If fabtxt.Type = epcbFabSilkscreen Then

            Select Case fabtxt.Format.Orientation(epcbAngleUnitDegrees)
                Case 180
                fabtxt.Format.Orientation(epcbAngleUnitDegrees)=0
                Case 270
                fabtxt.Format.Orientation(epcbAngleUnitDegrees)=90
                Case Else
                'Do Nothing for 0 and 90
            End Select
            End If
            fabtxt.Component.Selected = False
            Else
            End If

            pcbApp.Gui.ProgressBar (cnt)
            cnt = cnt + 1

            Next
            End If

            pcbApp.UnlockServer
            pcbApp.Gui.ProgressBarInitialize (False)
            Call pcbApp.Gui.StatusBarText("Completed",epcbStatusField1)


            '------------------------------------------------------------
            ' Begin Validate Server Function (Written By Mentor Graphics)
            '------------------------------------------------------------
            Private Function ValidateServer(doc)
               
                Dim key, licenseServer, licenseToken

                ' Ask Expedition’s document for the key
                key = doc.Validate(0)

                ' Get license server
                Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")

                ' Ask the license server for the license token
                licenseToken = licenseServer.GetToken(key)

                ' Release license server
                Set licenseServer = nothing

                ' Turn off error messages.  Validate may fail if the token is incorrect
                On Error Resume Next
                Err.Clear

                ' Ask the document to validate the license token
                doc.Validate(licenseToken)
                If Err Then
                    ValidateServer = 0   
                Else
                    ValidateServer = 1
                End If

            End Function
            '---------------------------------------
            ' End Validate Server Function
            '---------------------------------------


            • 3. Re: Silk Screen Ref Des orientation report
              Snap_Boy

              Hi Jeff,

               

              That worked for me.

              Thank you !