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.
Help needed on 3D sketch macro
Help needed on 3D sketch macro
- Attachments
-
- 3DSketchCircleShop2.swp
- (42 KiB) Downloaded 32 times
Re: Help needed on 3D sketch macro
See the Remarks section of this page in the API Help.
Re: Help needed on 3D sketch macro
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)
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
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
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.