Page 1 of 1

Help needed on 3D sketch macro

Posted: Wed Jun 05, 2024 2:58 pm
by MattW
Greetings all-

I am working on a macro that draws a series of circles in a 3d sketch. Right now, I am just working out how to handle variables to draw circles of varying centerpoints and diameters. The problem I am running into is that not all the circle persist, when I step through it creates the circle but it promptly goes away. It does not do this in a predictable manner. If someone could provide some insight into what is going on, that would be great.

The longer term goal is to have a table of circles with known centerpoints and diameters and import them into SW and draw them.

Re: Help needed on 3D sketch macro

Posted: Wed Jun 05, 2024 3:15 pm
by JSculley
See the Remarks section of this page in the API Help.

Re: Help needed on 3D sketch macro

Posted: Wed Jun 05, 2024 5:33 pm
by MattW
Thanks.

The remarks implies that it could be related to snapping, and it behaved properly when I turned that off. When on, it would either miss circles completely, and sometimes would start drawing them with them in the wrong orientation. I don't understand this behavior, the errors are random. I could probably dig into it if I really wanted to chase it down.

But AddToDB fixes the problems, and has the side benefit of making the macro run considerably faster. Next problem is to figure out how to read values in from a table (could be a spreadsheet or a csv file)

Re: Help needed on 3D sketch macro

Posted: Wed Jun 12, 2024 2:15 pm
by josh
ChatGPT can probably write you some code to do either. SolidWorks API is too complex to get working code from ChatGPT, but Excel or reading a CSV is pretty simplistic.

Re: Help needed on 3D sketch macro

Posted: Thu Jun 13, 2024 11:43 am
by MattW
I got some code that could enter the values from a table, so I have that down. Now I have to work on the Siemens 840d coding. I saw somewhere that Siemens documentation makes sense to people who already understand the material.