VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。
问:
随附的图形在VDraw和AutoCAD中看起来不同。有什么方法可以过滤VdfCAD / VDraw中不需要的AecDb…-vdInserts?
答:
您可以尝试使用AfterOpen事件来过滤此类块/实体,并将其隐藏在冻结层中。例如尝试代码:
private void button5_Click(object sender, EventArgs e) { doc = vdFramedControl1.BaseControl.ActiveDocument; doc.OnAfterOpenDocument += new vdDocument.AfterOpenDocument(doc_OnAfterOpenDocument); doc.Open(@"MyDrawing.dwg"); } void doc_OnAfterOpenDocument(object sender) { vdLayer aeclay = doc.Layers.FindName("AECLAYER"); // THE layer where these are going to be hidden if (aeclay == null) { aeclay = new vdLayer(doc, "AECLAYER"); doc.Layers.AddItem(aeclay); } aeclay.Frozen = true; // set to frozen foreach (vdBlock item in doc.Blocks) // check all blocks { bool is_aec = false; foreach (vdFigure fig in item.Entities) { vdText txt = fig as vdText; if (txt != null) {// Filter is to contain the text AecDb.. and has less than 3 items / // You can alter this filter as you like. if (txt.TextString.ToUpper().Contains("AECDB") && item.Entities.Count<3) {// that contain the string AecDB... is_aec = true; break; } } } if (is_aec) { foreach (vdFigure fig in item.Entities) { fig.Layer = aeclay; // hide the entities of this block } is_aec = false; } } }
对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。