Pitar1
Mechanical
- May 14, 2021
- 4
Hello,
I am currently working on a piece of code in which I use the BlockUI Styler in assembly.
I select two faces from two different parts to get and save the distance between the two faces.
I would now like to receive the names of the parts which belong to the selected faces.
Does anyone here have an idea.
Thanks for your help
Public Function apply_cb() As Integer
Dim errorCode As Integer = 0
Try
'---- Enter your callback code here -----
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim workpart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim Select0Props As PropertyList = face_select0.GetProperties()
Dim faces0() As TaggedObject = Select0Props.GetTaggedObjectVector("SelectedObjects")
Select0Props.Dispose()
Select0Props = Nothing
Dim Select01Props As PropertyList = face_select01.GetProperties()
Dim faces01() As TaggedObject = Select01Props.GetTaggedObjectVector("SelectedObjects")
Select01Props.Dispose()
Select01Props = Nothing
For Each face0 As Face In faces0
For Each face01 As Face In faces01
'lw.WriteLine(face0.ToString)
'lw.WriteLine(face01.ToString)
'--> this does not work
'I need the name of the feature or the name of the Part
Dim guess1(2) As Double
Dim guess2(2) As Double
Dim pt1(2) As Double
Dim pt2(2) As Double
Dim minDist As Double
theUfSession.Modl.AskMinimumDist(face0.Tag, face01.Tag, 0, guess1, 0, guess2, minDist, pt1, pt2)
Next
Next
Catch ex As Exception
'---- Enter your exception handling code here -----
errorCode = 1
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
apply_cb = errorCode
End Function
I am currently working on a piece of code in which I use the BlockUI Styler in assembly.
I select two faces from two different parts to get and save the distance between the two faces.
I would now like to receive the names of the parts which belong to the selected faces.
Does anyone here have an idea.
Thanks for your help
Public Function apply_cb() As Integer
Dim errorCode As Integer = 0
Try
'---- Enter your callback code here -----
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim workpart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim Select0Props As PropertyList = face_select0.GetProperties()
Dim faces0() As TaggedObject = Select0Props.GetTaggedObjectVector("SelectedObjects")
Select0Props.Dispose()
Select0Props = Nothing
Dim Select01Props As PropertyList = face_select01.GetProperties()
Dim faces01() As TaggedObject = Select01Props.GetTaggedObjectVector("SelectedObjects")
Select01Props.Dispose()
Select01Props = Nothing
For Each face0 As Face In faces0
For Each face01 As Face In faces01
'lw.WriteLine(face0.ToString)
'lw.WriteLine(face01.ToString)
'--> this does not work
'I need the name of the feature or the name of the Part
Dim guess1(2) As Double
Dim guess2(2) As Double
Dim pt1(2) As Double
Dim pt2(2) As Double
Dim minDist As Double
theUfSession.Modl.AskMinimumDist(face0.Tag, face01.Tag, 0, guess1, 0, guess2, minDist, pt1, pt2)
Next
Next
Catch ex As Exception
'---- Enter your exception handling code here -----
errorCode = 1
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
apply_cb = errorCode
End Function