Message 1 of 3
Select?

Not applicable
07-19-2006
01:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone.
I'm trying with the code below to show all feature dimensions, and then when i select one of them i want to display the parameter name of the dimension, but the following code only allows me to pick sketch diemsions and it´s not working for feature dimensions (ex: extrude distance), so what should i do?, Thanks.
Option Explicit
Private WithEvents oInteraction As InteractionEvents
Private WithEvents oSelect As SelectEvents
Private Sub UserForm_Initialize()
Dim i As Integer
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oSelectSet As SelectSet
Set oSelectSet = ThisApplication.ActiveDocument.SelectSet
oSelectSet.Clear
For i = 1 To oDoc.ComponentDefinition.Features.count
oSelectSet.Select oDoc.ComponentDefinition.Features(i)
Dim oControlDef As ControlDefinition
Set oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartShowDimensionsCtxCmd")
oControlDef.Execute
Next i
oSelectSet.Clear
' Create a new InteractionEvents object.
Set oInteraction = ThisApplication.CommandManager.CreateInteractionEvents
' Set the prompt.
oInteraction.StatusBarText = "Pick dimensions constraints from the model."
' Connect to the associated select events.
Set oSelect = oInteraction.SelectEvents
' Enable single selection.
oSelect.SingleSelectEnabled = True
' Start the selection process.
oInteraction.Start
End Sub
Private Sub oSelect_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, _
ByVal SelectionDevice As SelectionDeviceEnum, _
ByVal ModelPosition As Point, _
ByVal ViewPosition As Point2d, _
ByVal View As View)
Dim i As Long
Dim dLength As Double
Dim odim As DimensionConstraint
If JustSelectedEntities.Type = kDimensionConstraintsObject then
msgbox= odim.Parameter.Name
End If
End Sub
I'm trying with the code below to show all feature dimensions, and then when i select one of them i want to display the parameter name of the dimension, but the following code only allows me to pick sketch diemsions and it´s not working for feature dimensions (ex: extrude distance), so what should i do?, Thanks.
Option Explicit
Private WithEvents oInteraction As InteractionEvents
Private WithEvents oSelect As SelectEvents
Private Sub UserForm_Initialize()
Dim i As Integer
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oSelectSet As SelectSet
Set oSelectSet = ThisApplication.ActiveDocument.SelectSet
oSelectSet.Clear
For i = 1 To oDoc.ComponentDefinition.Features.count
oSelectSet.Select oDoc.ComponentDefinition.Features(i)
Dim oControlDef As ControlDefinition
Set oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartShowDimensionsCtxCmd")
oControlDef.Execute
Next i
oSelectSet.Clear
' Create a new InteractionEvents object.
Set oInteraction = ThisApplication.CommandManager.CreateInteractionEvents
' Set the prompt.
oInteraction.StatusBarText = "Pick dimensions constraints from the model."
' Connect to the associated select events.
Set oSelect = oInteraction.SelectEvents
' Enable single selection.
oSelect.SingleSelectEnabled = True
' Start the selection process.
oInteraction.Start
End Sub
Private Sub oSelect_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, _
ByVal SelectionDevice As SelectionDeviceEnum, _
ByVal ModelPosition As Point, _
ByVal ViewPosition As Point2d, _
ByVal View As View)
Dim i As Long
Dim dLength As Double
Dim odim As DimensionConstraint
If JustSelectedEntities.Type = kDimensionConstraintsObject then
msgbox= odim.Parameter.Name
End If
End Sub