DText and MText commands

DText and MText commands

Anonymous
Not applicable
1,846 Views
3 Replies
Message 1 of 4

DText and MText commands

Anonymous
Not applicable

Can some please help me, I'm trying to create MText & DText with a .net program in a drawing.  I have found plenty of examples which have fixed text strings or prompts the use to enter the text from the command line, but I'm trying replicate the DText and MText commands which allows the user to add the text in the text editor on the drawing.

 

Thanks in advance for your help

 

Regards

 

Steven Houghton

 

 

0 Likes
Accepted solutions (1)
1,847 Views
3 Replies
Replies (3)
Message 2 of 4

BKSpurgeon
Collaborator
Collaborator

Hi there Mr Steven 

 

Please see here for info on how to obtain input from the editor (if i'm understanding your question correctly):

 

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/AutoCAD-NET/files/GUI...

 

 

best regards

 

 

 

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

I have been using this code below, but the text string is "Hello, World".  All I want to do is launch the Text Editor and control the layer, font, height & position.

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry

<CommandMethod("CreateText")> _
Public Sub CreateText() '' Get the current document and database Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
    Dim acCurDb As Database = acDoc.Database

    '' Start a transaction
    Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

        '' Open the Block table for read
        Dim acBlkTbl As BlockTable
        acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, _
                                     OpenMode.ForRead)

        '' Open the Block table record Model space for write
        Dim acBlkTblRec As BlockTableRecord
        acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
                                        OpenMode.ForWrite)

        '' Create a single-line text object
        Using acText As DBText = New DBText() acText.Position = New Point3d(2, 2, 0) acText.Height = 0.5
            acText.TextString = "Hello, World."

            acBlkTblRec.AppendEntity(acText)
            acTrans.AddNewlyCreatedDBObject(acText, True)
        End Using

        '' Save the changes and dispose of the transaction
        acTrans.Commit()
    End Using
End Sub

0 Likes
Message 4 of 4

Alexander.Rivilis
Mentor
Mentor
Accepted solution

http://through-the-interface.typepad.com/through_the_interface/2010/06/invoking-autocads-mtext-edito...

Hope this link help you.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member