Please advise why the attached macro is not working anymore.I get an error message as below.I do have a part active while running the macro.
Thanks,
Feroz
Please advise why the attached macro is not working anymore.I get an error message as below.I do have a part active while running the macro.
Thanks,
Feroz
Check and fix the macro references to suit your installed version of SW.
Also make sure you've a solid feature in part or part in assembly to get the mass properties.
Rob Edwards wrote:
Hi Josh..
VBA didn't seem to like default, so I deliberately misspelled it
You can try with the corresponding digits, like 1 in this case
Deepak Gupta wrote:
Rob Edwards wrote:
Hi Josh..
VBA didn't seem to like default, so I deliberately misspelled it
You can try with the corresponding digits, like 1 in this case
My memory's that bad, I try and avoid numbers where I can ;p
I don't normally require using the COG but the way the world works I found myself using one today..
Just wondering what is the advantage of a sketch point (which doesn't update) over inserting a center of mass reference point?
Rob Edwards wrote:
I don't normally require using the COG but the way the world works I found myself using one today..
Just wondering what is the advantage of a sketch point (which doesn't update) over inserting a center of mass reference point?
I do no recall when COM was introduced in SW, so macro is useful for earlier versions where this option is not available.
Ah yes... Default is a reserved keyword.
As far as sketch point vs. center of mass reference point, I believe that macro was created before the COMRP was incorporated into the software.
I don't have to use it myself either, so I'm not sure if the sketch point version has any advantages or not. I suppose since it's a static, non-updating point, you could add multiple ones as your design progresses/changes or something?
Josh Brady wrote:
Ah yes... Default is a reserved keyword.
As far as sketch point vs. center of mass reference point, I believe that macro was created before the COMRP was incorporated into the software.
I don't have to use it myself either, so I'm not sure if the sketch point version has any advantages or not. I suppose since it's a static, non-updating point, you could add multiple ones as your design progresses/changes or something?
Looks like you can do that with the reference point.. and I presume it updates.. so I'm guessing the macro is itself kinda obsolete,, or could be dramatically improved by using the ref point capability (I've not checked the api)
My original macro and the one attached by Rob work if I run them in SolidWorks 2018.
My problem is that I am still using SolidWorks 2015. We shall only move over to SolidWorks 2018 once we migrate all our Pdm workgroup data to the new Pdm standard vault.
Hi Feroz
Maybe you could try copying the code to the clipboard.
Then making a new macro in 2015 and pasting the code . see if that works.
My macro knowledge is pretty shallow sorry
Note that GetMassProperties2 was introduced in SW2016 per the API help. It will be a while before it works in 2015...
Josh Brady wrote:
Note that GetMassProperties2 was introduced in SW2016 per the API help. It will be a while before it works in 2015...
OK
replace this line
vMassProperties = .Extension.GetMassProperties2(Accuracy:=accuracy_e.Defalt, status:=status, useselected:=False)
with
vMassProperties = .Extension.GetMassProperties(Accuracy:=accuracy_e.Defalt, status:=status)
OK
replace this line
vMassProperties = .Extension.GetMassProperties2(Accuracy:=accuracy_e.Defalt, status:=status, useselected:=False)
with
vMassProperties = .Extension.GetMassProperties(Accuracy:=accuracy_e.Defalt, status:=status)