Changing Drill Size via Macro - VBA

Hi all

I'm looking to change the drill size of a 3D part. I have in an Excel file the name of the parameter to modify $HW-TAILLE@Trou tapped M180 but I can't find how to assign it via a macro, the value M20 (for example).

If anyone has the solution, I'm all for it.

Kind regards

Stone

 

Hello again,

I guess you're going to have to have fun with the following link using the IWizardHoleFeatureData2 interface :

http://help.solidworks.com/2016/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IWizardHoleFeatureData2_members.html

Just for the record, DriveWorks Solo and DriveWorks Pro are able to change these types of settings much easier than what you get into and don't require any programming!

Enjoy!

2 Likes

Fixed, you can even still use the free version of DriveWorks called DriveWorksXpress which is already included in your version of SolidWorks.

Seriously, take a look, you'll save a lot of time and you can reuse your work rather than doing it piecemeal.

2 Likes

Hello again yes,

I looked at your solution and it seems really good to me but I have trouble understanding this interface. On my side I had found this function "Part.FeatureManager.HoleWizard5", what do you think?

DriveWorks I don't see what it is and I don't think I have it in my SolidWorks version though...  I have an excel file that creates 3D assemblies for me according to certain data entered, all this is controlled via macros, I don't think it's possible to migrate them to DriveWorks that's why I'd like to find the VBA function to make this modification.

Thank you in any case!

A quick search for SW API:

HoleWizard5: Creates a hole or slot using the hole wizard.

This interface is used to create a hole, not to modify an existing one.

What you're looking for is an interface that allows you to modify the properties of an already existing function. This is what IWizardHoleFeatureData2 allows you to do.

Are you familiar and comfortable with programming in general / SW API or are you just starting out?

 

Regarding DriveWorks, what is your version of SOLIDWORKS?

DriveWorks has a range of software, DriveWorksXPress, DriveWorks Solo and DriveWorks Pro.

DriveWorksXpress is the free version that is already in SOLIDWORKS. You just need to turn it on.

Regarding all your macros and Excel files, I'm sure  that everything you've implemented so far wouldn't take a lot of time to reproduce. (whether it's for your files you're working on at the moment, my also  for the next ones!)

If the company you work for is moving towards automation, I would advise you to simply contact your SOLIDWORKS reseller who will be happy to give you a presentation of the different tools!

1 Like

What I'm looking for is to modify an existing one so I'm going to use your DATA2 function.

Regarding programming, it's been barely 1 year since I started so I'm a beginner, but I know how to do something anyway! :)

My company doesn't really aim for automation, I just need to automate a certain product and that's why I go through macros and I would like to avoid going through another software or extension.

Hello

can you give us the part?

May the force be with you

Hi OBI WAN,

For the part I'm sorry but I can't provide it...