Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXopen.UF.UFmodl.CreateSimplifiedCurve

Status
Not open for further replies.

jamkhp

Mechanical
Jun 29, 2011
2
How to use this function,
Please help.
I am using VB.net to program.
 
Replies continue below

Recommended for you

Below is a journal to create simplified curves. A couple of thing to note. You did not indicate your version of NX. This journal works for NX8 and NX8.5 If your version is pre NX8 you need to change

Dim resp As Selection.Response = _
ui.SelectionManager.SelectTaggedObject("Select a spline", _
"Select a spine", _
Selection.SelectionScope.AnyInAssembly, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, mask, sp1, cursor)

to

Dim resp As Selection.Response = _
ui.SelectionManager.SelectObject("Select a spline", _
"Select a spine", _
Selection.SelectionScope.AnyInAssembly, _
Selection.SelectionAction.ClearAndEnableSpecific, _
False, False, mask, sp1, cursor)

The second thing to note is that NX documentation suggest using

ufs.Curve.CreateSimplifiedCurve(curve_count, curves, tolerance, segment_count, segments)

instead of

ufs.Modl.CreateSimplifiedCurve(curve_count, curves, tolerance, segment_count, segments)

because the modl version will be removed in the future.

I have written the code for selecting a single spline. If your case is different please supply more information.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI

Module Module1
    Dim s As Session = Session.GetSession()
    Dim ui As UI = UI.GetUI()
    Dim ufs As UFSession = UFSession.GetUFSession()
    Sub Main()
        Dim response1 As Selection.Response = Selection.Response.Cancel
        Dim spline1 As Spline = Nothing
start1:
        response1 = Select_a_Spline(spline1)
        If response1 = Selection.Response.Cancel Or response1 = Selection.Response.Back Then GoTo end1
        Dim curve_count As Integer = 1
        Dim curves() As Tag = {spline1.Tag}
        Dim tolerance As Double = 0.01
        Dim segment_count As Integer = Nothing
        Dim segments(-1) As Tag
        ufs.Modl.CreateSimplifiedCurve(curve_count, curves, tolerance, segment_count, segments)
        GoTo start1
end1:

    End Sub
    Function Select_a_Spline(ByRef sp1 As Spline) As Selection.Response
        Dim mask(0) As Selection.MaskTriple
        mask(0).Type = UFConstants.UF_spline_type
        mask(0).Subtype = 0
        mask(0).SolidBodySubtype = 0
        Dim cursor As Point3d = Nothing
        Dim resp As Selection.Response = _
        ui.SelectionManager.SelectTaggedObject("Select a spline", _
        "Select a spine", _
        Selection.SelectionScope.AnyInAssembly, _
        Selection.SelectionAction.ClearAndEnableSpecific, _
        False, False, mask, sp1, cursor)
        If resp = Selection.Response.ObjectSelected Or _
        resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If
    End Function

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
    End Function

End Module

Regards

Frank Swinkels
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor