
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
With VB.Net I am developing an application to autoballoon big assemblies according to the items in the partslist. In order to create the balloons I have to make use of GeometryIntents. That geometryintent will be added to a objectcollection which will used as argument in the Balloons.Add method.
If I give a Curve as geometry in the GeometryIntent it creates the balloons just fine, but when giving a centermark as geometry, it kicks me out at the point where it uses the Balloons.Add method, even when centermarks are suppossed to be valid arguments.
I don't want to use curves because i'm working with very big assemblies, and it takes too much time to iterate through curves and their segments. So instead i want to use a workpoint which once included in the drawing is represented by a centermark.
The referenceddocument of my drawing view if an assemblie which contains subassemblies which also contain subassemblies. Somewhere down the tree is where the workpoint is created.
I think that my problem comes from the fact that the centermark is no "direct" geometry present in the view, but a representing centermark instead.
I am able to get the workpoint information in the sheet, so I know that i'm getting the point. but still I can't make it work.
Does anyone know if what i'm trying to do is possible and if not any suggestions?
Here's the code.
Dim oCurve As DrawingCurve = Nothing
For Each oCurve In oCurves
If oCurve.CurveType = CurveTypeEnum.kLineSegmentCurve Then
Dim oSegment As DrawingCurveSegment = Nothing
For i = 0 To oCurve.Segments.Count
Try
'Get the mid point of the selected curve, assuming that the selection curve is linear.
'Dim oMidPoint As Point2d = Nothing
'oMidPoint = oCurve.MidPoint
'Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry = Nothing
oTG = _InventorApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection = Nothing
oLeaderPoints = _InventorApplication.TransientObjects.CreateObjectCollection
'Create a leader point.
'oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 1, oMidPoint.Y + 1))
oLeaderPoints.Add(oTG.CreatePoint2d(oCenterMark1.Position,X, oCenterMark1.Position.Y))
'Add the GeometryIntent to the leader points collection.
Dim oGeometryIntent As GeometryIntent = Nothing
'oGeometryIntent = oSheet.CreateGeometryIntent(oCurve, oCurve.MidPoint)
oGeometryIntent = oSheet.CreateGeometryIntent(oCenterMark1)
oLeaderPoints.Add(oGeometryIntent)
'Set a reference to the parent drawing view of the selected curve
Dim oDrawingView As DrawingView = Nothing
oDrawingView = oCurve.Parent
Dim oBalloon As Balloon = Nothing
'Just create the balloon with the leader points
'oBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints) 'Here's where it kicks me out.
oBalloon = oSheet.Balloons.Add(oLeaderPoints)
oBalloon.SetBalloonType(BalloonTypeEnum.kHexagonBalloonType)
'bBalloonned = True
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
Next
Thanks in advance for the help.
Solved! Go to Solution.