Preview | SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
ESEric Strauss07/06/2007
I am new to the forums here and new to API programming for
SolidWorks.I'm self taught in vBA mainly through recording macros
and some books and was hoping to do the same with SW.
Here is my issue. I am trying to modify points in an existing part by
importing them from a table in Excel (where I plan to run the
code). The coordinates are for a point in a 3D Sketch.When I record
a macro in SW for the sequence of events, the code says nothing
about the new coordinates I have assigned. Obviously when I re-run
the code it dos not change the point.
Does anyone know what command I should be using to change the points.Here is what the SW macro records:
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
boolstatus = Part.Extension.SelectByID2("L-LWB-F", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.EditSketch
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Point1", "SKETCHPOINT", -0.0127, -0.0508, 0.0508, False, 0, Nothing, 0)
Part.ClearSelection2 True
Part.Insert3DSketch
End Sub
Thanks in advance for any help!
SolidWorks.I'm self taught in vBA mainly through recording macros
and some books and was hoping to do the same with SW.
Here is my issue. I am trying to modify points in an existing part by
importing them from a table in Excel (where I plan to run the
code). The coordinates are for a point in a 3D Sketch.When I record
a macro in SW for the sequence of events, the code says nothing
about the new coordinates I have assigned. Obviously when I re-run
the code it dos not change the point.
Does anyone know what command I should be using to change the points.Here is what the SW macro records:
Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
boolstatus = Part.Extension.SelectByID2("L-LWB-F", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Part.EditSketch
Part.ClearSelection2 True
boolstatus = Part.Extension.SelectByID2("Point1", "SKETCHPOINT", -0.0127, -0.0508, 0.0508, False, 0, Nothing, 0)
Part.ClearSelection2 True
Part.Insert3DSketch
End Sub
Thanks in advance for any help!