Face's center point (coordinates)

Hi folks,

How can I get the center point (coordinates) of a previously selected face and then set the model orientation to Normal to?

Hi,

you can use GetSectionProperties2 to retrieve the center point of the face.
https://help.solidworks.com/2022/english/api/sldworksapi/SOLIDWORKS.Interop.sldworks~SOLIDWORKS.Interop.sldworks.IModelDocExtension~GetSectionProperties2.html

To set the model orientation you can use RunCommand with an argument of 169
https://help.solidworks.com/2022/English/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~RunCommand.html

https://help.solidworks.com/2022/English/api/swcommands/SolidWorks.Interop.swcommands~SolidWorks.Interop.swcommands.swCommands_e.html

1 Like