how to get the center point of a face

i want to get the center point of the face i have selected, i use the api"GetMassProperties", but it doesn't work and stop in this sentence,"Mass = myNote.GetMassProperties(1)", please help me, thank you!

the code:

Sub main()
Dim swApp As Object
Dim Part As Object

Dim myNote As
Dim Mass As Variant

Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set myNote = Part.SelectionManager.GetSelectedObject5(1)
Mass = myNote.GetMassProperties(1)          'it doesn't work when it runs"

End Sub

SolidworksApi macros
Answers 5
SF
SF 2010-11-04 Best Answer

Have you checked that the GetSelectedObject5 is actually getting a note. Check that myNote isn't equal to Nothing. If it is you have a problem with your selected object and what it is aquiring.

If the myNote is an object, then take a look how to use GetMassProperties from here http://www.angelsix.com/cms/features/solidworks-macros/42-area-solver

Luke Malpass

AngelSix (SolidWorks Tutorials and Books)

BatchProcess

SF
SF 2010-11-05

i went into the website,http://www.angelsix.com/cms/features/solidworks-macros/42-area-solver, you told me(i have a account of AngleSix). but i do not know how to download the macro, it seems that there is no link to downlad it, please tell me how to downlad it.

SF
SF 2010-11-05

I presume you are using IE6? You need IE7, Chrome, FF or Safari etc... to view the site correctly - the layout fails in IE6 as it is unsupported.

If you still have issues let me know and I will email you the file.

Luke Malpass

AngelSix (SolidWorks Tutorials and Books)

BatchProcess

SF
SF 2010-11-11

HI,i try my best to register a account in AngelSix, but it is not successful. so i can not download the macro in AngleSix. please give me a account and password in that website or send them to my E-MAIL,lamachampionship@163.com, your help will be appreciated, thank you!

                                                                                                                            wen

SF
SF 2010-11-13

Wen,

I have emailed you your account details.

Luke Malpass

AngelSix (SolidWorks Tutorials and Books)

BatchProcess