Oops. Sorry, The AssertWriteEanbled() trick doesn't work in
managed code (but does in native ObjectARX).
First, RecordGraphicsModified is not doing anything, if you
are doing a regen anyways. A regen alone will do it, but the
whole point (or so I thought) was to do it without requiring
a complete regen of the drawing.
You should not have to regen the entire drawing to update
block references. And, if you have a large drawing, doing
that is highly undesireable.
The easiest way to do it, is to open each block reference for
write in the same transaction where you update the block
definition, and set the BlockTableRecord property to the same
value it currently has:
BlockRefererence blkref = trans.GetObject(id, OpenMode.ForWrite);
blkref.BlockTableRecord = blkref.BlockTableRecord;
trans.Commit();
In fact, you may not even need to set the BlockTableRecord
property at all, just open the blockreference for write may be
all you need to do.
This works when your code is running in a registered command
handler registere to run in the document context. In the case
your code is running modelessly (application context), things
are a bit different.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
"perry"
wrote in message news:5161557@discussion.autodesk.com...
Thanks guys.
At first, I thought that .RecordGraphicsModified was'nt doing the trick either as I did not see a change
on screen. I then stumbled into the fact that a "Regen" must be issued as well. I couldnt find how to do that
in .Net! Found out here that regen is not exposed in .Net so had to use "SendStringToExecute". blah.
Well, at least now my function appears to work as intended, finally !
As for AssertWriteEnabled(), couldnt use that at all! According to Visual Studio it is not a member of
BlockReferences or BlockDefinitions ?
Perry