Hi Macro Surlant
The code will not work in some partlicular condition, where the inside "For ...Loop execute for another time in a complex model.
But it will work for the simpler model. But due the necessity I tried my level best and found out the solution for that.
I hope this code would be generic but still I expect few of the our community member to give the assuarance on that.
Thank you. Following is the altered code. This code is written in VB.Net kindly modify based on your programming language
Regards
Prasad
' Set a reference to the active drawing document
Dim oDrawDoc As Inventor.DrawingDocument
Dim oSheet As Inventor.Sheet
Dim oDrawView As Inventor.DrawingView
Dim oGeneralDimensionsEnum As Inventor.GeneralDimensionsEnumerator
Dim oGeneralDimension As Inventor.GeneralDimension
oDrawDoc = inventorApp.ActiveDocument
oSheet = oDrawDoc.ActiveSheet
oDrawView = oSheet.DrawingViews(1)
oGeneralDimensionsEnum = oSheet.DrawingDimensions.GeneralDimensions.Retrieve(oDrawView)
Dim PrefixStr AsString = "RetD_"
ForEach oGeneralDimension InoGeneralDimensionsEnum
Dim oParameter As Inventor.Parameter
oParameter = oGeneralDimension.RetrievedFrom.Parameter
If oParameter.DrivenBy.Count <> 0 Then
Dim oDrivenByParameter As Inventor.Parameter
'''This Loop needed Special care - Prasad
ForEach oDrivenByParameter InoParameter.DrivenBy
If InStr(oDrivenByParameter.Name, PrefixStr) = 0 Then
oGeneralDimension.Delete()
EndIf
Exit For ''(This is the extra line needed)- Prasad
Next
Else
If InStr(oParameter.Name, PrefixStr) = 0 Then
oGeneralDimension.Delete()
EndIf
EndIf
Next