swModelDocExt.SelectAll in SW2015 with Userform opened

Hi there,

In a macro to change the scale on a drawing I'm using 'swModelDocExt.SelectAll' to select all dimension followed by 'boolstatus = Part.Extension.AlignDimensions(0, 1)' to align them according the new scale.

Everything worked perfect in 2013 and 2014 but now in 2015 the SelectAll command seems to fail. It looks like the focus is on the userform instead of the open drawing. Showing the userform 'modal' or 'vbmodeless' the userform disappear.

Anybody ?

How can I keep the focus on the drawing when firing 'SelectAll' ?

Greetings !

SolidworksApi macros
Answers 6
DG
DG 2015-04-20 Best Answer

Could you attach the macro to check/test?

CM
CM 2015-04-20

Sure Deepak, see attachment, thanks anyway for your reaction !

Greetings !

DG
DG 2015-04-20

How do you use this macro? Can you also attach a sample file?

CM
CM 2015-04-20

Deepak,

Just assign a macro button to the drawing area to start the macro, see picture.

Exit the macro by hitting the escape key or click next of the 21 buttons in the user form.

When you start the macro the user form header is telling you the actual scale in numbers like 'Original Scale: X:X'.

If there is a button available for the actual scale this button is red boxed.

When you hover the user form the actual scale button stays red lined so you always see you actual scale.

When you click another scale button the scale is set, everything will be selected and align command is called so the dimensions will be aligned.

As said, the SellectAll command is not working any more in 2015.

When you are happy with the result of the chosen scale exit the macro as described above.

That's it.

Can't wait for you solution :-)

What you mean exactly with a 'sample file'?

Greetings !

comment imagecomment image
DG
DG 2015-04-20

Thanks for the reply. The starting sub of this macro is asking for something selected? So I' was little confused as how this would work.

A sample drawing file where this macro is not working.

CM
CM 2015-04-20

Deepak,

I've discovered that when you click the chosen scale button for the second time the SelectAll function is working smoothly.

Btw, I think it could be a nice option to select and change the scale without aligning and if you would like to align the dimensions click for the second time the same button.

I can imagine situations that you've already aligned your dimensions and only like to change the scale without arranging the dimension, now the option is there.

What do you think ? Did you get the macro running ?

Greetings!