AnsweredAssumed Answered

Edit the coordinate of a sketchpoint

Question asked by Benjamin Zachar on Feb 8, 2019
Latest reply on Feb 13, 2019 by Nilesh Patel

Hi!

 

I'm beginner with the SolidWorks API and I'm practicing with a simple program.

The precondition is that I have on opened part which is a cube, made by an extrusion of a square on Sketch1

What I would like to do is select the Sketch1, edit the sketch, select Point2 and move it to a given coordinate.

The question is how can I move it? Thank you!

 

This is the program what I wrote so far:

 

 

 

Imports SolidWorks.Interop.sldworks

Imports SolidWorks.Interop.swconst

 

Module Module1

 

    Sub Main()

        Dim app As SldWorks

        Try

            app = GetObject(Nothing, "SldWorks.application")

        Catch ex As Exception

            app = CreateObject("SldWorks.application")

        End Try

        app.Visible = True

        Dim model As ModelDoc2 = app.ActivateDoc3("D:\Part1.sldprt", True, 0, 2)

 

        model.Extension.SelectByID2("Sketch1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)

        model.EditSketch()

        model.ClearSelection2(True)

        model.Extension.SelectByID2("Point2", "SKETCHPOINT", 0, 0, 0, False, 0, Nothing, 0)

 

        '???

 

        Console.ReadKey()

 

    End Sub

 

End Module

Outcomes