Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Force Refresh is not working

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
zdenek.neustupa.st1
1129 Views, 6 Replies

Force Refresh is not working

Hello,

 

I am trying  to make a simple app using .NET classes.

I made a simple Windows.Form in which are check boxes (on for each layer of the CAD drawing).

Just to set the visibility of each layer. Everything is working fine, but I have a little problem with refreshing a drawing.

Changes of visibility settings are applied  after a form is closed.

 

Could someone help me please to solve this problem?

I need the drawing to be refreshed after every check box check change.

 

 I enclose a method with handles check boxes changes. 

 

private void LayerCheckedChanged(object sender, EventArgs e)

{

   CheckBox s = sender as CheckBox;

 

   // layers is AcMapMap.GetCurrentMap().GetLayers(); 

   layers.GetItem(s.Name).SetVisible(s.Checked); 

   

   // THIS IS NOT WORKING

   AcMapMap.ForceScreenRefresh();

 

Tags (3)
6 REPLIES 6
Message 2 of 7

Hi,

 

for me it's not clear enough, first question is "how is your form loaded",

  • Is it opened modal or not?
  • Is it opened by a self-defined command? If by command, is CommandFlag "Session" defined or not?
  • Or are the checkboxes placed within a UserControl you have loaded in a palette?

And just to make sure: you are not speaking about CAD-Layers, you mean GIS/FDO-layers?

Plus your wish is it should be regenerated without closing the Form? Then we need the answers to the above question or you check yourself what and how "modal" or "not modal" affect this aspect.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 7

Compiled DLL which is loaded by NETLOAD command from AutoCAD contains a method which opens new Form.

 

[CommandMethod("LayerFilter")]
public static void LayerFilter()
{
Application.Run(new LayerForm());
}

 

This form's constructor access map layers using AcMapMap.GetCurrentMap().GetLayers() and then creates check boxes to set visibility of each layer.

 

Geometric properties and layers are loaded from SHP file which is connected to current dwg.

 

I am not sure what you mean by modal / not modal.

 

Thank you for help. 

 

Message 4 of 7

Hi,

 

>> I am not sure what you mean by modal / not modal.

IF you open a form with .ShowDialog (or any other way to get it opened modally) the form has the focus until you close the form and (without tricks) the AutoCAD-screen can't be updated at this time (as it has no ... and get's no focus). Look also >>>here<<< for "modal".

And as you wrote "Changes of visibility settings are applied  after a form is closed." I think that this is the reason why AutoCAD does not update it's graphical content.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 7

OK my form is not modal. I checked using the Form. Modal property, it is FALSE.

 

I can work with AutoCAD and with my Form simultaneously. Only thing that doesn't work is the refresh, update, regen or whatever.

 

There is no other command to force the refresh of dwg drawing or whole AutoCAD?

 

Thank you so much. 

Message 6 of 7

Hi,

 

>> There is no other command to force the refresh of dwg drawing or whole AutoCAD?

Of course, there are many commands, however I'm not sure about your vocablary you use. Are you working now with FDO or do you speak about AutoCAD Geometry?

What happens e.g. when you do that:

Call Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 7

Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen works.

 

It updates whole viewport.

 

Thank you very much alfred.

 

Zdenek 

 

 

 

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

Post to forums  

Rail Community


Autodesk Design & Make Report