ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
TTTimo Tuominen17/01/2012

Hello everyone, help needed!

I have a spline with X amounts of points on it (refrence geometry --> points).

What i want to do is add planes to the points which are normals to the spline.

I recored a macro of the action, if i change the "Point12" to Point11 and run the macro again it makes the plane.

What i want the macro to do is to add points to the spline (asks how many points) and add planes to the points automatically.

Ive never done any programming so i dont know how to do it, help would be greatly appreciated, thanks in advance!!

Picture and macro code below, macro only includes adding a plane:

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

boolstatus = Part.Extension.SelectByID2("Spline1@Sketch1", "EXTSKETCHSEGMENT", 0.04562819180932, 0.05035802922642, 0, True, 0, Nothing, 0)

boolstatus = Part.Extension.SelectByID2("Point12", "DATUMPOINT", 0.0428160235158, 0.04836573865836, -0.005791574549988, True, 1, Nothing, 0)

Dim myRefPlane As Object

Set myRefPlane = Part.FeatureManager.InsertRefPlane(514, 0, 4, 0, 0, 0)

Part.ClearSelection2 True

End Sub

https://lh5.googleusercontent.com/-0cNdkarq6yI/TwyiOZmXE5I/AAAAAAAAA18/2gCAFF157sw/s640/Part2.JPG