I am trying to create a design feature using a revolve cut
just like the Hole Wizard. However I can't figure out how the Hole
Wizard works. It seems like when you pick a face to insert a hole
onto the wizard creates a plane perpendicular to that face at the
point on the selected face. But if you select on the revolved
sketch under the hole there is no plane selected and you can't
change it. The macro used to create the hole must delete it. If
anyone has an idea please help. Thanks
Ron,
First of all, thanks for the question.
The reason I say this is because I have quite a few Library and Palette features and all of them were created with at least one plane, the one the sketch is created on.
Long story short, I don't know how SolidWorks does this. So sorry!
...however, after investigating a bit, I created a hole wizard feature, modified the sketch (quite drastically) and then created a library feature out of it.
So if this is possible, you may be able to get where you need to go following this path.
I'm out of time for today.
Let us know how you do.
Also, you can even delete the hole wizard feature after creating a sketch on the revolve's plane. The plane doesn't get deleted, but you can no longer change its location.
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSketch As SldWorks.Sketch
Dim swFeat As SldWorks.Feature
Dim DatumType As Long
Dim swSkPlane As Object
Dim swPlane As SldWorks.RefPlane
Dim PlaneData As SldWorks.RefPlaneFeatureData
Sub main()
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set swSelMgr = swDoc.SelectionManager
If swSelMgr.GetSelectedObjectType3(1, -1) = swSelSKETCHES Then
Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swSketch = swFeat.GetSpecificFeature2
Debug.Print swSketch.Name
Set swSkPlane = swSketch.GetReferenceEntity(DatumType)
Debug.Print DatumType = swSelFACES, "Face"
Debug.Print DatumType = swSelDATUMPLANES, "Datum"
If DatumType = swSelDATUMPLANES Then
Set swPlane = swSkPlane
'swPlane.Name = "Plane2See"
Debug.Print swPlane.Name & " is hidden?: " & swPlane.GetUIState(swIsHiddenInFeatureMgr)
Debug.Print "Show plane: " & swPlane.Name
swPlane.SetUIState swIsHiddenInFeatureMgr, False
Debug.Print swPlane.Visible
swPlane.Select False
swDoc.InsertSketch2 False
End If
End If
End Sub