3 Replies Latest reply on May 19, 2009 6:57 PM by Josh Brady

    How does Hole Wizard work?

    Ron Betser
      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
        • How does Hole Wizard work?
          Jay Andrews
          I'll guess that it's using a high enough programming level that it don't need no stinking planes.
          • How does Hole Wizard work?
            Eddie Cyganik


            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.
            • How does Hole Wizard work?
              Josh Brady
              I'm thinking the Hole Wizard is basically like a built-in macro feature. The plane that the revolve sketch is built on does exist as a feature in the part. However, you can't access its definition at all. By using the macro below you can actually create a sketch on the same plane used by the revolve. If you then edit the sketch plane of that sketch, SW acts as if the plane is missing.

              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