Referencing min radius - VB Journal
Referencing min radius - VB Journal
(OP)
I'm attempting to reference the minimum radius of a selected curve from within a journal... so far, i've tried doing this using CreateCurveCurvatureAnalysisBuilder(), but I was wondering if there was an easier way.
Perhaps "GeometricUtilities.CombOptionsBuilder.AnalysisTypes.Radius"?
Perhaps "GeometricUtilities.CombOptionsBuilder.AnalysisTypes.Radius"?





RE: Referencing min radius - VB Journal
The only one I've found is workPart.FindObject("ENTITY 169 1 1"), but this will only work for a specific instance, of course.
RE: Referencing min radius - VB Journal
If so, here is an example I downloaded from GTAC a while back.
CODE
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module select_a_spline
Dim s As Session = Session.GetSession()
Dim workPart As Part = s.Parts.Work
Sub Main()
Dim spline1 As Spline
If (SelectSpline(spline1) = Selection.Response.ObjectSelected) Then
Dim nullUnit As Unit = Nothing
Dim point2 As Point3d = New Point3d(0, 0, 0)
Dim point1 As Point = workPart.Points.CreatePoint(point2)
Dim measureDistance1 As MeasureDistance
measureDistance1 = workPart.MeasureManager.NewDistance(nullUnit, MeasureManager.MeasureType.Maximum, spline1, point1)
measureDistance1.Information()
measureDistance1.Dispose()
End If
End Sub
Function SelectSpline(ByRef selectedObject As NXObject) As Selection.Response
Dim ui As UI = ui.GetUI()
Dim title As String = "Select a Spline"
Dim response As Selection.Response
Dim selectionMask(0) As Selection.MaskTriple
With selectionMask(0)
.Type = UFConstants.UF_spline_type
.Subtype = UFConstants.UF_spline_subtype
.SolidBodySubtype = 0
End With
Dim cursor As Point3d = Nothing
response = ui.SelectionManager.SelectObject("Select a Spline", _
"Select a Spline", Selection.SelectionScope.WorkPart, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, selectionMask, selectedObject, cursor)
Return response
End Function
End Module
This routine prompts the user for a spline then creates a point at (0,0,0) and measures the distance from the point to the spline. The point and measurement code is only there to show that you can do something with the spline now that you have one selected. I hope this helps you out.
RE: Referencing min radius - VB Journal
Unfortunately, it's not really the spline that I'm looking to select.
If you use Analysis->Curve->Curve Analysis, there is an option to display minimum radius. I need the callout for that number.
Doing this to make representation of cable more accurate. Right now, splines don't seem to obey any kind of bend radius restriction, but I can force them to do so by adding some slack and making the bend larger. Just trying to automate this process.
RE: Referencing min radius - VB Journal
CODE
'journal to determine minimum radius of curvature of selected spline
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module select_a_spline
Dim s As Session = Session.GetSession()
Dim workPart As Part = s.Parts.Work
Dim ufs As UFSession = UFSession.GetUFSession()
Sub Main()
Dim spline1 As Spline
'Dim tagList(0) As NXOpen.Tag
Dim parm as Double
Dim point(2) as Double
Dim tangent(2) as Double
Dim p_norm(2) as Double
Dim b_norm(2) as Double
Dim torsion as Double
Dim radOfCurvature as Double
Dim minRadOfCurvature as Double
Dim i as Integer
If (SelectSpline(spline1) = Selection.Response.ObjectSelected) Then
'get initial value for minRadOfCurvature
'set the parameter value we are interested in, value ranges from 0 to 1
parm = 0
ufs.modl.AskCurveProps(spline1.tag, parm, point, tangent, p_norm, b_norm, torsion, minRadOfCurvature)
'loop over the curve in .01 increments
For i = 1 to 100
parm = i/100
ufs.modl.AskCurveProps(spline1.tag, parm, point, tangent, p_norm, b_norm, torsion, radOfCurvature)
if radOfCurvature < minRadOfCurvature then
minRadOfCurvature = radOfCurvature
end if
Next
'show messagebox with minimum radius of curvature
msgbox(minRadOfCurvature)
End If
End Sub
Function SelectSpline(ByRef selectedObject As NXObject) As Selection.Response
Dim ui As UI = ui.GetUI()
Dim title As String = "Select a Spline"
Dim response As Selection.Response
Dim selectionMask(0) As Selection.MaskTriple
With selectionMask(0)
.Type = UFConstants.UF_spline_type
.Subtype = UFConstants.UF_spline_subtype
.SolidBodySubtype = 0
End With
Dim cursor As Point3d = Nothing
response = ui.SelectionManager.SelectObject("Select a Spline", _
"Select a Spline", Selection.SelectionScope.WorkPart, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, selectionMask, selectedObject, cursor)
Return response
End Function
End Module
Also, if you are using bridge curves, you can assign a radius constraint but it might take away too much control for what you are after.
RE: Referencing min radius - VB Journal