problem to create align topmid in mtext-object

problem to create align topmid in mtext-object

jan_tappenbeck
Collaborator Collaborator
380 Views
0 Replies
Message 1 of 1

problem to create align topmid in mtext-object

jan_tappenbeck
Collaborator
Collaborator

hi!

 

long time ago i write a program to create a mtext object.

...
Using acMText As MText = New MText()
acMText.Location = InsertPoint
If TextStyleName.Length > 0 Then
acMText.TextStyleId = acTextStyleID
End If
acMText.Width = TextWindowWidth
acMText.TextHeight = TextHeight
acMText.Attachment = MTextAlign
acMText.BackgroundFill = UseFuellfarbeHintergrund 'Füllfarbe des Zeichnungshintergrundes verwenden
acMText.UseBackgroundColor = FreistellungAnwenden
acMText.BackgroundScaleFactor = FreistellungUmlaufenderAbstand
acMText.BackgroundFillColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex(Colors.ColorMethod.None, FreistellungFarbe) ' Farbe für den Hintergrund

acMText.ColorIndex = ColorIndex
acMText.Contents = Text2Write
acMText.Rotation = Orientation


acBlkTblRec.AppendEntity(acMText)
acTrans.AddNewlyCreatedDBObject(acMText, True)
End Using 'acMText
...

the call function will send a parameter for align by MTextAlign as AttachmentPoint.

i had a security if-statement again irregular values.

If CInt(MTextAlign) > 9 Then MTextAlign = AttachmentPoint.TopLeft

now i had the problem to use the align TopMid like the value 24.

i change the security if statement.

 

now i get following error-message

Autodesk.AutoCAD.Runtime.Exception: eInvalidInput
bei Autodesk.AutoCAD.DatabaseServices.MText.set_Attachment(AttachmentPoint value)
bei EBL.Service.Acad.CreateMText(Point3d InsertPoint, String Text2Write, Double Orientation, Double TextWindowWidth, Double TextHeight, String TextStyleName, Boolean FreistellungAnwenden, Boolean UseFuellfarbeHintergrund, Double FreistellungUmlaufenderAbstand, Int32 FreistellungFarbe, Int32 ColorIndex, AttachmentPoint MTextAlign, Int64 FID4ErrLog) in C:\VSProjects\2019\EBL.Service\EBL.Service\cls_Acad.vb:Zeile 2462.

 

the line 2462 will be

acMText.Attachment = MTextAlign

could someone help.

regards Jan

0 Likes
381 Views
0 Replies
Replies (0)