Skip to main content

Posts

Showing posts from July, 2020

Solidwork API Programming: The centerline macro updated!! Run with macro button~

The centerline macro updated!! I didn't expect I can play with solidworks API programming again but it is actually interesting stuff. So the centerline macro code I wrote a long time ago was reviewed and I decided to modify just a single line. It makes a difference. The code was updated and accordingly the post updated as well. You can copy and paste and try to run referring to previous post. https://spaceunity.blogspot.com/2007/10/solidworks-api-programming-part-2.html The problem of previous code was the centerline can be made only on the rectangular face. Just simple change can make the target face to any polygon with an even number of edges.  Here are changes: ... For i = 0 To nEdgeCount / 2 - 1 Set swSketchSeg = pModel.CreateLine2( _ vMidPts(i * 3 + 0), vMidPts(i * 3 + 1), 0, _ vMidPts(i * 3 + nEdgeCount * 3 / 2), vMidPts(i * 3 + nEdgeCount * 3 / 2 + 1), 0) swSketchSeg.ConstructionGeometry = True Debug.Print "vMidPts-from (...