8 Replies Latest reply on Dec 10, 2012 12:58 AM by Artem Taturevych

# How to get min distance of two parts in an assembly in motion study?

I have an assembly composed of 2parts for motion study, I want to get the minimum distance between these two parts at each time step? Is that possible? How to do it? Thanks.

• ###### Re: How to get min distance of two parts in an assembly in motion study?

Hi Feng,

Hope the attached example is what you are looking for.

______________________

Regards,

Artem Taturevych

Tel: +61 2 9454 4444

• ###### Re: How to get min distance of two parts in an assembly in motion study?

Yes, That is almost what I want, although I can only guess from the code ( I am c++ programmer, never use C#). Thanks a lot!

• ###### Re: How to get min distance of two parts in an assembly in motion study?

One more question, Is it possible to get the minimum distance directly from solidworks without programming instead of API?  If I could do this, then is it possible to get 1st 2nd 3rd ...30 group of min distances from solidworks without coding? Thanks.

• ###### Re: How to get min distance of two parts in an assembly in motion study?

Look at Tools->Measure tool.

______________________

Regards,

Artem Taturevych

Tel: +61 2 9454 4444

• ###### Re: How to get min distance of two parts in an assembly in motion study?

I rewrite the example in C++, it seems that the "double dist = measure.Distance;" dist  never changes with time step. dist always keeps the same value. Also, the tranformmatrix never changes with time either.

• ###### Re: How to get min distance of two parts in an assembly in motion study?

Have you tried the macro I attached? It is working correctly from my end.

______________________

Regards,

Artem Taturevych

Tel: +61 2 9454 4444

• ###### Re: How to get min distance of two parts in an assembly in motion study?

sorry, I do not know how to test it Because I am not familiar with C#.

• ###### Re: How to get min distance of two parts in an assembly in motion study?

Almost no differences between c# and c++ in this case. This is the VSTA macro so you can open it by Tools->Macro->Edit and use the same debugging techniques as you are using in c++;

______________________

Regards,

Artem Taturevych