Need API help- getting "Run-time error '-2147417848 (80010108)': Automation error

Discussion in 'SolidWorks' started by Mike, Jun 30, 2004.

  1. Mike

    Mike Guest

    It says "the object invoked has disconnected from its clients"

    I'm trying to draw an arc and then extrude it as a thin feature...

    Here's my code:

    Part.ClearSelection2 True
    boolstatus = Part.Extension.SelectByID("XY (Front)", "PLANE", 0, 0, 0,
    False, 0, Nothing)
    'start sketching
    Part.InsertSketch2 (True)
    Part.CreateArc2 0, 0, z, 1, 1, z, -1, 1, z, 1
    Part.InsertSketch2 False

    boolstatus = Part.Extension.SelectByID("Sketch1", "SKETCH", 0, 0, 0,
    False, 0, Nothing)
    empty_var = Part.FeatureBossThin2(True, True, False, swEndCondBlind,
    swEndCondBlind, 1 * 0.0254, 0, False, False, False, False, 0, 0,
    False, False, False, False, 0.03 * 0.0254, 0.03 * 0.0254, 0.03 *
    0.0254, 0, 0, False, 0)

    End

    VB highlights the empty_var = Part.FeatureBossThin2 line. I've gone
    over the inputs over and over and I can't see the problem. When I run
    the macro once, it creates a sketch, then gives me that error. If I
    run the macro again (after having run it once already) it actually
    extrudes the arc and gives me the same error message again. If I go
    and manually edit the feature (the extruded arc) after it is created,
    an error box comes up:

    "Please enter a number greater than or equal to blablabla and less
    than bla bla bla"

    I just press OK and then press OK again to exit the feature edit box,
    and everything seems fine after that (if I go to edit the feature
    again, I don't get the error).
    I tried changing all the numbers (the ones with data type double) to
    values of various sorts but doesn't fix it.

    I can't use it as it is (using the workaround above) because I want to
    repeat this arc over and over at different sizes and locations, so I
    cant go back and edit this manually each time because there will be
    too many, so I have to get rid of the error. Any suggestions?

    Thanks,
    Mike
     
    Mike, Jun 30, 2004
    #1
  2. Use this method instead to extrude your part

    Dim Feat As SldWorks.feature
    Dim Featman As SldWorks.FeatureManager

    Set Featman = Part.FeatureManager

    Set Feat = Featman.FeatureExtrusion(True, False, False, swEndCondBlind, 0,
    Length, 0.0254, False, False, False, False, 0.01745329251994,
    0.01745329251994, False, False, False, False, 0, 1, 1)

    I don't know what exactly is wrong with your code but I have had good luck
    with the above method of creating an extrude feature.

    Corey Scheich
     
    Corey Scheich, Jun 30, 2004
    #2
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.