SOLIDWORKS API is a gateway to automating your design process and data management. Using .NET compatible languages (VB, C#, C++) one can write small macros or build full-blown add-ins for modelling, routine edits and feeding data from one software package to another.
We at Solid Solutions offer bespoke coding on a consultancy basis. Be it a one-page input form, a PDM Pro custom task or a multiplatform app that talks to SOLIDWORKS – we have a team of automation specialists able to tackle a wide range of challenges.
But what can be done with API outside of office hours, just for fun? Well, it’s not very hard to implement some basic MINECRAFT functionality with a couple of macros. Let’s have a look at the process and some results!
You will need to edit the code behind your macro to remove the selection part. This is done through Tools -> Macro -> Edit. Your macro code will look similar to one below:
This macro allows you to ‘draw’ cubes on top/below/next to other cubes. If bound to a keyboard shortcut or a spare mouse button this can be done very quickly.
Okay, this is where things get tricky. You will need some SOLIDWORKS API and VBA programming knowledge from here onward. I created some textured appearances and saved them as .p2m files in a sub folder next to my macro file. Then we add some bits of intelligence to the already existing macro:
I created two macros for ‘bark’ and ‘leaves. Now we can ‘draw’ some vegetation:
With some time and effort we can grow trees even:
Here we have barely scratched the surface of what SOLIDWORKS API is capable of… Minecraft within SOLIDWORKS!
Now show this to the young people you know, maybe they will become SOLIDCRAFT Engineers one day.
Elite Applications Engineer
Categories: SOLIDWORKS 2017, Tips & Tricks, Usability