AnsweredAssumed Answered

API strategie to generate designs

Question asked by David S on Jul 3, 2012
Latest reply on Jul 10, 2012 by Raghu Kadumpadi



I'm new to the solidworks API and this forum as wel, but I have a rather general question on automating designs in Solidworks with the API. After a bit of research on the internet, I was able to write me a few macro's from scratch to automate a table assembly. This was one of the exercises I did for myself. Anyway, while I was working on this exercise, I came up with a dilemma.


I was wondering what is the best strategie to start automating this kind of projects. To make things clearer I use the table assembly as my example. The first macro used the user input on a form to change the width, height, and the thickness of the table top. I did this by changing all the dimensions in every part in the assembly through the Solidworks API. It worked fine, but the problem is, that if someone else wants to use this API on an other project, it is rather difficult to understand and use it. Especially if you haven't got any programming skills. So the next thing I did was in the same assembly put in some global variables and make the assembly itself a lot more intelligent. then I used the same user input of the same form to change the global variables in the assembly through the solidworks API. This has also a few disadvantages :-) I think this code is a lot less understandable, since you use an array to list all the equations and have to now on wich index a special global variable is.


So I want to know what the best way is to automate anything in Solidworks. Make your assembly as smart as possible and use a lot of global variables and equations and keep the intelligence in solidworks, or just leave the intelligence out of solidworks and put this in the Macro. I guess there are limitations on both strategies. That's why I want your opinions :-)


Greets and thanks in advance