- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
good afternoon,
Trying to collect hole centers from 2 drawing views and add an ordinate set either up or down based on location of holes on view.
this causes the error:
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.OrdinateDimensionSets.Add(ObjectCollection GeometryIntents, Point2d PlacementPoint, DimensionTypeEnum DimensionType, Object DimensionStyle, Object Layer)
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
<code>
Dim inv = ThisApplication Dim oDoc = ThisDrawing.Document Dim cnt As Long Dim cursht As Inventor.Sheet Dim Jndx As Long Dim oVw As Inventor.DrawingView Dim oDcrv As Inventor.DrawingCurve 'On Error Resume Next Dim oTG As Inventor.TransientGeometry = inv.TransientGeometry 'On Error Resume Next Dim gIntent As Inventor.GeometryIntent For Jndx = 30 To 31 '87 Dim oUpr As Inventor.ObjectCollection = inv.TransientObjects.CreateObjectCollection Dim oLwr As Inventor.ObjectCollection = inv.TransientObjects.CreateObjectCollection cursht = oDoc.Sheets(Jndx) Dim oviews As Inventor.DrawingViews = cursht.DrawingViews oVw = oviews(2) For Each oDcrv In oVw.DrawingCurves If oDcrv.CurveType = CurveTypeEnum.kCircleCurve Then gIntent = cursht.CreateGeometryIntent(oDcrv.CenterPoint) If gIntent.Geometry.Y >= oVw.Position.Y Then oUpr.Add(gIntent) Else oLwr.Add (gIntent) End If End If 'MessageBox.Show(cnt,oVw.Name) Next ' 'oDcrv If oUpr.Count >1 Then ''MessageBox.Show(OUPR(1).GEOMETRY.X & ", " & oVw.Position.Y + oVw.Height + 3, " UPPER pOSITION") cursht.DrawingDimensions.OrdinateDimensionSets.Add(oUpr, _ oTG.CreatePoint2d(oUpr(1).GEOMETRY.X, oVw.Position.Y + oVw.Height ), _ DimensionTypeEnum.kVerticalDimensionType) End If If oLwr.Count >1 Then ''MessageBox.Show(OUPR(1).GEOMETRY.X & ", " & oVw.Position.Y - oVw.Height - 3, "LOWER pOSITION") cursht.DrawingDimensions.OrdinateDimensionSets.Add(oLwr, _ oTG.CreatePoint2d(oLwr(1).GEOMETRY.X, oVw.Position.Y - oVw.Height ), _ DimensionTypeEnum.kVerticalDimensionType) End If oVw = oviews(5) oLwr.Clear For Each oDcrv In oVw.DrawingCurves If oDcrv.CurveType = CurveTypeEnum.kCircleCurve Then oLwr.Add (gIntent) End If Next ' 'oDcrv Next 'Jndx
<\code>
Solved! Go to Solution.