12 Replies Last post: Oct 28, 2009 9:36 PM by kendall_hiles  
Snap_Boy Wannabe 16 posts since
Sep 9, 2008
Reply
Currently Being Moderated

Jul 1, 2009 4:44 AM

Part Height report

Hi,

 

Is there any Easy way to generate report of "Height of parts in Board"?

 

I am trying to generate MS-Excel report through following code

 

Sub Get_Height()

    Dim serverIsLocked As Boolean

    Dim prts As MGCPCB.Parts

    Dim prt As MGCPCB.Part

   

    Set prts = pcbdoc.Parts

    prts.Sort

     

   ' Define Header

    i = 2

    Range("A1").FormulaR1C1 = "part Number"

    Range("B1").FormulaR1C1 = "No. of parts"

    Range("C1").FormulaR1C1 = "Height"

    Range("D1").FormulaR1C1 = "Underside Height"

   

       

For Each prt In prts

   

    Range("A" & i).FormulaR1C1 = prt.Name

    Range("B" & i).FormulaR1C1 = prt.Components.Count

    Range("C" & i).FormulaR1C1 = prt.Height(epcbUnitCurrent)

    Range("D" & i).FormulaR1C1 = prt.UndersideHeight

       

    On Error Resume Next

   

    i = i + 1

Next

MsgBox "Done!"

End Sub

 

But value of "prt.Height(epcbUnitCurrent)" is shows as "-1" for all components!!  

 

Any clue?

 

 

Reply
fagrondin Wannabe 7 posts since
Mar 9, 2009
Currently Being Moderated
Jul 2, 2009 12:19 PM in response to: Snap_Boy
Re: Part Height report

Hi,

 

is it possible that instead of :

 

prt.Height(epcbUnitCurrent) it is prt.get_Height(epcbUnitCurrent).

and

prt.UndersideHeight it is prt.get_UndersideHeight

Regards

 

Fred

matthias.cosaert Lurker 3 posts since
Aug 13, 2008
Currently Being Moderated
Jul 3, 2009 2:36 AM in response to: Snap_Boy
Re: Part Height report

