oxyd85
Mechanical
- Jun 23, 2010
- 6
Hi,
I've been trying to create a leader for a point in drafting mode using NX Open VB.net . BTW I'm using NX6.
I tried to record a journal while creating a leader but some of the code generated does not really make any sense to me.
Here is a sample :
----------
Dim nullAnnotations_SimpleDraftingAid As Annotations.SimpleDraftingAid = Nothing
Dim draftingNoteBuilder1 As Annotations.DraftingNoteBuilder
draftingNoteBuilder1 = workPart.Annotations.CreateDraftingNoteBuilder(nullAnnotations_SimpleDraftingAid)
Dim text1(0) As String
text1(0) = "Ok"
draftingNoteBuilder1.Text.TextBlock.SetText(text1)
Dim leaderData1 As Annotations.LeaderData
leaderData1 = workPart.Annotations.CreateLeaderData()
leaderData1.StubSize = 5.0
leaderData1.Arrowhead = Annotations.LeaderData.ArrowheadType.FilledArrow
draftingNoteBuilder1.Leader.Leaders.Append(leaderData1)
Dim symbolscale1 As Double
symbolscale1 = draftingNoteBuilder1.Text.TextBlock.SymbolScale
Dim symbolaspectratio1 As Double
symbolaspectratio1 = draftingNoteBuilder1.Text.TextBlock.SymbolAspectRatio
Dim baseView1 As Drawings.BaseView = CType(workPart.DraftingViews.FindObject("TOP@1"), Drawings.BaseView)
draftingNoteBuilder1.Origin.AnnotationView.Value = baseView1
Dim wavePoint1 As Features.WavePoint = CType(workPart.Features.FindObject("LINKED_POINT(2)"), Features.WavePoint)
Dim point1 As Point = CType(wavePoint1.FindObject("HANDLE R-15337"), Point)
Dim point1_1 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
Dim nullView As View = Nothing
Dim point2_1 As Point3d = New Point3d(0.0, 0.0, 0.0)
leaderData1.Leader.SetValue(InferSnapType.SnapType.Exist, point1, baseView1, point1_1, Nothing, nullView, point2_1)
Dim point2 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
leaderData1.Leader.SetValue(point1, baseView1, point2)
Dim leaderData2 As Annotations.LeaderData
leaderData2 = workPart.Annotations.CreateLeaderData()
leaderData2.StubSize = 5.0
leaderData2.Arrowhead = Annotations.LeaderData.ArrowheadType.FilledArrow
draftingNoteBuilder1.Leader.Leaders.Append(leaderData2)
leaderData2.StubSide = Annotations.LeaderSide.Inferred
Dim point3 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
leaderData1.Leader.SetValue(point1, baseView1, point3)
Dim point5 As Point3d = New Point3d(-104.06544644193, 84.8464850635728, 0.0)
draftingNoteBuilder1.Origin.Origin.SetValue(Nothing, nullView, point5)
draftingNoteBuilder1.Commit()
draftingNoteBuilder1.Destroy()
-----------
What bugs me is the CType conversion between the wavePoint1.FindObject("HANDLE R-15337") and Point.
I can't figure out where that HANDLE R-15337 is coming from and I have no idea how I would retrieve this automatically for a set of point.
Anyone has some experience creating leaders in VB.NET?
Thanks in advance.
I've been trying to create a leader for a point in drafting mode using NX Open VB.net . BTW I'm using NX6.
I tried to record a journal while creating a leader but some of the code generated does not really make any sense to me.
Here is a sample :
----------
Dim nullAnnotations_SimpleDraftingAid As Annotations.SimpleDraftingAid = Nothing
Dim draftingNoteBuilder1 As Annotations.DraftingNoteBuilder
draftingNoteBuilder1 = workPart.Annotations.CreateDraftingNoteBuilder(nullAnnotations_SimpleDraftingAid)
Dim text1(0) As String
text1(0) = "Ok"
draftingNoteBuilder1.Text.TextBlock.SetText(text1)
Dim leaderData1 As Annotations.LeaderData
leaderData1 = workPart.Annotations.CreateLeaderData()
leaderData1.StubSize = 5.0
leaderData1.Arrowhead = Annotations.LeaderData.ArrowheadType.FilledArrow
draftingNoteBuilder1.Leader.Leaders.Append(leaderData1)
Dim symbolscale1 As Double
symbolscale1 = draftingNoteBuilder1.Text.TextBlock.SymbolScale
Dim symbolaspectratio1 As Double
symbolaspectratio1 = draftingNoteBuilder1.Text.TextBlock.SymbolAspectRatio
Dim baseView1 As Drawings.BaseView = CType(workPart.DraftingViews.FindObject("TOP@1"), Drawings.BaseView)
draftingNoteBuilder1.Origin.AnnotationView.Value = baseView1
Dim wavePoint1 As Features.WavePoint = CType(workPart.Features.FindObject("LINKED_POINT(2)"), Features.WavePoint)
Dim point1 As Point = CType(wavePoint1.FindObject("HANDLE R-15337"), Point)
Dim point1_1 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
Dim nullView As View = Nothing
Dim point2_1 As Point3d = New Point3d(0.0, 0.0, 0.0)
leaderData1.Leader.SetValue(InferSnapType.SnapType.Exist, point1, baseView1, point1_1, Nothing, nullView, point2_1)
Dim point2 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
leaderData1.Leader.SetValue(point1, baseView1, point2)
Dim leaderData2 As Annotations.LeaderData
leaderData2 = workPart.Annotations.CreateLeaderData()
leaderData2.StubSize = 5.0
leaderData2.Arrowhead = Annotations.LeaderData.ArrowheadType.FilledArrow
draftingNoteBuilder1.Leader.Leaders.Append(leaderData2)
leaderData2.StubSide = Annotations.LeaderSide.Inferred
Dim point3 As Point3d = New Point3d(-120.76826933111, 95.6540301194006, 0.0)
leaderData1.Leader.SetValue(point1, baseView1, point3)
Dim point5 As Point3d = New Point3d(-104.06544644193, 84.8464850635728, 0.0)
draftingNoteBuilder1.Origin.Origin.SetValue(Nothing, nullView, point5)
draftingNoteBuilder1.Commit()
draftingNoteBuilder1.Destroy()
-----------
What bugs me is the CType conversion between the wavePoint1.FindObject("HANDLE R-15337") and Point.
I can't figure out where that HANDLE R-15337 is coming from and I have no idea how I would retrieve this automatically for a set of point.
Anyone has some experience creating leaders in VB.NET?
Thanks in advance.