Note I am very new at VBA and coding in Solidworks API in general. Explaining things very simply would be very helpful.
I am trying to generate a part based off a set of points I've uploaded. Each of the points, when uploaded, is assigned a number (i.e. "Point32@Sketch1", etc.). I would like to, as part of a loop, create a Reference Axis going from the Origin to each of the points. Since the point where I am drawing the axis will change each loop, I use SelectbyID2 (whose first input is the name in the form of a string) to pick the origin and the point in question.
Dim count As String
Dim sketchname1 As String
Dim sketchname2 As String
Dim sketchname As String
count = 1
sketchname1 = "Point"
sketchname2 = "@3DSketch1"
Do While Not EOF(1)
sketchname = """" & sketchname1 & count & sketchname2 & """"
Axisname = """" & Axis & count & """"
Planename = """"" & Plane & count & """""
'creates the reference axis for a point
boolstatus = Part.Extension.SelectByID2(sketchname, "EXTSKETCHPOINT", X / 1000, Y / 1000, Z / 1000, True, 0, Nothing, 0) 'selects the first point from our data
boolstatus = Part.Extension.SelectByID2("Point1@Origin", "EXTSKETCHPOINT", 0, 0, 0, True, 0, Nothing, 0) 'selects the origin
boolstatus = Part.InsertAxis2(True) 'inserts and axis going between the point and the origin
count = Format(Val(count) + 1) 'turns the count into a number, increase it by one, then back to a string
Loop
Close #1
My issue is that while I initialize the variable sketchname as a string, and concatenate with other strings, the SelectbyID2 is reading sketchname itself as a string, and not seeing the string inside the variable. I want the string inside sketchname to change each loop, but SelectbyID2 is just reading it as sketchname each time.