Auto Dimensions Using vba and ilogic works in one view and not the other???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have this code: SyntaxEditor Code Snippet
Dim oDrawDoc As DrawingDocument = ThisDoc.Document Dim oSheet As Sheet = oDrawDoc.ActiveSheet Dim oDrawView As DrawingView = oSheet.DrawingViews(1) Dim oGeneralDimensionsEnum As GeneralDimensionsEnumerator oGeneralDimensionsEnum = oSheet.DrawingDimensions.GeneralDimensions.Retrieve(oDrawView) Dim PrefixStr As String = "RDT_" Dim oGeneralDimension As GeneralDimension For Each oGeneralDimension In oGeneralDimensionsEnum Dim oParameter As Parameter oParameter = oGeneralDimension.RetrievedFrom.Parameter If oParameter.DrivenBy.count <> 0 Then Dim oDrivenByParameter As Parameter For Each oDrivenByParameter In oParameter.DrivenBy If InStr(oDrivenByParameter.Name, PrefixStr) = 0 Then oGeneralDimension.Delete End If Next Else If InStr(oParameter.Name, PrefixStr) = 0 Then oGeneralDimension.Delete End If End If Next
I found this online, I did not create this as I am a novice with vba. It works perfectly for a TopView.
However, when I apply the same code to a different view that is isometric, it gives me the normal general error that says, nope not going to work. Gives no guidance as to where the problem might be.
Any ideas would be greatly appreciated. I am wondering if it has anything to do with isometric view dimensions are no longer linear or horizontal. Maybe... might need a different type of dimension. But not sure what one to use.
I changed the drawing view number and the prefix slightly as I do not want the same dimensions again.
The following are the messages that are kicked out to me.
Error in rule: AutoDim2, in document: IRW Dev-1.dwg
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.GeneralDimension.Delete()
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)