BlockRecords["MyBlock"].Clone(); #453
Replies: 4 comments 4 replies
-
Hi @CCvallecano, I don't quite understand the question, but seeing at the exception I think that the issue is that the block with the name "MyBlock" doesn't exist in the file, can you confirm that? |
Beta Was this translation helpful? Give feedback.
-
BlockRecord record2 = new BlockRecord("100009x-2"); } block = (BlockRecord)docToRead.BlockRecords["100009x-2"].Clone(); I created the block but I have the same problem |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, I understand it now and it works. I thought we could insert a dwg into our new drawing. I will create the block inside another block. I love the library. Thank you very much. |
Beta Was this translation helpful? Give feedback.
-
One more question, the 3D solids in the cloned block are not cloned. Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
-
Good afternoon, I have inserted your library with a nuget package. I am trying to insert a block from an external file with this code:
const string _file = "../../../LibraryBlock/Block/133499.dwg";
CadDocument docToRead;
BlockRecord block;
CadDocument transfer = new CadDocument();
using (DwgReader reader = new DwgReader(_file))
{
docToRead = reader.Read();
}
block = (BlockRecord)docToRead.BlockRecords["MyBlock"].Clone();
transfer.BlockRecords.Add(block);
But it gives me this error
System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.'
I saw that there was a bug already fixed
th
Juan
Beta Was this translation helpful? Give feedback.
All reactions