Author Topic: How to create Text in autocad2005?  (Read 3430 times)

0 Members and 1 Guest are viewing this topic.

itcad

  • Guest
How to create Text in autocad2005?
« on: December 09, 2008, 11:55:52 PM »
In autocad2005,it hasn't DBText,but it has Text.
I use the code:
Text tx = new Text();

but it's wrong.
Who can tell me how to create Text (not MText) in autocad2005?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #1 on: December 10, 2008, 03:34:18 AM »
public class Text : Entity
Name: Autodesk.AutoCAD.DatabaseServices.Text
Assembly: acdbmgd, Version=16.1.63.0

 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

itcad

  • Guest
Re: How to create Text in autocad2005?
« Reply #2 on: December 10, 2008, 07:56:06 PM »
public class Text : Entity
Name: Autodesk.AutoCAD.DatabaseServices.Text
Assembly: acdbmgd, Version=16.1.63.0

 


what you mean? cann't it create Text in autocad2005?

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2141
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #3 on: December 10, 2008, 09:37:44 PM »
public class Text : Entity
Name: Autodesk.AutoCAD.DatabaseServices.Text
Assembly: acdbmgd, Version=16.1.63.0

 


what you mean? cann't it create Text in autocad2005?

The reference posted is from the ACAD2005 acdbmgd.dll .. and has a reference to a Text Class in the Autodesk.AutoCAD.DatabaseServices namespace

I don't have AC2005 installed.
What code have you tried ?
Can you post the Method you are using ( or have tried)

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #4 on: December 12, 2008, 11:43:28 PM »
Perhaps you could try something like this ..
Code: [Select]
[CommandMethod("TestText")]
static public void TestDbText()
// CodeHimBelongaKbub@TheSwamp ©  Dec 2008
{
    Database db = HostApplicationServices.WorkingDatabase;
    string txtStr = "This is a DbText string.";
    string txtStyle = "kbubsComicTextStyle";

    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        BlockTableRecord CurrentSpaceBtr = tr.GetObject(db.CurrentSpaceId,
                                            OpenMode.ForWrite) as BlockTableRecord ;
        DBText textObj = new DBText();
        textObj.TextString = txtStr;
        textObj.Height = 500;
        textObj.Position = new Point3d(0,0,0) ;
       
        textObj.HorizontalMode = TextHorizontalMode.TextMid;
        textObj.AlignmentPoint = textObj.Position;

        TextStyleTable txtTbl = tr.GetObject(db.TextStyleTableId,
                            OpenMode.ForRead) as TextStyleTable ;
        if (txtTbl.Has(txtStyle))
        {
            TextStyleTableRecord txtTbr = tr.GetObject(txtTbl[txtStyle],
                                        OpenMode.ForRead) as TextStyleTableRecord;
            textObj.TextStyle = txtTbr.ObjectId;
        }

        CurrentSpaceBtr.AppendEntity(textObj);
        tr.AddNewlyCreatedDBObject(textObj, true);

        tr.Commit();
    }
}
« Last Edit: December 12, 2008, 11:47:48 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #5 on: December 12, 2008, 11:50:32 PM »
.... Though, this routine was built in VS2008 for AC2008 using DbText
so you may need to modify it for AC2005 using Text ..
ie
Text textObj = new Text();

I cant test in AC2005, sorry
« Last Edit: December 12, 2008, 11:58:27 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

itcad

  • Guest
Re: How to create Text in autocad2005?
« Reply #6 on: December 13, 2008, 04:53:52 AM »
.... Though, this routine was built in VS2008 for AC2008 using DbText
so you may need to modify it for AC2005 using Text ..
ie
Text textObj = new Text();

I cant test in AC2005, sorry


DBText textObj = new DBText();

I cant test in AC2005.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #7 on: December 13, 2008, 06:32:44 AM »
Please post the code you have.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: How to create Text in autocad2005?
« Reply #8 on: December 13, 2008, 09:02:58 AM »

Sorry, I can't help you with AutoCAD2005  I'd be playing guessing games.
« Last Edit: December 13, 2008, 09:11:29 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.