I'm trying to automate a process with SolidWorks API.
I have a 3D spline. I'm trying to insert reference planes evenly along the spline. In order to do so, I've created reference points evenly along the spline and then use the reference point to create planes. The problem is, when I modify the spline, the reference points show up with a distance relationship along the spline instead of evenly spaced.
I'm going to be using a macro anyway, so I have no problem having a macro measure the spline and then adjust the reference points accordingly each time I edit the spline.
I'm attempting to do this using the function "EditReferencePoint". I have searched but found almost no info about this function, only what is in the API help itself (no examples).
Can anyone help me get this to work?
Here is the code, simply trying to get EditReferencePoint to work.
I've tried selecting both the reference point and the spline and just the reference point and nothing seems to work.
If I step through the code, the boolstatus is always "False" when it executes that line.
Option Explicit
Dim Part As Object
Dim swApp As SldWorks.SldWorks
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Spline1@CentCurve", "EXTSKETCHSEGMENT", 0, 0, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("Point59", "DATUMPOINT", 0, 0, 0, True, 0, Nothing, 0)
boolstatus = Part.FeatureManager.EditReferencePoint(2, 0, 0.002, 1)
boolstatus = Part.EditRebuild3()
Part.ClearSelection2 True
End Sub
Thanks,
SolidworksApi macros