making multiple points coincident to a surface at once

Discussion in 'SolidWorks' started by Joa, Jul 23, 2003.

  1. Joa

    Joa Guest

    If I have multiple points in a 3D sketch how can I make them *all* (or
    whichever ones I select) coincident to a surface at once without
    individually assigning a relationship for each one at a time????

    I'm laying out hundreds of holes in a compound skin (using a 3D sketch
    in the hole wizard) and it's a total chore to assign each
    individually.

    Thanks!

    Joa
     
    Joa, Jul 23, 2003
    #1
  2. a typical job for a small macro.
    the following one will do it if your points are coincident to a single face:

    Sub main()
    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    Set sketch = Part.GetActiveSketch2
    If sketch Is Nothing Then
    MsgBox "The 3DSketch must be open", vbCritical, "Points on Face
    macro"
    End
    End If
    Set Sel = Part.SelectionManager
    If Sel.GetSelectedObjectCount <> 1 Or Sel.GetSelectedObjectType(1) <> 2
    Then ' FACE
    MsgBox "You must select the face", vbCritical, "Points on Face
    macro"
    End
    End If
    Set face = Sel.GetSelectedObject(1)
    points = sketch.GetSketchPoints
    For Each i In points
    i.Select False
    face.Select True
    Part.SketchAddConstraints "sgCOINCIDENT"
    Next i
    End Sub

    if you want to constrain your points to the closest face and to create
    tangent planes at each point to pattern extrusions, you'll need our
    SolidSketch add-in (see www.solidplus.com/solidsketch )
     
    Philippe Guglielmetti, Jul 23, 2003
    #2
  3. Joa

    Joa Guest

    This is good, thank you. I'm not the best at macros but will give this
    a try.

    Will it also work for making multiple points coincident to one plane?
    I can 3D sketch points onto a surface (just by clicking on it with a
    point in the hole wizard) but then need to line them all up in a row
    on a plane. That's what's really taking the time.

    Thanks again!

    Joa
     
    Joa, Jul 25, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.