Command Button function in Macro - not working

I got this macro from Luke Malpass and he did a good job in creating a "design library" like interface for this macro. Thanks to Luke.

When I run this macro in 2015, It works fine except it doesn't create the part with proper file name when "create channel" is clicked

Please see the screen shot and the attached files

Someone please help me to make this working.

Thanks,

JOHN

SolidworksApi macros
Answers 15
DG
DG 2015-01-25 Best Answer

How do you run this macro, when I use the run button to run this macro nothing happened.

Also did you made sure to change the path of master file in the macro in the class1 module?

JG
JG 2015-01-25

Deepak,

It's working till I enter all values (size and length)

I modified the file location in the class1 module to point to the .sldprt location

When I click the command button "create channel" it does nothing

See this screen shot with the part

comment imagecomment image
DG
DG 2015-01-25

John sorry if I was not clear but how to get the screen you've shown. When i run the macro nothing happens for me on SW2015. So how to get the macro property manager so that I can enter sizes and check?

JG
JG 2015-01-25

Deepak,

I have both these file files in a folder

Please open the class1 module and modify the line to point to the part location (this is my location)

<p>Const masterName As String = "I:\SOLIDWORKS Data (2015)\Design-Library\UAP.sldprt"</p>

You may have to modify the FileDialogs  module to add PtrSafe if you are running on 64bit machine

Hope it works now

Thanks

JOHN

DG
DG 2015-01-25

Both files are in the same folder. Added PtrSafe. Updated master file lcoation.

After this when I run the macro nothing happens but I get compile error on this line

Implements PropertyManagerPage2Handler5

Can you attach the updated macro you're able to run?

DG
DG 2015-01-25

Had to add in a library "SOLIDWORKS 2015 exposed type libraries for add-in use" and got the macro to run. Now investigating.

JG
JG 2015-01-25

Thanks,

Happy to see that you got it working.

I was almost there to post my updated files.

Hope to see a positive result from your investigation

DG
DG 2015-01-25

Could not find anything wrong yet. Were you able to run this macro in older versions of SW?

JG
JG 2015-01-25

I tried the macro in SW2014 and getting the same result

When I click the "create channel", nothing happens

I think it should allow the user to save the file with file name specified.

Are you able to save with the proper file name when the "button" clicked?

TS
TS 2015-01-26

A nice macro!

Got it working after by passing "GetSaveFile" -function and replacing "." (dots) with "," (comma) in the data fields. Added also:

Const saveFolder As String = "C:\Structural Members\"

JG
JG 2015-01-26

Tapani,

Thanks for fixing the "FileDialogs" module and making it working.

I just have a suggestion:

Is it possible to have an option to choose the save location (browse folder), instead of "C:\Structural Members\"?

DG
DG 2015-01-26

Thanks Tapani for fixing the macro.

John , here you go

DG
DG 2015-01-27

John, the correct answer should be Tapani's post since he resolved the major issue.

TS
TS 2015-01-27

Thank you Deepak!

Found a better solution from here:

32bit API Open/Save dialog function fail - Microsoft Community

Now it should work the same way as with 32 bit.

JG
JG 2015-01-27

Tapani,

You did a real good job and thanks a lot..!!

Deepak,

Thanks for your contribution to fix this problem as well.