文档半岛外围网上直营>>VectorDraw Developer Framework使用教程>>VectorDraw Developer Framework常见问题整理(五十三):如何获取外部参考文档的实体
VectorDraw Developer Framework常见问题整理(五十三):如何获取外部参考文档的实体
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。
点击下载VectorDraw Developer Framework
问:如何获得外部参考文件的实体?
答:请参考获取外部参考文档实体的示例
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对象格式化的情况下获取字符串(值)?
答:可以借助vdMtext对象获取属性的纯文本(值),例如:
private void button1_Click(object sender, EventArgs e)
{
vdDocument doc = vdFramedControl.BaseControl.ActiveDocument;
doc.Open(@"C:\test\test.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 + "\r\n";
}
MessageBox.Show(messageboxstr); // display the attribute’s value
}
以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
=======================================================
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系咨询相关问题。

QQ交谈
在线咨询

渝公网安备
50010702500608号

客服热线