Why my macro i call gettype for part it returen 0
I believe there are several objects that provide getType methods - which are you calling it from?
I''ll assume you are trying to get the type of model document.
2012 SOLIDWORKS API Help - GetType Method (IModelDoc2)
Notice the return value is a swDocumentTypes_e: 2012 SOLIDWORKS API Help - swDocumentTypes_e Enumeration
This is just an enumeration that the solidworks library defines; basically like assigning integers to variables but more memory efficient because it (should) be handled during compilation rather than run-time.
If you are troubleshooting something, it can be helpful to set up select case routines for printing the type to the immediate window.
select case swModel.getType
Retrieving data ...