4 Replies Latest reply on Sep 22, 2017 12:48 AM by Makoto Iki

    Hole wizard API parameter mess

    Peter Brinkhuis

      I've been struggling with the Hole Wizard API last night. I started by reading the documentation. It is lengthy, but not complete or clear. The HoleWizard5 function has 27 parameter, but the function of each variable depends on the hole type that you create. That's a disaster waiting to happen in and by itself.

       

      2015 SOLIDWORKS API Help - HoleWizard5 Method (IFeatureManager)

       

      I have recorded tens of hole creations where HoleWizard5 is being used. But when I play the macro afterwards, the result is a different hole.

       

      My method was this: (using SW 2017 Sp2)

      • Select a flat face so it has a point and face for the hole
      • Record the macro while adding this hole
        • Straight Tap, ISO, Tapped Hole, M10, Through all, Through all, center thread callout option "Cosmetic thread", With Thread callout enabled, Near side countersink diameter 11mm, angle 90 degrees
      • Open the macro and delete all the code where a point is created. Leave only the HoleWizard5 line and variable declarations
      • Select a face again
      • Run the macro

       

      The result is a different hole, not with a countersink but with a blind thread depth of 11mm. If the code itself can't figure out how to use this function, how can i?

       

      Now my questions are:

      • Do you see the same behavior when you follow these steps?
      • Has anyone gotten the hang of using this function? How?
        • Re: Hole wizard API parameter mess
          John Alexander

          I'm about to dive into a project involving hole wizard feature generation. This is foreboding.

           

          I'm still on SW2012 but I tried your workflow using HoleWizard4(). So far I've only seen one difference between the hole generated during the recording and the hole generated by executing the recorded macro:

           

           

          I'm pretty sure this thread representation option isn't configured anywhere in the API (which sucks because this is how my group likes to represent reamed holes for dowels).

           

          Have you tried using the deprecated HoleWizard4 call with extraneous arguments removed?

            • Re: Hole wizard API parameter mess
              Peter Brinkhuis

              Thanks for trying, I don't remember trying HoleWizard4. The help file doesn't seem that different. Which arguments can you discard?

                • Re: Hole wizard API parameter mess
                  John Alexander

                  It looks like the difference between HoleWizard4 and HoleWizard5 is the Length argument was added between Depth and Value1.

                   

                  I've run into other problems with hole creation which I asked about in this post recently.

                   

                  One strange thing that I observed was that the second argument, when filled in by the macro recorder, was always -1. This isn't part of the enumeration.

                   

                  2015 SOLIDWORKS API Help - swWzdHoleStandards_e Enumeration

                   

                  I'm using a HoleWizard/Toolbox standard that was created by a previous employee. It is strange to me that this argument is an enumeration when such customization is possible.I would expect it to take a string identifier which would be the name of the standard. All of the elements of that enumeration look like default toolbox standards that would be available - but I'm not using a default standard. Nowhere do I explicitly say which hole standard to use in my call to HoleWizard4, but it successfully inserts holes from the desired standard. I suspect that -1 means to use the default value and that just happens to be the desired standard on my machine.

                   

                  I have similar confusion regarding the third argument, that enumeration is monstrously large.

              • Re: Hole wizard API parameter mess
                Makoto Iki

                SOLIDWORKS 2017 SP4.1

                 

                Tap Holes Parameters

                 

                SW2017 API HELP            result
                1. Tap drill diameteObsolete?
                2. Tap drill depthObsolete?
                3. Thread Depth1. Thread Depth
                4. Near Csink Diameter2. Near Csink Diameter
                5. Near Csink Angle3. Near Csink Angle
                6. Far Csink Diameter4. Far Csink Diameter
                7. Far Csink Angle5. Far Csink Angle
                8. Drill Angle6. Drill Angle
                9. Cosmetic Thread Type7. Cosmetic Thread Type
                10. Thread End Condition8. Thread End Condition
                11. Helicoil Tap Type9. Helicoil Tap Type?
                12. Offset10. Offset?
                -11. ?
                -12. ?

                 

                HoleWizard5(swWzdTap, swStandardISO, swStandardISOTappedHole, "M10", swEndCondThroughAll, -1, -1, -1, -1, -1, -1, -1, -1 ,-1, -1, -1, swCosmeticThreadWithCallout, swEndCondThroughAll, -1, -1, "", False, True, True, True, True, False)