razzendahcuben
Mechanical
- Jan 10, 2009
- 79
Run the code below with a sketch in the X-Y plane open. Select all of the points and note how many were created. Now, delete the points, zoom in a little, and run the macro again. Note that the macro creates many more points this time.
SW prevents the macro from creating points that overlap one another. I am assuming that this involves a setting. Is there any way I can turn off this setting? Thanks.
=========================
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Sub main()
Dim r As Single
Dim x As Single
Dim y As Single
Dim t As Single
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Dim skPoint As Object
r = 0.01
For t = 0 To 6.28318 Step 0.01
x = r * Cos(t)
y = r * Sin(t)
Set skPoint = swDoc.SketchManager.CreatePoint(x, y, 0#)
Next t
End Sub
SW prevents the macro from creating points that overlap one another. I am assuming that this involves a setting. Is there any way I can turn off this setting? Thanks.
=========================
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Sub main()
Dim r As Single
Dim x As Single
Dim y As Single
Dim t As Single
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Dim skPoint As Object
r = 0.01
For t = 0 To 6.28318 Step 0.01
x = r * Cos(t)
y = r * Sin(t)
Set skPoint = swDoc.SketchManager.CreatePoint(x, y, 0#)
Next t
End Sub