5 Replies Latest reply on Sep 7, 2017 5:02 AM by .-.--.--

    BoardOutline Object - in DrawingEditor!

    juergen.hinterleitner

      How to get the BoardOutline.Extrema from a placed Board in the DrawingEditor?

       

      I know of only one very very complicate and slowly method! Namely to create an own hidden object from ExpeditionPCBApplication and open the Pcb and validate it. So mega ultra slowly !!!!!!! and also not always successfully -> when no license available at the moment.

       

      "ultra inefficient" -> just to get the Board.Extrema!

      (I don't need the Drawing.ActiveSheet.Boards.item(1).Extrema -> this is just the  extrema from the "manufacturing outline")

       

      Is there within the DrawingEditor an easier way  to get what I want? (without creating a separate PCB-Instance in the background) - any ideas?

        • 1. Re: BoardOutline Object - in DrawingEditor!
          .-.--.--

          We had a similar problem with the need to access conductor, fabrication, and user layer text strings added in Expedition for use in DrawingEditor.  Our solution was to export all relevant text strings and their layers to a LogFile, every time a design gets saved (using the Document OnSave event).  Then DrawingEditor can easily access that file, which always has the latest Expedition data.  You can do the same thing with the BoardOutline Extrema, or any other Expedition data needed in DrawingEditor.

          • 2. Re: BoardOutline Object - in DrawingEditor!
            Patrick.Cashman

            Board Outline is a property of the PCB document, not of the board object as instantiated in a drawing editor sheet. Therefore the only way to access it is by writing its pointsarray (or other data, as needed) to a file beforehand, or by making an automation connection to the PCB document itself.

             

            In my typical use scenario, the PCB will almost always be open at the same time as the drawing editor databases. If not, it can easily be opened at the same time. Then this information can be accessed readily by connecting the automation script to the PCB and getting the board outline extrema directly.

            • 5. Re: BoardOutline Object - in DrawingEditor!
              .-.--.--

              Thanks, Patrick!

               

              My apologies, Juergen, for giving you hints, but not a definitive solution.  Try the following:

              ----------

              ' Expedition script:

              Set pcbDoc = ActiveDocument
              pcbDoc.Validate(CreateObject("MGCPCBAutomationLicensing.Application").GetToken(pcbDoc.Validate(0)))
              Call Scripting.AttachEvents(pcbDoc,"BoardArea")
              Scripting.DontExit = True

               

              Sub BoardArea_OnSave()
              Set Fso = CreateObject("Scripting.FileSystemObject")
              Set LogFile = Fso.OpenTextFile("LogFiles\BoardArea.txt",2,True)
              Set Ext = pcbDoc.BoardOutline.Extrema
              LogFile.Write(Join(Array(pcbDoc.CurrentUnit,Ext.MinX,Ext.MinY,Ext.MaxX,Ext.MaxY,""),vbTab) & vbCrLf)
              LogFile.Close
              End Sub

              ----------

              ' Drawing Editor script:

              Set pcbDoc = ActiveDocument

              pcbDoc.Validate(CreateObject("MGCPCBAutomationLicensing.Application").GetToken(pcbDoc.Validate(0)))

              Set Fso = CreateObject("Scripting.FileSystemObject")

              Set LogFile = Fso.OpenTextFile("LogFiles\BoardArea.txt",1)

              Ext = Split(LogFile.ReadAll(),vbTab)

              LogFile.Close

              For Inc = 1 To 4

                   Ext(Inc) = Utility.ConvertUnit(Ext(Inc),Ext(0),pcbDoc.CurrentUnit)

              Next

              ' Scale, Translate, Rotate Coordinates as needed

              ----------