DrawingNote position (Point2d) behaviour.

DrawingNote position (Point2d) behaviour.

catot
Advocate Advocate
560 Views
2 Replies
Message 1 of 3

DrawingNote position (Point2d) behaviour.

catot
Advocate
Advocate

Hi,

When trying to add a DrawingNote object, I've encountered some strange behaviour related to the positioning (Point2D) of it. At least that's what I think, but maybe there's some logic behind it? Does anyone have an explaination? Or is it a bug?

See code below, where the last line of code does position the text how I want it, but when commented out places it differently. I have not changed the Point2d as you can see, I've just set the GeneralNote position to the same Point2d as I did when initially placing it.

 

        private void insertSheetNote(Sheet sheet)
        {
            TransientGeometry transientGeometry = InventorApp.TransientGeometry;
            GeneralNotes generalNotes = sheet.DrawingNotes.GeneralNotes;

            string noteText = "NOTE: This is \n" +
                "my multiline \n" +
                "test text.";

            double textPositionY = sheet.Border.RangeBox.MaxPoint.Y - 0.35 - 1;
            double textPositionX = sheet.Border.RangeBox.MinPoint.X + 0.35 + 2;
            Point2d textPosition = transientGeometry.CreatePoint2d(textPositionX, textPositionY);

            GeneralNote generalNote = generalNotes.AddFitted(textPosition, noteText);
            generalNote.TextStyle.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft;
            
            //generalNote.Position = textPosition;
        }

 

This picture shows the note with the last line of code commented out:

TextPosBefore.PNG

 

This picture shows the note whit the last line of code active:

TextPosAfter.PNG

 

Anyone knows what's happening, or if it's a bug or something?

0 Likes
Accepted solutions (1)
561 Views
2 Replies
Replies (2)
Message 2 of 3

bshbsh
Collaborator
Collaborator
Accepted solution

I have not changed the Point2d as you can see, I've just set the GeneralNote position to the same Point2d as I did when initially placing it.

you have not, but the insertion point of the note have changed when you changed the horizontal justification. it was probably horizontally centered before.

 

generalnotes.addfitted

0 Likes
Message 3 of 3

catot
Advocate
Advocate

Yes, that seems to explain it, thanks.

0 Likes