.NET

Reply
Distinguished Contributor
vince1327
Posts: 117
Registered: ‎11-02-2011
Message 21 of 36 (276 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 (272 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 (268 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: 379
Registered: ‎03-31-2005
Message 24 of 36 (260 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 (255 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 (251 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 (243 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: 337
Registered: ‎05-12-2009
Message 28 of 36 (237 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 (209 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 (207 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!