Dimensions use one or more input features in their calculations. This method returns the Command object for the referenced input feature.
- Num
- This integer value is the index that points to the referenced feature you want to return. It can be 1, 2, or 3.
This example finds dimension commands and then displays an input box for you to type the reference feature index to return.
Example (Visual Basic) | Copy Code |
---|---|
Sub Main Dim App As Object Set App = CreateObject ("PCDLRN.Application") Dim Part As Object Set Part = App.ActivePartProgram Dim Ew As Object Set Ew = Part.EditWindow Dim Cmds As Object Set Cmds = Part.Commands Dim Cmd As Object Dim i As Integer Dim j As Integer Dim IsSet As Boolean Dim FoundDimension As Boolean i = Cmds.Count MsgBox "This example cycles through the " & i & " commands in the Edit window. On dimension commands, it locates a reference feature based on a specified index value." FoundDimension = "False" i = 0 For Each Cmd In Cmds i = i + 1 App.StatusBar = "Cycling through commands. Current command: " & i If Not Cmd.DimensionCommand Is Nothing Then FoundDimension = "True" If Len (Cmd.GetText(DISPLAY_ID,1)) > 0 Then MsgBox "Found a dimension at command " & i & " of " & Cmds(i).ID & ". It is: " & Cmds(i).GetText(DISPLAY_ID,1) IsSet = Cmds.InsertionPointAfter(Cmds(i)) If IsSet = "False" Then MsgBox "The insertion point wasn't set." End If IsSet = Cmds.SetCurrentCommand(Cmds(i)) j = InputBox ("Type 1, 2, or 3 to return a referenced feature: ","Type an Index Value",1) MsgBox "The referenced feature is: " & Cmds(i).DimensionCommand.GetReferencedFeature(j).DisplayID End If End If Next Cmd If FoundDimension = "False" Then MsgBox "The Edit window doesn't have any dimension commands." End If End Sub |