VectorDraw에서 흔히 볼 수 있는 문제 정리: Xproperties를 사용하여 도면층과 Vdraw 실체 대상을 어떻게 연결합니까?

VectorDraw Developer Framework(VDF)는 응용 프로그램의 시각화를 위한 그래픽 엔진 라이브러리입니다.VDF 기능을 통해 2D 및 3D 그래픽 파일을 쉽게 작성, 편집, 관리, 출력, 가져오기 및 인쇄할 수 있습니다.   
질문:
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.ActiveLayer
Dim id As Integer
If (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 If
To get all the layers “referencing” a specific text object:Dim text As New VectorDraw.Professional.vdFigures.vdText
Dim pickedPoint As New VectorDraw.Geometry.gPoint
doc.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
    Next
Next
MessageBox.Show(layerArr.Count.ToString() + " layers linked to this text object.")
In the code XPropeties are assumed to be String values.
상기 문답에 대해 궁금한 점이 있으면 댓글로 남겨주시면 저희는 즉시 답장을 드리겠습니다.이 시리즈의 퀴즈 강좌는 저희가 지속적으로 업데이트할 것입니다. 관심이 있으면 본 강좌를 많이 주목해 주십시오.

좋은 웹페이지 즐겨찾기