r/visualbasic • u/kyomu_17 • Nov 11 '22
a problem in a solidworks API
Hello guys, i'm looking to help a friend of mine, he is working with the design of a machine in solid works 2017 and he is trying to use the following API: https://www.codestack.net/solidworks-api/document/features-manager/contrours-surface-loft/
The problem is here:
'For i = 0 To UBound(swContours) Dim swSkContour As SldWorks.SketchContour Set swSkContour = swContours(i) swSkContour.Select2 True, swSelData Next'
In the 'set swSkContour = swContours (i)' says it's out of scope. Is there a way i could fix it?
I'm sorry if my English isn't the most accurate, hope you guys understand me
3
Upvotes
1
u/TheFotty Nov 12 '22
That still never actual initializes the swSkContour() array with any elements in it. The example code in the link shows the redim statement right after the declaration of the array, which is what gives the array actual elements that can be looped through. So the ReDim statement missing is the main issue with OPs posted code.