.NET

Reply
Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 21 of 36 (259 Views)

Re: Repeatedly Insert Block

01-25-2012 08:35 AM in reply to: cincir

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?

 

Thanks again!

Active Contributor
cincir
Posts: 32
Registered: ‎08-12-2011
Message 22 of 36 (255 Views)

Re: Repeatedly Insert Block

01-25-2012 09:12 AM in reply to: vince1327

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.

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 23 of 36 (251 Views)

Re: Repeatedly Insert Block

01-25-2012 10:19 AM in reply to: cincir

Hey Cincir,

 

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.

Valued Mentor
fieldguy
Posts: 368
Registered: ‎03-31-2005
Message 24 of 36 (243 Views)

Re: Repeatedly Insert Block

01-25-2012 10:33 AM in reply to: vince1327

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.

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 25 of 36 (238 Views)

Re: Repeatedly Insert Block

01-25-2012 11:04 AM in reply to: fieldguy

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?

 

thanks again!

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 26 of 36 (234 Views)

Re: Repeatedly Insert Block

01-25-2012 11:41 AM in reply to: vince1327

Also, if i explode the original dwg previous to running my import command, it still loses all it's attributes. I'm not sure why?

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 27 of 36 (226 Views)

Re: Repeatedly Insert Block

01-25-2012 01:59 PM in reply to: fieldguy

Hey fieldguy,

 

No luck with attsync, i'm still experimenting though, i will prevail!

Valued Mentor
jeff
Posts: 328
Registered: ‎05-12-2009
Message 28 of 36 (220 Views)

Re: Repeatedly Insert Block

01-25-2012 02:39 PM in reply to: vince1327

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

 

http://www.theswamp.org/index.php?topic=37686.msg427843#msg427843

You can also find your answers @ TheSwamp
Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 29 of 36 (192 Views)

Re: Repeatedly Insert Block

01-30-2012 10:43 AM in reply to: vince1327

Hey Jeff,

 

Thanks a million, i'm going through some now and i'll see if i can make this work.

 

Cheers

Vince

Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 30 of 36 (190 Views)

Re: Repeatedly Insert Block

01-30-2012 11:00 AM in reply to: jeff

Hey Guys,

 

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.

 

Thanks again

Vince

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.