ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
ARAlex Reds22/12/2013

Hi guys, I have a macro that divide a spline in a number of points (100 in my macro). But there is a problem: my macro creates these points OUTSIDE the sketch. I need instead that my macro creates points INSIDE MY SKETCH.

The code of my macro is:

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2

Dim swSelMgr As SldWorks.SelectionMgr

Dim vFeatArr As Variant

Dim swFeatMgr As SldWorks.FeatureManager

Dim swModelDocExt As SldWorks.ModelDocExtension

Dim swSpline As SldWorks.SketchSpline

Dim swFeat As SldWorks.Feature

Dim myRefPlane As SldWorks.RefPlane

Dim boolstatus As Boolean

Dim i As Long

Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Set swSelMgr = swModel.SelectionManager

    Set swFeatMgr = swModel.FeatureManager

    Set swModelDocExt = swModel.Extension

    If Not swSelMgr.GetSelectedObjectType3(1, -1) = swSelSKETCHSEGS Then

        MsgBox "select spline"

        Exit Sub

    End If

 

    Dim Spline As Object

    Set Spline = swSelMgr.GetSelectedObject6(1, -1)

    vFeatArr = swFeatMgr.InsertReferencePoint(swRefPointAlongCurve, swRefPointAlongCurveEvenlyDistributed, 0#, 100)

  

End Sub

May you help me?

I post the orginal macro too.

Thanks a lot