Dear Solidworks API Experts,
I have a component, whose holes are defined via Linear Pattern.
I would like to control the spacing between those holes, via Solidworks API.
Is it possible to get a VBA/VB.NET/C# code, which changes the spacing of the Linear Pattern in an assembly file (.SLDASM)?
The problem I have, is that I can't select the Linear Pattern, inside the Component.
I tried recording a macro, and the macro shows the following:
boolstatus = Part.Extension.SelectByID2("D3@LPattern1@Part1^holes with bolts2-1@holes with bolts2", "DIMENSION", 0.233189692745758, -4.63590286780184E-02, -0.203375327910249, False, 0, Nothing, 0)
When I try to replicate it to C#, it didn't work. The "LPattern1" is not selected.
Then I found a C# example:
https://help.solidworks.com/2023/english/api/sldworksapi/Get_Linear_Pattern_Feature_Data_Example_CSharp.htm
It selects the Linear Pattern via:
status = swModelDocExt.SelectByID2("LPattern1", "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
This didn't work as well. It didn't select the "LPattern1".
Do I need to select the Linear Pattern - in order to control the spacing between those holes (via API)?
I would welcome any kind of help. As I am desperate at the moment.
Thank you in advance for any input.
Kind regards,
Didier