×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Referencing min radius - VB Journal

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"?

RE: Referencing min radius - VB Journal

(OP)
As a clarification, I have a journal which puts a curve analysis on the selected spline.  I'd like to call the "minimum radius" value from this analysis, for use in a function which adds slack to the spline until the measured value meets or exceeds a given value.

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

So you just need code to interactively select a spline?
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

(OP)
Thanks for the reply.

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

Try this journal:

CODE

'eng-tips thread561-312330: Referencing min radius - VB Journal
'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

(OP)
This works much better than what I had, thank you very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources