I'm selecting a dim and I'm being told to select a dim. Did something change in 2009 with selecting a dim? I'm trying to update a macro written in 2004 and I might be missing something...but for something that used to work everytime I'm going nuts when I'm getting "Please Select a Dimension" popup every time.
This is usually used on a part. A user will select the body exposing the dims and then the user selects the dim and clicks in the cooresponding text field so that the dim name is entered. There is another field that evals the expression to get the actual value. Used to work like a charm...
Here's my code:
Dim swApp As SldWorks.SldWorks
Dim swDoc As ModelDoc2
Dim SelMgr As Object
Dim objSel As Object
Dim dispDim As DisplayDimension
Dim swDim As Dimension
Set swApp = CreateObject("SldWorks.Application")
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager
If SelMgr.GetSelectedObjectCount <> 0 Then
If SelMgr.GetSelectedObjectType3(1, -1) = swSelectType_e.swSelDIMENSIONS Then 'Type 2 is a dim
'Set objSel = SelMgr.GetSelectedObject6(1, -1)
Set dispDim = SelMgr.GetSelectedObject6(1, -1)
Set swDim = dispDim.GetDimension2(0)
swDoc.ClearSelection
txtMaterialSizeLink.Value = txtMaterialSizeLink.Value & """" & objSel.FullName & """"
Else
MsgBox "Please select a dimension"
End If
End If
swDoc.ClearSelection
Set SelMgr = Nothing
Set swDoc = Nothing
Set swApp = Nothing