Submitted by GervaldNik on Sun, 02/26/2023 - 13:56
Forums:
Hi all!
I need to measure the distance between the circles of the symbolic thread of the components assembly. Measurement isn't a problem, but I don't understand how can I get symbolic thread curves from components(nuts) in the assembly.
Hope someone knows..
re: symbolic thread from component
It looks like you are already familiar with this thread:
https://nxjournaling.com/content/how-distinguish-symbolicthread-arc-othe...
Unless your components are fully loaded, I'm not sure that you will be able to tell the difference between an ordinary arc and a symbolic thread circle.
Are your components fully loaded? Are the symbolic thread circles in the used ref set of the component?
You are right, but there is
You are right, but there is some difference.
The code below works for curves built in the working part, but does not see the curves belonging to the input components, even if the reference set is configured correctly and the curves are visible on the screen and can be selected by the user.
Dim workPart As Part = theSession.Parts.Work
For Each arc As Arc In workPart.Arcs
//some code
Next
re: symbolic thread from component
The following code works for me (NX 1919) as long as the component is set as the work part.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module4
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
lw.Open()
Const undoMarkName As String = "report symbolic thread feature of arc"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
For Each tempCurve As Curve In theSession.Parts.Work.Arcs
Try
Dim theFeature As Features.Feature
theFeature = theSession.Parts.Work.Features.GetAssociatedFeature(tempCurve)
lw.WriteLine(tempCurve.GetType.ToString() & " tag: " & tempCurve.Tag.ToString)
If IsNothing(theFeature) Then
lw.WriteLine("no feature associated with curve")
Else
lw.WriteLine(theFeature.GetFeatureName & " is associated with curve")
End If
Catch ex As NXException
lw.WriteLine(ex.Message)
End Try
Next
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
So we must to set each
So we must to set each assembly component as a working part in a loop to process it?
re: set work part
Setting the part as work helps to access the feature data. I don't think it is technically necessary, but the part does need to be fully loaded - partial or minimal loading won't give you access to the feature data.