jamkhp
Mechanical
- Jun 29, 2011
- 2
How to use this function,
Please help.
I am using VB.net to program.
Please help.
I am using VB.net to program.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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