Haha i feel your pain with the intellisense, i've slowly been getting used to it but sometimes...just sometimes. I've updated the code but still no luck. When i run the command, it imports my blocks, but i still don't have the custom attributes that i would see when the block is exploded. I'm not sure what's going on here? Is is possible to just explode the block to owner space and then copy it to the appropriate layer?
something must be missing. i have similar code in one of my software working. are your blocks dynamic? and you know you must set the values of nonconstant attributereferences in order them to be shown. i advise you to double-click one of your blockreferences and see that your attributedefinitions are successfully transported to your blockreference. if so nothing bad just assign values to attributereferences.
What do you mean that i must set the values of nonconstant attributereferences? Right now they import just fine and on the correct layer but i can only view my custom attributes if i explode the blocks. If i use attedit, i'm told that the block has no editable attributes.
Thanks again for all your help, it really is much appreciated.
Have you come across "attsync"? I don't know if you can do it in .net. There is 1 post in this forum with no replies.
After you get the block inserted on the correct layer, try "attsync" manually (command line) to see if it fixes your attributes. It's worth a try IMHO.
Ok so i've figured out what's going on with the help of our design guys here. The original dwg already contains the block, with attributes and all. When i bring it into my new drawing with this code, it creates a block out of this block and loses all it's attributes until it's exploded. When it is exploded, it takes on the layer it was assigned in the original dwg. So what i need to do now is bring in the block from the original dwg as it is and re-assign it's layer. What is the easiest way to do this do you know?
Your block definition(BlocktableRecord) contain the AttributeDefinition. When you create a BlockReference you need to add a AttributeReference for each AttributeDefinition.
When you explode the reference you are getting all the entites in the BlockDefinition including the AttributeDefinition and it showing the default value. Notice when you explode the entity then double on the AttributeDefinition how the Edit Attribute Definition dialog shows instead of 'Edit Attributes' or 'Enhanced Att ed'
Here are some examples of inserting a Drawing into another drawing then adding the AttributeReferences in F#, C#, & VB
I've been going through the examples posted previously at the Swamp and have come to two problems. The first one is that in the sample code there are references to "CreateLayer", "InsertBlockReference" and "RadiansToDegrees" which don't exist. Are these placeholders for code or are these documented fuctions in the API i can't seem to find?
The other thing is that just by reading through the code, these examples don't seem to sync the attributes from the original blocks but rather provide the option to add new ones (multiple ones)...My existing blocks have attributes with values already and I have hundreds of them that i'd rather not have to redo manually. Hopefully i'm wrong or there's another way to accomplish what i'm trying to do.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register