To retrieve only a few of the dimensions, the “GeneralDimensions.Retrieve” method can be used with second parameter being a collection of dimensions to retrieve. In Inventor 2016, this also brings along other dimensions that were not in the collection. A request has been logged with our engineering team to address this.
As a workaround, all the dimensions can be retrieved in a drawing view and the ones that are not needed can be deleted. In the below code snippet, this workaround is demonstrated and it only retains the dimensions in the drawing view which were retrieved from dimensions which have parameter names matching a specific string.
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
oDrawDimsForView _
= ThisApplication.TransientObjects.CreateObjectCollection
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet
Dim oDims As GeneralDimensions
oDims = oSheet.DrawingDimensions.GeneralDimensions
Dim oView As DrawingView
oView = oSheet.DrawingViews(1)
Dim oRetrievableDims As ObjectCollection
oRetrievableDims _
= ThisApplication.TransientObjects.CreateObjectCollection
oRetrievableDims = oDims.GetRetrievableDimensions(oView)
If oRetrievableDims.Count > 0 Then
Dim dimsEnum As GeneralDimensionsEnumerator
dimsEnum = oDims.Retrieve(oView)
Dim paramName AsString
Dim oDim As GeneralDimension
ForEach oDim In dimsEnum
If oDim.Retrieved Then
paramName = oDim.retrievedFrom.Parameter.Name
If paramName <> "ShoeWidth"And _
paramName <> "ShoeHeight"Then
oDim.Delete()
EndIf
EndIf
Next
EndIf