TheSwamp
Code Red => .NET => Topic started by: itcad 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?
-
public class Text : Entity
Name: Autodesk.AutoCAD.DatabaseServices.Text
Assembly: acdbmgd, Version=16.1.63.0
-
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?
-
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)
-
Perhaps you could try something like this ..
[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();
}
}
-
.... 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
-
.... 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.
-
Please post the code you have.
-
Sorry, I can't help you with AutoCAD2005 I'd be playing guessing games.