Help needed on 3D sketch macro

Library for macros
MattW
Posts: 61
Joined: Wed May 12, 2021 12:39 pm
Answers: 2
x 5
x 33

Help needed on 3D sketch macro

Unread post 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.
Attachments
3DSketchCircleShop2.swp
(42 KiB) Downloaded 73 times
User avatar
JSculley
Posts: 648
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 888

Re: Help needed on 3D sketch macro

Unread post by JSculley »

See the Remarks section of this page in the API Help.
MattW
Posts: 61
Joined: Wed May 12, 2021 12:39 pm
Answers: 2
x 5
x 33

Re: Help needed on 3D sketch macro

Unread post 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)
User avatar
josh
Posts: 304
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 514

Re: Help needed on 3D sketch macro

Unread post 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.
MattW
Posts: 61
Joined: Wed May 12, 2021 12:39 pm
Answers: 2
x 5
x 33

Re: Help needed on 3D sketch macro

Unread post 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.
Post Reply