Handling Alignment of DBtext

stefanveurink68AXD
Advocate
Advocate

Handling Alignment of DBtext

stefanveurink68AXD
Advocate
Advocate

Don't know if this is a purely .NET-question, but i'm trying to find the sense in the alignmentproperty of a (db)text. 

 

What i'm trying to achieve is, when with a certain ucs/view a text is 'kind of upside-down', to rotate it a 180 degrees, with regard to its exact position.  

 

For Mtext this works fine by the following code: 

 

MText text = (MText)dbobj;
double hoekRadText = text.Rotation;

if (hoekRadText > hoekRad + Math.PI * 0.5 && hoekRadText < hoekRad + 1.5 * Math.PI)// dan zit die dus in vlak 90gr - 270gr 
                            {
                                hoekRadText = hoekRadText + Math.PI;
                                text.Rotation = hoekRadText;

                                if (text.Attachment == AttachmentPoint.BaseLeft || text.Attachment == AttachmentPoint.BottomLeft) { text.Attachment = AttachmentPoint.TopRight; }
                                else if (text.Attachment == AttachmentPoint.BaseRight || text.Attachment == AttachmentPoint.BottomRight) { text.Attachment = AttachmentPoint.TopLeft; }
                                else if (text.Attachment == AttachmentPoint.TopLeft) { text.Attachment = AttachmentPoint.BottomRight; }
                                else if (text.Attachment == AttachmentPoint.TopRight) { text.Attachment = AttachmentPoint.BottomLeft; }
                                else if (text.Attachment == AttachmentPoint.BaseCenter || text.Attachment == AttachmentPoint.BottomCenter || text.Attachment == AttachmentPoint.BaseMid || text.Attachment == AttachmentPoint.BottomMid) { text.Attachment = AttachmentPoint.TopCenter; }
                                else if (text.Attachment == AttachmentPoint.TopCenter || text.Attachment == AttachmentPoint.TopMid) { text.Attachment = AttachmentPoint.BottomCenter; }
                                else if (text.Attachment == AttachmentPoint.MiddleLeft) { text.Attachment = AttachmentPoint.MiddleRight; }
                                else if (text.Attachment == AttachmentPoint.MiddleRight) { text.Attachment = AttachmentPoint.MiddleLeft; }




                            }

 

trying to achieve the same for dbtext, but can't find the sense between the location-property en alignment-property. in some cases texts stay on the same position, in some not. Can anyone explain to me how to achieve this?

 

By the way the dbtext code also got those 2 lines: 

Point3d bp = new Point3d(text.Position.X, text.Position.Y, text.Position.Z);
text.AlignmentPoint = new Point3d(bp.X, bp.Y, bp.Z);

 

thanks!

0 Likes
Reply
213 Views
0 Replies
Replies (0)