Type Mismatch

Discussion in 'SolidWorks' started by Dale Levesque, Mar 28, 2007.

  1. Can anybody tell me why the following code when trying to set boolstatus by
    selecting the "Front" plane generates a "Type Mismatch" error when I move
    the code from the VBA editor into a VB .Net class library?

    This Works Fine....

    Dim swApp As Object
    Dim Part As Object
    Dim SelMgr As Object
    Dim boolstatus As Boolean
    Dim longstatus As Long, longwarnings As Long
    Dim Feature As Object
    Sub main()
    Set swApp = Application.SldWorks

    Set Part = swApp.ActiveDoc
    Set SelMgr = Part.SelectionManager
    boolstatus = Part.Extension.SelectByID2("Front", "PLANE", -0.03505230494835,
    0.05069240410126, -4.704091274448E-04, False, 0, Nothing, 0)


    etc ....

    This causes the error...
    Public Sub Draw(ByVal swApp As SldWorks.SldWorks)

    Part = swApp.ActiveDoc

    SelMgr = Part.SelectionManager

    boolstatus = Part.Extension.SelectByID2("Front", "PLANE", -0.03505230494835,
    0.05069240410126, -0.0004704091274448, False, 0, Nothing, 0.0)

    etc .......



    Thanks for your help,

    Dale
     
    Dale Levesque, Mar 28, 2007
    #1
  2. Oops Sorry, I tried changing the last argument to 0.0 but the error still
    occurs. Both with 0 and 0.0. Sorry I copied the code into the message after
    making the change.

    Any suggestions?

    Dale
     
    Dale Levesque, Mar 28, 2007
    #2
  3. Dale Levesque

    That70sTick Guest

    Try some other means of selecting besides just copying the macro
    commands. "Point select" macro commands for selecting are usually not
    very good for accomplishing what you want in a program.

    Learn to use the selection manager. Learn to select objects by
    traversing the feature tree or using commands like "Feature::Select2".
     
    That70sTick, Mar 28, 2007
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.