VectorDraw Developer Framework试用版下载
点开本篇文章,是否对矢量图形工具感兴趣呢看看最新的矢量图形工具测评吧!点击此处>>即可直达哦!
问:
如何使用XProperty链接图层和Vdraw实体对象想在特定图层中引用多个vdraw实体,并在多个图层中引用特定vdraw实体。
答:
您是拥有一些图层和一些vdText对象的。在图层内,您可以设置XProperties文本的句柄ID。因此,您的图层具有一个或多个Text对象的handle ID。因此,您需要通过存储在图层中的handle ID值来获取这些文本,但是您还想获取包含特定图层的handle ID值的图层。
VB .net
要从图层的xproperties获取对象,请执行以下操作:
'In this example we are using the documen't active layer.Dim layer As VectorDraw.Professional.vdPrimaries.vdLayer = doc.ActiveLayerDim id As IntegerIf (layer.XProperties.Count > 0) Then Integer.TryParse(layer.XProperties(0).PropValue, id) Dim handle As VectorDraw.Professional.vdObjects.vdHandle = New VectorDraw.Professional.vdObjects.vdHandle(Convert.ToUInt64(id)) Dim text As VectorDraw.Professional.vdFigures.vdText = doc.FindFromHandle(handle, GetType(VectorDraw.Professional.vdFigures.vdText)) 'After this line, you may want to check if text is a valide object. MessageBox.Show("obtained text with the value: " + text.TextString)End IfTo get all the layers “referencing” a specific text object:Dim text As New VectorDraw.Professional.vdFigures.vdTextDim pickedPoint As New VectorDraw.Geometry.gPointdoc.ActionUtility.getUserEntity(text, pickedPoint, VectorDraw.Professional.vdObjects.vdDocument.LockLayerMethodEnum.Default)Dim layerArr As New VectorDraw.Generics.vdArray(Of VectorDraw.Professional.vdPrimaries.vdLayer)For Each layerObj In doc.Layers Dim layer As VectorDraw.Professional.vdPrimaries.vdLayer = layerObj For Each xpropObj In layer.XProperties Dim xproperty As VectorDraw.Professional.vdObjects.vdXProperty = xpropObj If (String.Compare(xproperty.PropValue, text.Handle.ToString()) = 0) Then layerArr.AddItem(layer) End If NextNextMessageBox.Show(layerArr.Count.ToString() + " layers linked to this text object.")In the code XPropeties are assumed to be String values.
对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
相关资料推荐:
-
如何排除GroundSurface对象的三角形区域/strong>
-
复杂自定义对象的入门指南
-
点击此处还有VectorDraw Developer Framework的demo示例等着你来体验哦!
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!