Inventor - Auto balloon picking at end/start point of member, Inst-ed of that need center

Inventor - Auto balloon picking at end/start point of member, Inst-ed of that need center

pl.sivakumar
Advocate Advocate
671 Views
7 Replies
Message 1 of 8

Inventor - Auto balloon picking at end/start point of member, Inst-ed of that need center

pl.sivakumar
Advocate
Advocate

Hi,

I am using Inventor 2021, While drawing preparation,

Auto balloon  picking at end/start point of the member, Inst-ed of that need centre

 

2.PNGCapture.PNG

0 Likes
672 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

I don’t think there is a setting to change the snap location when using the manually activated command auto balloon  but I could be wrong. Next step is to use ilogic. This may help. 

 

https://forums.autodesk.com/t5/inventor-customization/auto-balloon/td-p/3315209

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

pl.sivakumar
Advocate
Advocate

Thanks for your reply,

 

I found the following error while running this code into iLogic, I tried with macro also still some error on thate.PNG

0 Likes
Message 4 of 8

dutt.thakar
Collaborator
Collaborator

@pl.sivakumar 

 

To fix this error do the following you need to add a subroutine,

Sub Main

     ' Add your code here

End Sub

 

I would also prefer if you can post your code here, as I see some parts of the code need to be checked once, else you will face other errors.

 

Hope this will help you.

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes
Message 5 of 8

pl.sivakumar
Advocate
Advocate

Public Sub AutomaticBallooning(ByVal rstSTK As ADODB.Recordset)

Try

   Dim oDrawDoc As Inventor.DrawingDocument

   oDrawDoc = m_inventorApplication.ActiveDocument

           

   Dim oActiveSheet As Inventor.Sheet

   oActiveSheet = oDrawDoc.ActiveSheet

           

   Dim oPartslist As Inventor.PartsList

   oPartslist = oActiveSheet.PartsLists.Item(1)

           

   Dim oPartslistRow As Inventor.PartsListRow

           

   For Each oPartslistRow In oPartslist.PartsListRows

        oPartslistRow.Visible = False

   Next

           

    For Each oPartslistRow In oPartslist.PartsListRows

         If oPartslistRow.Ballooned = FalseThen

            'make row visible so user sees which row is going to ballooned

            oPartslistRow.Visible =True                   

            Dim strArtnr AsString

            strArtnr = oPartslistRow.Item(4).Value

            CreateBalloonPerOccurencesPerView(strArtnr)              

         End If

         oPartslistRow.Visible =False

   Next

           

   ForEach oPartslistRow In oPartslist.PartsListRows

        oPartslistRow.Visible =True

   Next

           

                    ''Method with Partlist from PDM

                    'Do While rstSTK.EOF = False

                    '    Dim strArtnr As String

                    '    strArtnr = rstSTK.Fields("ARTNR").Value

                    '    CreateBalloonPerOccurencesPerView(strArtnr)

                    '    rstSTK.MoveNext()

                    'Loop

       

   Catch ex As Exception

       MessageBox.Show(ex.ToString)

   End Try

EndSub


PrivateSub CreateBalloonPerOccurencesPerView(ByVal strArtnr AsString)

       Try           

            Dim oDrawDoc As Inventor.DrawingDocument

            oDrawDoc = m_inventorApplication.ActiveDocument

           Dim oActiveSheet As Inventor.Sheet

            oActiveSheet = oDrawDoc.ActiveSheet

           'loop door de views heen

           Dim oDrawingviews As Inventor.DrawingViews

            oDrawingviews = oActiveSheet.DrawingViews

           Dim oDrawingView As Inventor.DrawingView

           ForEach oDrawingView In oDrawingviews

               Dim oDocDesc As Inventor.DocumentDescriptor

                oDocDesc = oDrawingView.ReferencedDocumentDescriptor

               Dim oAsmDef As Inventor.AssemblyComponentDefinition

                oAsmDef = oDocDesc.ReferencedDocument.ComponentDefinition

               Dim oComponentOccurrence As Inventor.ComponentOccurrence

               ForEach oComponentOccurrence In oAsmDef.Occurrences

                   If oComponentOccurrence.Name.Contains(strArtnr) Then

                       Dim oDrawCurves As Inventor.DrawingCurvesEnumerator

                        oDrawCurves = oDrawingView.DrawingCurves(oComponentOccurrence)

                       Dim DrawCurve As Inventor.DrawingCurve

                       ForEach DrawCurve In oDrawCurves

                           Dim oColorRed As Inventor.Color

                            oColorRed = m_inventorApplication.TransientObjects.CreateColor(255, 0, 0)

                            DrawCurve.Color = oColorRed

                       Next

                       'Call create balloon command and wait till its finished

                       Dim oControlDef As Inventor.ControlDefinition

                        oControlDef = 

                                 m_inventorApplication.CommandManager.ControlDefinitions.Item  ("DrawingBalloonCmd")

                       Try

                            oControlDef.Execute()

                       Catch ex As Exception

                       EndTry

                       DoWhile m_inventorApplication.CommandManager.ActiveCommand = "DrawingBalloonCmd"

                            System.Windows.Forms.Application.DoEvents()

                       Loop

                       ForEach DrawCurve In oDrawCurves

                           Dim oColorBlack As Inventor.Color

                            oColorBlack = m_inventorApplication.TransientObjects.CreateColor(0, 0, 0)

                            DrawCurve.Color = oColorBlack

                       Next

                   End If

               Next

           Next

      Catch ex As Exception

            MessageBox.Show(ex.ToString)

       EndTry

