.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to force graphics update on a dimension?

6 REPLIES 6
Reply
Message 1 of 7
sylvesp
721 Views, 6 Replies

How to force graphics update on a dimension?

Could somebody please tell me how to force a graphics update, using the .net api, on a Dimension object after changing one of it's properties?
After I change the object the graphics on the screen does not update although the property palette shows for the "Dim line color" property the value I've just assigned "Red"
The dim line on the screen shows still as green though 😞
If I move the object using the Acad command line "move"command then he dimension will be updated properly.

using (Transaction trans = acadDoc.TransactionManager.StartTransaction())
{
Dimension dimObject = trans.GetObject(objId, OpenMode.ForWrite) as Dimension;
dimObject.Dimclrd = Color.FromColorIndex(ColorMethod.ByAci, 1);
dimObject.dimObject.RecordGraphicsModified(true);
trans.Commit();
}

Seemeingly none of the "vodoo" below will help 😞

dimObject.Draw()
acadDoc.TransactionManager.QueueForGraphicsFlush();
acadDoc.TransactionManager.FlushGraphics();
AcadApp.UpdateScreen();

Thanks
Peter
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: sylvesp

You didn't post the code showing how you used the 'voodoo' that doesn't
help.

Also, is your code running from a registered command method or from the
application context?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6269057@discussion.autodesk.com...
Could somebody please tell me how to force a graphics update, using the .net
api, on a Dimension object after changing one of it's properties?
After I change the object the graphics on the screen does not update
although the property palette shows for the "Dim line color" property the
value I've just assigned "Red"
The dim line on the screen shows still as green though 😞
If I move the object using the Acad command line "move"command then he
dimension will be updated properly.

using (Transaction trans = acadDoc.TransactionManager.StartTransaction())
{
Dimension dimObject = trans.GetObject(objId, OpenMode.ForWrite) as
Dimension;
dimObject.Dimclrd = Color.FromColorIndex(ColorMethod.ByAci, 1);
dimObject.dimObject.RecordGraphicsModified(true);
trans.Commit();
}

Seemeingly none of the "vodoo" below will help 😞

dimObject.Draw()
acadDoc.TransactionManager.QueueForGraphicsFlush();
acadDoc.TransactionManager.FlushGraphics();
AcadApp.UpdateScreen();

Thanks
Peter
Message 3 of 7
sylvesp
in reply to: sylvesp

Ah! That is a good point.
I did check it out and the dimension updates properly if I am running this code in a command context.

In my application though this code is located in a Standards Checker extension plugin, and it is invoked only when the user will start the manual standards checking and then he clicks the "FIX" button.

So... the context is:
- There is a command started: CheckStandards
- That commond will invoke my standards checker plugin through COM
- In this this module I get the .Net wrappers of the document and the Dimension I have to change and then modify the object using the .Net wrapper.

As a result it seems that the object properties do change but no matter how hard I try I cannot get the object graphics updated

It would be nice to have some way to force the graphics update in this case.
Message 4 of 7
Anonymous
in reply to: sylvesp

Based on what you say below, your COM component is
using the .NET api, which means that it is getting loaded
into AutoCAD's process.

If that's the case, then derive your standards checker plugin
class from System.EnterpriseServices.ServicedComponent,
and see if that changes anything.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6269305@discussion.autodesk.com...
Ah! That is a good point.
I did check it out and the dimension updates properly if I am running this
code in a command context.

In my application though this code is located in a Standards Checker
extension plugin, and it is invoked only when the user will start the manual
standards checking and then he clicks the "FIX" button.

So... the context is:
- There is a command started: CheckStandards
- That commond will invoke my standards checker plugin through COM
- In this this module I get the .Net wrappers of the document and the
Dimension I have to change and then modify the object using the .Net
wrapper.

As a result it seems that the object properties do change but no matter how
hard I try I cannot get the object graphics updated

It would be nice to have some way to force the graphics update in this case.
Message 5 of 7
sylvesp
in reply to: sylvesp

Unfortunately that did not help (System.EnterpriseServices.ServicedComponent).

Seems though that I've found a workaround.
After updating some properties (which not available through the com api) using the .NET api I did return to the COM API of the object and
"re-assigned" the same style name as the one the object already had. (we are talking about a dimension object)
This did force a graphic update.

It would be nice though if I could do this without having to "return" to the COM api.
Message 6 of 7
Anonymous
in reply to: sylvesp

Did you try calling RecomputeDimensionBlock() ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6269314@discussion.autodesk.com...
Unfortunately that did not help
(System.EnterpriseServices.ServicedComponent).

Seems though that I've found a workaround.
After updating some properties (which not available through the com api)
using the .NET api I did return to the COM API of the object and
"re-assigned" the same style name as the one the object already had. (we
are talking about a dimension object)
This did force a graphic update.

It would be nice though if I could do this without having to "return" to the
COM api.
Message 7 of 7
iwx007
in reply to: sylvesp

RecomputeDimensionBlock works!Solved years of trouble

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost