×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SW prevents macro from creating overlapping points

SW prevents macro from creating overlapping points

SW prevents macro from creating overlapping points

(OP)
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
 

RE: SW prevents macro from creating overlapping points

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

RE: SW prevents macro from creating overlapping points

There is a setting that prevents SW from merging two close sketch points.  I can't remember what it is at the moment.

RE: SW prevents macro from creating overlapping points

(OP)
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.

RE: SW prevents macro from creating overlapping points

Found it!
ModelDoc2::SetAddToDB

Set to TRUE to turn off snapping.

RE: SW prevents macro from creating overlapping points

(OP)
Works beautifully... many thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources