VDF常见问题整理(二十五):如何隐藏自定义ACAD对象?

VectorDraw Developer Framework试用版下载


    点开本篇文章,是否对矢量图形工具感兴趣呢看看最新的矢量图形工具测评吧!点击此处>>即可直达哦!

问:

    随附的图形在VDraw和AutoCAD中看起来不同。有什么方法可以过滤VdfCAD / VDraw中不需要的AecDb…-vdInserts/p>

答:

    您可以尝试使用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;        }    }}

    对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。

相关资料推荐:

  • 如何排除GroundSurface对象的三角形区域/strong>

  • 复杂自定义对象的入门指南

  • 点击此处还有VectorDraw Developer Framework的demo示例等着你来体验哦!


    如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2019年9月12日
下一篇 2019年9月12日

相关推荐

发表回复

登录后才能评论