cart: empty [ Login ]

Remove/ turn off cad layers

1 
Bronek
6/11/2008 1:39 PM
Hi I'm testing C# EditorDemo example and I can't find methods which are responsible for removing and turning off cad layers. Where can I find these methods? Is it possible to remove/turn off a cad layer and then save its state in DXF file? When will CadLib be able to import/export DWG format?
Wout
6/11/2008 2:22 PM
Hi, Set DxfLayer.Enabled property to turn a layer on or off. To remove a layer entirely, just remove the instance from DxfModel.Layers. Don't forget to also remove all entities on that layer from DxfModel.Entities. DWG will not be supported in the near future (perhaps in the far future though). Thanks! Wout
Roman_Romaniv
1/16/2019 1:32 PM
Hi Wout, In sample WpfViewApplicationCS I'm trying to set up to several entities separate layer. Then I set layer1.Enabled = false; and call UpdateRenderTransform() However all objects are visible. What I missed?
Wout
1/16/2019 3:04 PM
You will have to recreate the drawables like done in the Init method:
C# Code:
if (paperSpaceLayout != null) { wpfGraphics.CreateDrawables(model, paperSpaceLayout); } else { wpfGraphics.CreateDrawables(model, Matrix4D.Identity); } wpfGraphics.Draw(canvas.Children);
I general I recommend using the Windows Forms viewer though when editing is involved. The Windows Forms Viewer is considerably faster. - Wout
Roman_Romaniv
1/16/2019 3:31 PM
Thank you for provided code. It works more less. However I observe bug. I created layer and no one entity belongs to it. When I changed Enabled property to false, UI is duplicated till I move the surface. Please see in attachemnts - source code (my changes in method 'public void Init(string filename)') - dwg file - screenshot with effect Just select the dwg file and click button 'Layer' It is related somehow with usage of WPF insted of WinForms?
Wout
1/16/2019 3:37 PM
Try calling this first:
C# Code:
canvas.Children.Clear();
- Wout
Wout
1/16/2019 3:39 PM
Oh, in your attachment you're using the other WPF example, for this example it's entirely different and what I wrote above does not apply for this example. - Wout
Wout
1/16/2019 3:41 PM
Anyways, before I help you with this: you should probably move to Win Forms if you want to start moving entities around and such. - Wout
1