.NET

Reply
Mentor
santoshr0114
Posts: 188
Registered: ‎03-21-2012
Message 11 of 13 (111 Views)

Re: AutoCAD Library Or Block

07-03-2012 04:36 AM in reply to: Alfred.NESWADBA

Hi,

 

I can create and add the block reference programatically sucessfully.

 

Now i am not creating, but only adding a block reference with the existing block reference by refering it with its blockname. The problem is when i try to add an existing block reference to new locaiton to the same drawing file where the block is present.

 

Check the code, i am not not creating a block reference.

 

The Block Name created is "Dummy", I am trying to add the same block in different location.

 

I cannot stop the execution in between as i have added the output source to AutoCAD Application. If i stop then AutoCAD also closes.

 

Thank You

Regards
Santosh
*Expert Elite*
Alfred.NESWADBA
Posts: 9,417
Registered: ‎06-29-2007
Message 12 of 13 (106 Views)

Re: AutoCAD Library Or Block

07-03-2012 04:52 AM in reply to: santoshr0114

Hi,

 

>> I cannot stop the execution in between as i have added the output source to AutoCAD Application

Maybe I don't understand that, ... Just set a breakpoint at the first line within your command-code for "ADD_Block". It has to stop at the breakpoint. If VS does not you have any other problem (additionally to the block-insert).

 

And one sentence to this line:

bt[blockName]

By default it returns an ObjectID from the BlockTableRecord with the name <blockName>. But it's critical as it returns the FIRST occurence of a BlockTableRecord for this name. Imagine you have created a blockdefinition (so a BlockTableRecord is created) .... then you do a _PURGE ==> the BlockTableRecord is not removed from the database, it exists there as long as the drawing is not closed, the BlockTableRecord is just marked as deletet.

The result is: the next time you create a BlockTableRecord with the same name you got two BlockTableRecords each pointing to the same blockname, but the first one has the property .IsErased = TRUE and the new one has this set to FALSE.

With your code you just search for the first BlockTableRecord for name "blockName" and then you use it for insert ... EVEN IF IT's ERASED in the meantime ..... ever checked for the property .IsErased? If not ..,. do it :smileywink:

 

Hope that is clear to understand!

 

-. alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Mentor
santoshr0114
Posts: 188
Registered: ‎03-21-2012
Message 13 of 13 (105 Views)

Re: AutoCAD Library Or Block

07-03-2012 04:54 AM in reply to: Alfred.NESWADBA

Hi,

 

Ok WIll Try doing so..

 

Thank You for your time

 

Will let you know if there are more updates on this

Regards
Santosh
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!