.NET

Reply
Valued Contributor
sivashanmugam
Posts: 58
Registered: ‎03-05-2006
Message 1 of 3 (496 Views)

TextStyleTable example

496 Views, 2 Replies
03-31-2006 11:16 PM
Hai all,

How to declare a TextStyleTable in C#.NET/VB.NET.

(or)
This is an example I saw VC++ object arx.

AcDbTextStyleTable *pTsTable;
> es = curDoc()->database()->getSymbolTable(pTsTable, AcDb::kForRead);

can you give equivalent C#.NET/VB.NET code

plz help,

Regards,
N. Siva shanmugam.
*Fred Chateau
Message 2 of 3 (496 Views)

Re: TextStyleTable example

04-01-2006 03:36 PM in reply to: sivashanmugam
wrote ...

> How to declare a TextStyleTable in C#.NET/VB.NET.

> AcDbTextStyleTable *pTsTable;
> es = curDoc()->database()->getSymbolTable(pTsTable, AcDb::kForRead);

> can you give equivalent C#.NET/VB.NET code

Attached is a C# example of adding a new TextStyle by appending an
additional TextStyleTableRecord to the drawing database. Although the Open
mode is kForWrite, it should help you get oriented to using TextStyleTables
and records.

I'm also working on adding some new TextStyles using the
GraphicsInterface.TextStyle Class. I'll post them when they're ready.

--
Regards,

Fred Chateau
*Fred Chateau
Message 3 of 3 (496 Views)

Re: TextStyleTable example

04-03-2006 09:52 AM in reply to: sivashanmugam
"Fred Chateau" wrote ...

> Attached is a C# example of adding a new TextStyle by appending an
> additional TextStyleTableRecord to the drawing database. Although the Open
> mode is kForWrite, it should help you get oriented to using
> TextStyleTables and records.

In the previous example, I seem to have omitted the transaction.Commit()
statement at the end of the transaction. Obviously the example will not work
without it.

Regarding the problem with AutoCAD recognizing the appended TextStyleTable
record, I noticed it would consistently recognize the new record after I
queried it one time using SnoopDB. As a guess, I tried adding the following
statement, which seems to have resolved the problem.

transaction.AddNewlyCreatedDBObject(textStyleTableRecord, true);

I also moved the textStyleTableRecordId field declaration outside the method
so I could encapsulate it with a GET accessory. I think I'm going to need
the TextStyleTableRecord ObjectID while constructing the DBText entities, so
I might as well make it available in the class now and avoid having to
retrieve it a second time.

I have no idea whether this is a proper way to append a TextStyleTable, but
it appears to work.

I would appreciate any comments from someone more knowledgeable in this
area.

--
Regards,

Fred Chateau
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!