AnsweredAssumed Answered

API, attach a note to a drawing view

Question asked by Denis Messager on Apr 2, 2017
Latest reply on Apr 4, 2017 by Denis Messager

Hi guys,

I'm currently making a macro to allow users to make dimenions ballooning on drawings. I mean, the user is able to select a dimension on a drawing and the macro create a note with a balloon format and a specif number. Next, I would like to group the note made with the dimension selected, but it seems I need to attach the note to the view of the dimension before.

I'm moving forward with my code, but I'm stopped because I can't find a way to get the drawing view of the selected dimension...
Also, I don't understand the difference between the entities "dimension" and "displaydimension"  available in API.

 

Please help me :-)

Below the function where I'm stopped (I'm french, so excuse me for the comments and the variable names in french) :

 

    Private Function ms_MouseLBtnDownNotify(ByVal X As Long, ByVal Y As Long, ByVal WParam As Long) As Long

   

        'si pas création de balloon en cours

            If PositionnementBalloonEnCours = False And ObjectEstPreSelectionné = True Then

               

                Set myNote = swModel.InsertNote(UserForm1.TextBoxNumero.value)

                Set MyDimension = MonObjectPreSelectionné

 

                If Not myNote Is Nothing Then

                   myNote.Angle = 0

                   boolstatus = myNote.SetBalloon(12, 0)

                   Set myAnnotation = myNote.GetAnnotation()

                   If Not myAnnotation Is Nothing Then

                    longstatus = myAnnotation.SetLeader3(swLeaderStyle_e.swNO_LEADER, 0, True, False, False, False)

                    boolstatus = myAnnotation.SetPosition(X, Y, Z)

                   End If

                End If

           

                UserForm1.TextBoxNumero.value = UserForm1.TextBoxNumero.value + 1

           

                PositionnementBalloonEnCours = True

               

          'si création de balloon en cours

            ElseIf PositionnementBalloonEnCours = True Then

               

                swModel.ClearSelection2 True

               

                'on attache le balloon à la vue (fonction attach to view)

                bool = myAnnotation.Select3(True, swSelData)

                bool = MyDimension.       'How to be able to select the dimension's drawing view before to attach the annotion to it ?

               

                bool = swModel.AttachAnnotation(swAttachAnnotationOption_View)

               

                'on attache le balloon à la dimension (fonction group)

               

               

                PositionnementBalloonEnCours = False

                Set myAnnotation = Nothing

               

            End If

           

    End Function

Outcomes