How to iLogically create a bubble based on a Workpoint in a component?

How to iLogically create a bubble based on a Workpoint in a component?

W_Barnett
Enthusiast Enthusiast
186 Views
1 Reply
Message 1 of 2

How to iLogically create a bubble based on a Workpoint in a component?

W_Barnett
Enthusiast
Enthusiast

So, I've created a Function that takes a given component in an assembly generator, and categorically assigns a fixed balloon location in the drawing as trying to generate without target locations was making a massive mess.  Well, using a Named Face Entity, I could only get the balloons to generate about 80% of the time, they would just sometimes decide not to generate, so I figured I could create a Workpoint in the component, generate a proxy WP in the assembly, and then create the balloons based off of that...except the code isn't actually generating anything.  The Debug output states that two points are indeed being created, but I'm assuming that because there's no geometry intent, that it's failing.  Anyone have any ideas?  I've wasted hours trying to get this thing to work...

 

Function CreateBalloon(oActiveSheet As Sheet, DrawView As DrawingView, oOcc As ComponentOccurrence)
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oDrawDoc As DrawingDocument
	oDrawDoc = ThisApplication.ActiveDocument
	Dim oAssyDoc As AssemblyDocument = DrawView.ReferencedDocumentDescriptor.ReferencedDocument
	Dim WorkPoints = oAssyDoc.ComponentDefinition.WorkPoints
	Dim oWP As Inventor.WorkPoint
	Dim oWPProxy As Inventor.WorkPointProxy
	
	Dim oModelDoc As Document = oOcc.Definition.Document
	Dim oNamedEntities = iLogicVb.Automation.GetNamedEntities(oModelDoc)
	Dim iCata
	
'*** Gets iProperty "Catagory" in order to assign preset WP's in assembly. Dim iProps = oModelDoc.PropertySets("Inventor User Defined Properties") 'Removed .Item after Propsets (before parenthesis) For Each prop In iProps 'Logger.Debug("Property: " & prop.Name & " -> Value: " & prop.Value) If prop.Name = "Catagory" Then iCata = prop.Value End If Next
'*** Assigns a preset WP that dictates balloon location Dim balloon_loc As String Select Case iCata Case "A" balloon_loc = "Dim2" Case "B" balloon_loc = "Dim1" Case "C" balloon_loc = "Dim3" Case "D" balloon_loc = "Dim4" Case "E" balloon_loc = "Dim5" Case "F" balloon_loc = "Dim6" Case "G" balloon_loc = "Dim7" Case "H" balloon_loc = "Dim8" End Select Logger.Debug("Balloon_Loc: " & balloon_loc) '*** Because we're pulling a Workpoint from a component, we need to create a Proxy Point... For Each oWP In oOcc.Definition.WorkPoints If oWP.Name = "BALLOON2" Then oOcc.CreateGeometryProxy(oWP, oWPProxy) End If Next '*** Create Workpoint Objects based dimPt Strings fed to function. Dim oWP1 As WorkPoint oWP1 = WorkPoints.Item(balloon_loc) Logger.Debug("Created oWP1") '*** Create centermarks based on existing workpoints Dim marks(1) As Centermark marks(0) = sheet.Centermarks.AddByWorkFeature(oWP1, DrawView) marks(0).Visible = False Logger.Debug("Created mark1") marks(1) = sheet.Centermarks.AddByWorkFeature(oWPProxy, DrawView) marks(1).Visible = False Logger.Debug("Created mark2") '*** Create insertion point. Dim X1 = marks(0).Position.X Dim Y1 = marks(0).Position.Y Dim X2 = marks(1).Position.X Dim Y2 = marks(1).Position.Y Logger.Debug("Mark(0) Point locations: " & X1 & ", " & Y1) Logger.Debug("Mark(1) Point locations: " & X2 & ", " & Y2) Dim IP1 As Point2d = oTG.CreatePoint2d(X1, Y1) Dim IP2 As Point2d = oTG.CreatePoint2d(X2, Y2) Dim oBalloonPoints As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection '*** First point is the Balloon location oBalloonPoints.Add(IP1)
'*** Second Point is the Arrow pointing towards the item. oBalloonPoints.Add(IP2)
"***Balloon not generating. Add Balloon function requires Geometry Intent... Dim oGeometryIntent As GeometryIntent oGeometryIntent = oActiveSheet.CreateGeometryIntent(marks(1)) oBalloonPoints.Add(oGeometryIntent) '*** Create the balloon Dim oBalloon As Inventor.Balloon Try oBalloon = oActiveSheet.Balloons.Add(oBalloonPoints) Catch ex As Exception Logger.Debug("Balloon Failed to Generate for " & oOcc.Name) End Try End Function



 

0 Likes
187 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

Hi @W_Barnett 

Just to clarify are you attaching the leader to the drawing curve and trying to position the balloon center based of the wp location? Can you supply a quick image of the workflow your wanting highlight any model geometry in the model browser. 

Another way to position the balloon center from the model to the drawing without putting marks or included geometry is to use modeltosheetspace help page here

Syntax

DrawingView.ModelToSheetSpaceModelCoordinate As Point ) As Point2d

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes