1 Reply Latest reply on May 14, 2017 5:43 PM by lab409

    PutMountingHole Method problem


      I tried add mounting hole in Cell Editor Document. For this I used following code:


      padstackNames = cellEditorDoc.PadstackNames(epcbPadstackObjectMountingHole,,partObj.MountHolesPadstack & "*")
      MountHolePadstackName = padstackNames(0)    
      Set MountHolePadstack = cellEditorDoc.PutPadstack(1, 1, MountHolePadstackName)
      Echo "# DEBUG:  " & " Hole padstack is " & MountHolePadstack.Name
      'Placing Holes
      Dim hole
      Call cellEditorDoc.PutMountingHole(0, 0, MountHolePadstack)
      Echo "# DEBUG:  " & CStr(i) & " Hole placed"     


      If I try run my script I get following error:

      # DEBUG:   Hole padstack is MHNP2,40RSM0,15

      Source:'Error of  Microsoft VBScript'

      Line:767  Char:12

      Error:0x800a000d  'Type error: 'cellEditorDoc.PutMountingHole''


      But MountHolePadstack is the Padstack Object.


      Can anybody say me where is the error in my code?

        • 1. Re: PutMountingHole Method problem



          According to documentation:

          PutMountingHole Method (Document Object)

          Places a mounting hole on the board.



          Document.PutMountingHole(ByVal dX As Double  ,
          ByVal dY As Double ,
          ByVal pPadstack As IMGCPCBPadstack  ,
          [ByVal pNet As IMGCPCBNet] ,
          [ByVal pComponent As IMGCPCBComponent] ,
          [ByVal eFixed As EPcbAnchorType = epcbAnchorNone] ,
          [ByVal eUnit As EPcbUnit = epcbUnitCurrent]) As IMGCPCBMountingHole




          The X coordinate of the mounting hole.


          The Y coordinate of the mounting hole.


          The padstack that must be used to create the mounting hole.


          The net to which the mounting hole is connected. Specify Nothing to create an unconnected mounting hole. Note that, VBScript requires that you specify the object or Nothing as an argument.


          The component to which this mounting hole is added. Specify Nothing if the element is not part of a component. Note that, VBScript requires that you specify the object or Nothing as an argument.


          (Optional) Defines the fix level of the mounting hole.


          (Optional) The units to use for the value of this method.


          IMGCPCBMountingHole. The mounting hole that was created.


          So PutMountHole Method have to invoke with optional parameters pNet and pComponent equals to Nothing. For example:


          For Each mountHole in MountHoles
                      Call cellEditorDoc.PutMountingHole(mountHole.X, mountHole.Y, MountHolePadstack, Nothing, Nothing)
                      Echo "# DEBUG:  " & " Mount hole placed"     


          Afrer this call the mounting hole was be placed.