Option Explicit Sub TestSetAttr Dim doc As FMDocument Dim hole As FMHole Dim opers As FMOperations Dim oper As FMOperation Dim ftype As tagFMAttributeFeatureType, otype As tagFMAttributeOperationType Dim depth As Double Set doc = ActiveDocument Set hole = doc.Selected(1) If( hole Is Nothing) Then MsgBox "Select a hole" Exit Sub End If If( TypeName(hole) <> "IFMHole") Then MsgBox "Select a hole" Exit Sub End If hole.SetAttribute( eAID_DoReam, ,True) ' Boolean hole.SetUserAttribute( "myReam", True) ' user defined attribute ' find the ream oper Set opers = hole.Operations For Each oper In opers oper.GetOperationType( ftype, otype) otype = otype - eAT_AnyOper If( otype = eAT_Ream) Then depth = hole.Depth oper.SetAttribute( eAID_DrillDepth, 0, depth/2) ' Double oper.SetAttribute( eAID_HoleCycleType,,1) ' 1st radio button = spot face oper.SetAttribute( eAID_PostPword, 10, "ream P10") ' Post Pword oper.OverrideSpeed( 2000) ' Spindle speed oper.OverrideFeed( 20) ' Feed Rate oper.OverrideTool( "ream_05000") ' tool End If Next oper End Sub Sub TestGetAttr Dim doc As FMDocument Dim hole As FMHole Dim opers As FMOperations Dim oper As FMOperation Dim ftype As tagFMAttributeFeatureType, otype As tagFMAttributeOperationType Dim depth As Double Set doc = ActiveDocument Set hole = doc.Selected(1) If( hole Is Nothing) Then MsgBox "Select a hole" Exit Sub End If If( TypeName(hole) <> "IFMHole") Then MsgBox "Select a hole" Exit Sub End If If( hole.Attribute( eAID_DoReam) = 0) Then ' FC returns Boolean as 1 or 0 MsgBox "DoReam not set on this hole" Exit Sub End If If( hole.UserAttribute( "myReam") <> 1) Then MsgBox "myReam flag not set" Exit Sub End If ' find the ream oper Set opers = hole.Operations For Each oper In opers oper.GetOperationType( ftype, otype) otype = otype - eAT_AnyOper If( otype = eAT_Ream) Then If( oper.Attribute( eAID_DrillDepth ) <> hole.Depth / 2.0) Then MsgBox "Drill depth has been changed" Exit Sub End If If( oper.Attribute( eAID_HoleCycleType) <> 1) Then MsgBox "canned cycle type not set" Exit Sub End If If( oper.Attribute( eAID_PostPword, 10) <> "ream P10") Then MsgBox "Post Pword 10 not set" Exit Sub End If If( oper.Speed() <> 2000) Then MsgBox "Speed not set" Exit Sub End If If( oper.Feed() <> 20) Then MsgBox "Feed not set" Exit Sub End If If( oper.Tool.Name <> "ream_05000" ) Then MsgBox "Tool override not set" Exit Sub End If ' remove all ream overrides, but leave the ream operation oper.SetAttribute( eAID_DrillDepth,,, True ) oper.SetAttribute( eAID_PostPword, 10,, True ) oper.OverrideSpeed( 0) oper.OverrideFeed( 0) oper.OverrideTool( "") End If Next oper hole.SetUserAttribute( "myReam", 0, True ) End Sub