AnsweredAssumed Answered

Default hole wizard value

Question asked by Peter Ham on Aug 17, 2012
Latest reply on Aug 18, 2012 by Peter Ham

Hi all,


I'm new to Solidworks API, and programming in general really, but I've been muddling through a slightly useful macro as a learning experience as much as anything. I've now come to a point where I'm stuck.


I've recorded a macro to create a circular sketch on the right plane, and extrude it mid plane. A user form allows inputting of dimensions for diameter and length.

From there, I added the option of creating a hollow shaft, with an input box for the internal diameter.


So far so good.


I'm now trying to add the option to have a solid cylinder, with centrally tapped holes in each end, but I have two issues.


First off, I'm using IFeatureManager:HoleWizard4, but the hole diameter is being set to the wrong value. When I recorded the macro, I used an M5 tapped hole, so the diameter is being set to 4.2mm on every hole, even on an M2 feature!

Is there any way to get Solidworks to select the appropriate drill diameter, as it would usually do if you create the feature manually?


Secondly, the feature is not being put where I want it to be. When I recorded the macro, I constrained the hole wizard position point to the centre of the circular face, however it is always positioned at X: -0.12566938mm, Y: 0.12566938mm from the origin on the face selected.


Any insight would be most welcome.