AnsweredAssumed Answered

Macro for adjusting dimension to keep constant volume?

Question asked by J. R. on Jun 11, 2014
Latest reply on Jun 14, 2014 by Artem Taturevych

Hi all,


Due to SW limitations on dimensioning volumes, I need a macro to do a certain job. However, due to my inexperience, I don't know how to write it.


I'm attaching the model so you can see. Generated in SW2013.


There is a 3D solid body. There is also a plane which intersects the body, and cuts off part of it (Surface Cut command). The plane's position is controlled by 2 dimensions - Angle at which the model is cut (Angle@Cut Angle), and how close the plane is to the center of the body (Depth@Cut Depth).



In Equations window, user inputs the Desired Volume, Error Margin and Angle, manually, and as the model is rebuilt, the macro should adjust Depth@Cut Depth by trial and error to set the Volume of the body in 10% Error Margin.




Again, the macro should:

1. Run every time model is rebuilt;

2. Compare Volume to Desired Volume;

2. Adjust Depth dimension in Cut Depth plane by trial and error until these Volume is within 10% of Desired Volume

3. End.



Can anybody help me out to write this macro? I need not only to write it, but to understand it, because I'll be using it for much more complex model.