What's wrong with EditMate2 ?

Discussion in 'SolidWorks' started by massoud shakeri, May 9, 2004.

  1. Dear fellows:
    It's several days that I am struggling with Editing angle and distance Mates
    in SolidWord. I tried to use it in C++ but it did not work. So I wrote a
    simple program in VBA to test EditMate2.
    firstly, its syntax which intellisense shows is different from API help.
    Secondly, I could run other methods of AssemblyDoc, but when I use EditMate2
    is shows this error message:
    "Expected function or Variable". it seems that this function is not defined
    or it's a private method.
    If you know how to solve the problem, I would appreciate about the response.
    thanks
    massoud
     
    massoud shakeri, May 9, 2004
    #1
  2. I had trouble with this function, too. Here's how I'm using it now,
    and it seems to be doing okay:

    1) Select the mate with a mark of zero.
    2) Select both entities that are mated with a mark of one.
    3) Call AssemblyDoc->EditMate2(long type, long align, VARIANT_BOOL
    flip, double dist, double distMin, double distMax, double gearNum,
    double gearDenom, double angle, double angleMin, double angleMax, long
    &err)

    So, if I'm editing a distance mate, my call looks like this:
    EditMate2(swMateDISTANCE, swMateAlignALIGNED, FALSE, distance,
    distance, distance, 1, 1, 0, 0, 0, &err);
    For an angle, like this:
    EditMate2(swMateANGLE, swMateAlignALIGNED, FALSE, 0, 0, 0, 1, 1,
    angle, angle, angle, &err);

    The most annoying thing is that the selection marks and order are
    important, but it doesn't tell you this anywhere in the documentation.
    In fact, it tells you to select the two entities first, and then the
    mate, but that doesn't work.

    Jonathan Anderson
     
    Jonathan Anderson, May 10, 2004
    #2
  3. Dear Jonathan:
    I do appreciate for your response, and please accept my compliments for your
    knowledge. I changed the mate and entities' marks to 0 & 1, and selected
    them in the same order,so the EditMate2 worked.
    However, it changes the angle, but it returns an unknown error, and sets the
    minimumVariation to the angle and Maximumvariation to 30 deg more than the
    angle.
    To solve the problem, I tried all possible combinations of values for other
    parameters, such as angleMin and angleMax, but none of them had any effect
    on the result. Fortunately, it changes the mate to the desired angle, and
    it's a big achievement.
    thanks again
    massoud


    "Jonathan Anderson"
     
    massoud shakeri, May 11, 2004
    #3
  4. Thank you. I mostly deal with distance, coincident, and concentric
    mates, so I'm not sure about the angle variation issue. I've asked
    SolidWorks about the unknown error problem before, and never received
    a response. I can't get it to return anything other than the unknown
    error no matter what I try. At least the function does return S_OK.
    It's kind of a pain because you don't know whether it succeeded or not
    unless you check the transform of the component, but that's the way it
    is. If you ever find out anything on that, let me know

    Jonathan Anderson

    Include my first name in any email to get past my filters.
     
    Jonathan Anderson, May 12, 2004
    #4
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.