Return transaction.GetObject(id, OpenMode. Using (Transaction transaction = ())īlockTable blockTable = transaction.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable īlockTableRecord acBlkTblRecNewDoc = (BlockTableRecord)transaction.GetObject(blockTable, OpenMode.ForWrite) īlockReference newBlockReference = new BlockReference(location, blockTable) ĭo you have the object id for these items? If so, you could do something like this: public DBObject GetBlockReferenceFromCOM(ObjectId id) ![]() public BlockReference GetBlockReferenceFromCOM(AcadBlockReference comReference, Point3d location) Sorry that my example is in C#, but it should be easy enough to re-write in VB.NET. ![]() I know, for a fact, there are code examples out there if you search AutoDesk's web site and Google. I didn't test this as I don't have the time to, but just thought I'd throw it out here and hope that it helps you move forward. To get a reference to a block you have to know the name of the block to access it directly through the block collection or iterate through it until you find the one you want. I've modified it here to take in a AcadBlockReference and I use it's Name property to find it in the BlockTable. ![]() The following method is one that I've had that would take in a block name and location, and return the block reference. NET library quite often to grab block references, however, I've never grabbed one by using a COM object.
0 Comments
Leave a Reply. |