Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
catot
525 Views, 2 Replies

DrawingNote position (Point2d) behaviour.

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?

bshbsh
in reply to: catot


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

catot
in reply to: bshbsh

Yes, that seems to explain it, thanks.