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();
}
Solved! Go to Solution.
Solved by Alfred.NESWADBA. Go to Solution.
Hi,
for me it's not clear enough, first question is "how is your form loaded",
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 -
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.
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 -
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.
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 -
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen works.
It updates whole viewport.
Thank you very much alfred.
Zdenek