There are different ways the height can be defined, one is attached to the cell (default) and the other is attatched to the part (for when the default cell height isn't correct for that specific part).

Don't know if you can get the cell height directly trough automation but you can get them from ASCII export of cells (search for "Height") or from IDF export's emp file.

Andreas.Schaefer Member 33 posts since
Oct 7, 2008
Currently Being Moderated
Jul 3, 2009 6:51 AM in response to: Snap_Boy
Re: Part Height report

Hi,

 

I would be more correct.

If you want a report of the height of a part (component in Automation) you should go through all items of the PlacementOutlines Collection
of the componet. The height you get here from is the height of you part.

 

regards, Andreas

kendall_hiles Wannabe 35 posts since
Sep 15, 2008
Currently Being Moderated
Jul 3, 2009 11:07 PM in response to: Snap_Boy
Re: Part Height report

The height actually belongs to the placement outline.

 

There are a few examples of the in the AATK download.  vbs/Manufacturing/POV.vbs or vbs/Manufacturing/VRML.vbs

http://sourceforge.net/projects/uwtoolbox/


Sub main()
    Get_Height
End Sub

 

Sub Get_Height()
    Dim pcbApp As MGCPCB.Application
    Dim pcbDoc As MGCPCB.Document
    Set pcbApp = GetObject(, "MGCPCB.Application")
    Set pcbDoc = pcbApp.ActiveDocument
   
    ' get a doc licence
    retVal = licenseDoc(pcbDoc)
    If (retVal <> 1) Then Set pcbDoc = Nothing
    Dim prts As MGCPCB.Parts
    Dim prt As MGCPCB.Part
    Set prts = pcbDoc.Parts
    prts.Sort

    ' Define Header

    i = 2
    Range("A1").FormulaR1C1 = "part Number"
    Range("B1").FormulaR1C1 = "No. of parts"
    Range("C1").FormulaR1C1 = "Height"
    Range("D1").FormulaR1C1 = "Underside Height"

    For Each prt In prts

        Range("A" & i).FormulaR1C1 = prt.Name
        Range("B" & i).FormulaR1C1 = prt.Components.Count
   
        Dim comps As Components
        Dim comp As Component
        Dim po As PlacementOutline
        Dim pos As PlacementOutlines
   
        Set comps = prt.Components

        For Each comp In comps
            Set pos = comp.PlacementOutlines

            For Each po In pos
                Range("C" & i).FormulaR1C1 = po.Height(epcbUnitCurrent)
                Range("D" & i).FormulaR1C1 = po.UndersideSpace
            Next
        Next

        On Error Resume Next
        i = i + 1

    Next

    MsgBox "Done!"

End Sub

 

Private Function licenseDoc(docObj As MGCPCB.Document) As Integer
' =======================================================================
' Retrieve a licence for the document
' =======================================================================
On Error GoTo exit_with_error
Dim retState As Integer

Dim licenseServer As Object
Dim key As Long
Dim licenseToken As Long
Dim outErrMess As String

If (docObj Is Nothing) Then GoTo end_of_function

' Ask the document for a key
key = docObj.Validate(0)

' Get license server
On Error GoTo err_create_serverobj
Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
If (licenseServer Is Nothing) Then GoTo err_create_serverobj
On Error GoTo exit_with_error


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


' Validate the document with the license token
On Error GoTo err_validate
Dim lRetval As Long
lRetval = docObj.Validate(licenseToken)

On Error GoTo exit_with_error

retState = 1

end_of_function:
    ' release licence server
    Set licenseServer = Nothing
    licenseDoc = retState

Exit Function

show_error:
   Dim ioptions As Long
   ioptions = vbDefaultButton1 + vbApplicationModal + vbCritical + vbOKOnly
   MsgBox outErrMess, ioptions, "Retrieving license for document"
   GoTo end_of_function

exit_with_error:
    outErrMess = "** Error ** " + Error$
    retState = -1
    GoTo show_error

err_create_serverobj:
   outErrMess = "** Error ** Could not create license server object"
   retState = -2
   GoTo show_error

err_validate:
   outErrMess = "** Error ** Failed to validate document object"
   outErrMess = outErrMess + vbCrLf + "    License token : " + Trim(Str(licenseToken))
   outErrMess = outErrMess + vbCrLf + "    Document key  : " + Trim(Str(key))
   retState = -3
   GoTo show_error

End Function

Guru Lurker 3 posts since
Aug 20, 2008
Currently Being Moderated
Aug 21, 2009 1:59 AM in response to: kendall_hiles
Re: Part Height report

Is there any way I can report the Assembly/Silkscreen elements, Number of placement outlines etc for all cells in a central library

by using the celleditor data model similarly? I can get the Height, Pincount, Number of layers etc using the Cell editor objects but

couldnt find a way to report the others..

Guru Lurker 3 posts since
Aug 20, 2008
Currently Being Moderated
Aug 21, 2009 2:38 AM in response to: Snap_Boy
Re: Part Height report

But using 'FabricationLayerGfxs' & 'FabricationLayerTexts' I can report only cells used in a design right? I want to report all the cells available

in a Central Library Cell database (Library manager cell Editor) .. not through Expedition PCB..

kendall_hiles Wannabe 35 posts since
Sep 15, 2008
Currently Being Moderated
Oct 28, 2009 9:36 PM in response to: Guru
Re: Part Height report

In .5 on the CL has Automation.  I have not got into it very much but it may be doable on the lib now.

kendall_hiles Wannabe 35 posts since
Sep 15, 2008
Currently Being Moderated
Oct 28, 2009 9:34 PM in response to: Snap_Boy
Re: Part Height report

This is the latest from AATK.

 

Opens a new Excel and adds the heights.  Just drag and drop onto Expedition (Windows)  use the keyin run <path> from Linux/Solaris

Attachments:

More Like This

  • Retrieving data ...