i have a quick question regarding the best way to get The below exposed Properties by ISldworks. Since they are all exposed by the ISldworks object as properties can i use these properties to get the listed items below or is it best to use functions instead? Im a CAD Guy, not a programmer so i dont know best methods to do certain things. i am trying to make my code cleaner and faster.
Public ReadOnly Property ActiveDocType As swDocumentTypes_e
Get
If IsNothing(iSwApp) = False Then
Return iSwApp.IActiveDoc2.GetType
Else
Return swDocumentTypes_e.swDocNONE
End If
End Get
End Property
Public ReadOnly Property iModDoc As ModelDoc2
Get
If IsNothing(iSwApp) = False Then
Return iSwApp.IActiveDoc2
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property iPDoc As PartDoc
Get
If ActiveDocType = swDocumentTypes_e.swDocPART Then
Return iSwApp.IActiveDoc2
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property IAdoc As AssemblyDoc
Get
If ActiveDocType = swDocumentTypes_e.swDocASSEMBLY Then
Return iSwApp.IActiveDoc2
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property IDDoc As DrawingDoc
Get
If ActiveDocType = swDocumentTypes_e.swDocDRAWING Then
Return iSwApp.IActiveDoc2
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property ISelMgr As SelectionMgr
Get
If IsNothing(iSwApp) = False Then
If IsNothing(iSwApp.IActiveDoc2) = False Then
Return iSwApp.IActiveDoc2.SelectionManager
Else
Return Nothing
End If
Else
Return Nothing
End If
End Get
End Property
SolidworksApi macros