What's wrong with EditMate2 ?

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

Reply to
massoud shakeri
Loading thread data ...

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

Reply to
Jonathan Anderson

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"

Reply to
massoud shakeri

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 snipped-for-privacy@jwoperating.com Include my first name in any email to get past my filters.

Reply to
Jonathan Anderson

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.