versuche es mit:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Imports NXOpen.Annotations
Module report_all_start_and_end_points_of_dimension_or_drafting_entity_lines
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Dim displayPart As Part = theSession.Parts.Display()
Sub Main()
Dim myAnnotation As Annotation = Nothing
While select_a_dim_or_draft_entity("Dim or Drafting Aid:", myAnnotation) = _
Selection.Response.Ok
lw.WriteLine(" ")
lw.WriteLine("Picked: " & myAnnotation.ToString())
report_line_components(myAnnotation)
End While
End Sub
Public Sub report_line_components(ByRef localAnnotation)
Dim allAnns As AnnotationManager = displayPart.Annotations
Dim drfAid1 As Annotations.Annotation = localAnnotation
Dim cd1 As ComponentData = allAnns.CreateComponentData(drfAid1)
Dim lc1() As LineComponent = cd1.GetLineComponents()
lw.Open()
lw.WriteLine(" ")
lw.WriteLine("Line Components: ")
For Each thisLineComponent As LineComponent In lc1
Dim sp As Point3d = thisLineComponent.StartPoint()
Dim ep As Point3d = thisLineComponent.EndPoint()
lw.WriteLine(" ")
lw.WriteLine("Start: " & sp.X.ToString() & " " & _
sp.Y.ToString() & " " & sp.Z.ToString())
lw.WriteLine(" End: " & ep.X.ToString() & " " & _
ep.Y.ToString() & " " & ep.Z.ToString())
Next
End Sub
Function select_a_dim_or_draft_entity(ByVal prompt As String, _
ByRef obj As Annotation)
Dim ui As UI = GetUI()
Dim mask(1) As Selection.MaskTriple
With mask(0)
.Type = UFConstants.UF_drafting_entity_type
.Subtype = UFConstants.UF_all_subtype
.SolidBodySubtype = 0
End With
With mask(1)
.Type = UFConstants.UF_dimension_type
.Subtype = UFConstants.UF_all_subtype
.SolidBodySubtype = 0
End With
Dim cursor As Point3d = Nothing
Dim resp As Selection.Response = _
ui.SelectionManager.SelectObject(prompt, prompt, _
Selection.SelectionScope.AnyInAssembly, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, mask, obj, cursor)
If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
------------------
gruss urs
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP