AnsweredAssumed Answered

Select behavior with VBA and manual selection

Question asked by Andreas Killer on Jul 21, 2017
Latest reply on Jul 24, 2017 by Andreas Killer

I often have to calculate the weld length of native models to calculate the time needed.


For this I wrote a small tool which selects all inner edges of a surface and calculate their length. This works so far very well.


However, there is a curious behavior with Solidworks that I would like to improve.


The file attached includes a part to make this clear.


As a rule, I select the domed top surface and then start my tool. This recognizes most of the inner edges and selects them for optical control in SW.
An edge is often missing, so I select this in the list box additionally (see Screenshot)


Now I turn the part and select the domed bottom surface and click the "Hinzu" button (this is the "Add" button).


At this point you can see the curious behavior: No edges are added!


My first thought was this is due to my code, but if I place a break point in the first line in Private Sub cmdAdd_Click() I can see that the surface is not selected anymore!


Now I select the same surface again and click the "Hinzu" button again... and all edges of the selected surface are added.


From this point on I can select more surface, click the "Hinzu" button again, no issues anymore.


BTW, the "Neu laden" button in the middle means "Reload", means clear the listbox and check any selected item again.


Does anyone have an idea how to improve this behavior?