.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
69 Views, 5 Replies
09-14-2005 03:32 PM
Hello,
I've got a block reference called unitBREF. How do I determine its name? I've seen the other posts on names but for some reason I'm having trouble getting the BlockTableRecord:
BlockReference unitBREF = (BlockReference)ent;
BlockTableRecord blkBTR = ???
string name = blkBTR.name;
Thanks very much for any help!
-Carlos
I've got a block reference called unitBREF. How do I determine its name? I've seen the other posts on names but for some reason I'm having trouble getting the BlockTableRecord:
BlockReference unitBREF = (BlockReference)ent;
BlockTableRecord blkBTR = ???
string name = blkBTR.name;
Thanks very much for any help!
-Carlos
Re: Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-14-2005 03:33 PM in reply to:
Carlos Cabrera
BTW,
I'm using C# with AutoCAD 2006 and VS 2003.
-C
I'm using C# with AutoCAD 2006 and VS 2003.
-C
Re: Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-14-2005 03:42 PM in reply to:
Carlos Cabrera
Hey Carlos,
Try this (I'm assuming you've already got a transaction object in your routine):
BlockTableRecord blkBTR = (BlockTableRecord)trans.GetObject(unitBREF.BlockTa bleRecord, OpenMode.ForWrite);
Try this (I'm assuming you've already got a transaction object in your routine):
BlockTableRecord blkBTR = (BlockTableRecord)trans.GetObject(unitBREF.BlockTa
Re: Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-14-2005 03:44 PM in reply to:
Carlos Cabrera
Just realized I wrote OpenMode.ForWrite in my reply. That will work, but there's no reason why OpenMode.ForRead wouldn't also work.
Re: Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-14-2005 06:11 PM in reply to:
Carlos Cabrera
Hi,
For some reason, "BlockTableRecord" is not listed as a method or member variable of my block reference by Visual Studio. Is it possible that I don't have the correct namespace added? For this reason, I thought I must be doing something wrong.
In spite of this, I made it unitBREF.BlockTableRecord and it works great! Thanks very much for your help.
-Carlos
For some reason, "BlockTableRecord" is not listed as a method or member variable of my block reference by Visual Studio. Is it possible that I don't have the correct namespace added? For this reason, I thought I must be doing something wrong.
In spite of this, I made it unitBREF.BlockTableRecord and it works great! Thanks very much for your help.
-Carlos
*Albert Szilvasy
Re: Silly question
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
09-16-2005 03:38 PM in reply to:
Carlos Cabrera
Try this:
public string GetBlockName(ObjectId idRef)
{
using (Transaction t =
idRef.Database.TransactionManager.StartTransaction ())
{
BlockReference bref = (BlockReference)t.GetObject(idRef,
OpenMode.ForRead);
BlockTableRecord btr =
(BlockTableRecord)t.GetObject(bref.BlockId,OpenMod e.ForRead);
return btr.Name;
}
}
wrote in message news:4956854@discussion.autodesk.com...
Hi,
For some reason, "BlockTableRecord" is not listed as a method or member
variable of my block reference by Visual Studio. Is it possible that I
don't have the correct namespace added? For this reason, I thought I must
be doing something wrong.
In spite of this, I made it unitBREF.BlockTableRecord and it works great!
Thanks very much for your help.
-Carlos
public string GetBlockName(ObjectId idRef)
{
using (Transaction t =
idRef.Database.TransactionManager.StartTransaction
{
BlockReference bref = (BlockReference)t.GetObject(idRef,
OpenMode.ForRead);
BlockTableRecord btr =
(BlockTableRecord)t.GetObject(bref.BlockId,OpenMod
return btr.Name;
}
}
Hi,
For some reason, "BlockTableRecord" is not listed as a method or member
variable of my block reference by Visual Studio. Is it possible that I
don't have the correct namespace added? For this reason, I thought I must
be doing something wrong.
In spite of this, I made it unitBREF.BlockTableRecord and it works great!
Thanks very much for your help.
-Carlos
