Using TypeName to Distinguish between Objects



Your Ad Here

You can use the TypeName function to distinguish between different objects.  In the following example we use TypeName to determine if we can drill down from a general FMTool object to a more specific FMEndMill object.

Option Explicit
' to test this code, make a rectangular pocket with a bottom radius
Sub main
	Dim oper As FMOperation
	For Each oper In ActiveDocument.Operations
		Dim tool As FMTool

		Set tool = oper.Tool

		If TypeName( tool ) = "IFMEndMill" Then
			Dim em As FMEndMill

			Set em = tool
			MsgBox "End Radius is " & em.EndRadius
		End If
	Next oper
End Sub

Return to FeatureCAM Index


Your Ad Here