Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SW prevents macro from creating overlapping points 1

Status
Not open for further replies.

razzendahcuben

Mechanical
Jan 10, 2009
79
0
0
US
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
 
Replies continue below

Recommended for you

i don't think there is any way to get SW to place two points at the same coordinate in the same sketch. for what reason do you need two points at the same coordinate?

rfus
 
I should also mention that you should turn off snapping to get the best results.

rfus, at no time is the macro attempting to place 2 points at the same coordinate.
 
Status
Not open for further replies.
Back
Top