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.
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
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.
PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.