End Sub

0 Likes
Message 6 of 8

pl.sivakumar
Advocate
Advocate

Waiting for feed back

0 Likes
Message 7 of 8

pl.sivakumar
Advocate
Advocate

Hi,

Good morning

Any update please

0 Likes
Message 8 of 8

dutt.thakar
Collaborator
Collaborator

@pl.sivakumar 

 

I have converted the code that will work in iLogic, but are you looking for a solution like this? I am not sure that this will be helpful for you or not.

 

This is actually running the ballon command and highlighting the components one by one according to their order in the parts list. Please have a look and reply with your thoughts.

 

Sub Main

Try

   Dim oDrawDoc As Inventor.DrawingDocument

   oDrawDoc = ThisApplication.ActiveDocument
  
   Dim oActiveSheet As Inventor.Sheet

   oActiveSheet = oDrawDoc.ActiveSheet       

   Dim oPartslist As Inventor.PartsList

   oPartslist = oActiveSheet.PartsLists.Item(1)

   Dim oPartslistRow As Inventor.PartsListRow

   For Each oPartslistRow In oPartslist.PartsListRows

        oPartslistRow.Visible = False

   Next

    For Each oPartslistRow In oPartslist.PartsListRows

         If oPartslistRow.Ballooned = FalseThen

            'make row visible so user sees which row is going to ballooned

            oPartslistRow.Visible =True                   

            Dim strArtnr As String

            strArtnr = oPartslistRow.Item(4).Value

            CreateBalloonPerOccurencesPerView(strArtnr)              

         End If

         oPartslistRow.Visible =False

   Next

           

   For Each oPartslistRow In oPartslist.PartsListRows

        oPartslistRow.Visible =True

   Next

           

                    ''Method with Partlist from PDM

                    'Do While rstSTK.EOF = False

                    '    Dim strArtnr As String

                    '    strArtnr = rstSTK.Fields("ARTNR").Value

                    '    CreateBalloonPerOccurencesPerView(strArtnr)

                    '    rstSTK.MoveNext()

                    'Loop

       

   Catch ex As Exception

       MessageBox.Show(ex.ToString)

   End Try

End Sub


Private Sub CreateBalloonPerOccurencesPerView(ByVal strArtnr As String)

       Try           

            Dim oDrawDoc As Inventor.DrawingDocument

            oDrawDoc = ThisApplication.ActiveDocument

           Dim oActiveSheet As Inventor.Sheet

            oActiveSheet = oDrawDoc.ActiveSheet

           'loop door de views heen

           Dim oDrawingviews As Inventor.DrawingViews

            oDrawingviews = oActiveSheet.DrawingViews

           Dim oDrawingView As Inventor.DrawingView

           For Each oDrawingView In oDrawingviews

               Dim oDocDesc As Inventor.DocumentDescriptor

                oDocDesc = oDrawingView.ReferencedDocumentDescriptor

               Dim oAsmDef As Inventor.AssemblyComponentDefinition

                oAsmDef = oDocDesc.ReferencedDocument.ComponentDefinition

               Dim oComponentOccurrence As Inventor.ComponentOccurrence

               For Each oComponentOccurrence In oAsmDef.Occurrences

                   If oComponentOccurrence.Name.Contains(strArtnr) Then

                       Dim oDrawCurves As Inventor.DrawingCurvesEnumerator

                        oDrawCurves = oDrawingView.DrawingCurves(oComponentOccurrence)

                       Dim DrawCurve As Inventor.DrawingCurve

                       For Each DrawCurve In oDrawCurves

                           Dim oColorRed As Inventor.Color

                            oColorRed = ThisApplication.TransientObjects.CreateColor(255, 0, 0)

                            DrawCurve.Color = oColorRed

                       Next

                       'Call create balloon command and wait till its finished

                       Dim oControlDef As Inventor.ControlDefinition

                        oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item  ("DrawingBalloonCmd")

                       Try

                            oControlDef.Execute()

                       Catch ex As Exception

                       End Try

                       Do While ThisApplication.CommandManager.ActiveCommand = "DrawingBalloonCmd"

                            System.Windows.Forms.Application.DoEvents()

                       Loop

                       For Each DrawCurve In oDrawCurves

                           Dim oColorBlack As Inventor.Color

                            oColorBlack = ThisApplication.TransientObjects.CreateColor(0, 0, 0)

                            DrawCurve.Color = oColorBlack

                       Next

                   End If

               Next

           Next

      Catch

            MessageBox.Show("Exception")

		End Try

End Sub

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
0 Likes