VectorDraw Developer Framework
问:如何获得外部参考文件的实体/span>
答:请参考获取外部参考文档实体的示例
var blk = vdcanvas.AddBlockFromFile("test.vds", "myblock", false, _loadedDelegate); function _loadedDelegate(xrefargs) { var xrefdoc = xrefargs.documentdata.vdDocument; var block = xrefargs.Block; var entities = xrefdoc.Model.Entities.Items; var fig; for (var i = 0; i < entities.length; i++) { fig = xrefdoc[entities[i]]; } vdcanvas.scriptCommand.blockref("myblock", null); }
问:如何在不从vdAttribute对象格式化的情况下获取字符串(值)/span>
答:可以借助vdMtext对象获取属性的纯文本(值),例如:
private void button1_Click(object sender, EventArgs e){ vdDocument doc = vdFramedControl.BaseControl.ActiveDocument; doc.Open(@"C:testtest.vdcl"); // the test drawing contains only an vdInsert with an attribute vdInsert ins = doc.Model.Entities[0] as vdInsert; // get the insert if (ins == null) return; vdAttrib atr = ins.Attributes[0] as vdAttrib; // get the attribute if (atr == null) return; vdMText mtxt = new vdMText(doc, atr.ValueString, new gPoint(), 1.0d); // define a new temporary vdMtext object with the attribute’s string VectorDraw.Generics.vdArray plaintext = mtxt.GetActualStringArray(); // get the PLAIN strings/value of the attribute mtxt = null; //vmMetxt is not needed any more! string messageboxstr = ""; foreach (string item in plaintext) { messageboxstr += item + "rn"; } MessageBox.Show(messageboxstr); // display the attribute’s value}
以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
-
如何排除GroundSurface对象的三角形区域/span>
-
复杂自定义对象的入门指南
=======================================================
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!