Submitted by Hari Prasanna on Sun, 08/02/2020 - 22:10
Forums:
Hi There, I need some help in creating a topmost/closest point on the peak of profile of a spline/curve by creating a minimum distance with respect to a plane. When I run a Journal it is generating its own identifier as shown below which cannot be used with a different part.
spline1 = workPart.Splines.FindObject("ENTITY 9 12 1")
measureDistanceBuilder1.Object2.Value = spline1
It would be a great if someone can help in coding to replacing the identifier with different name, where I can run the journal for different parts too.
Currently I am using Python interface, Visual basic is also fine.
Thanks
Refer to a Spline
Hi,
are you creating a Spline in your macro or would you like to
select an existing Spline?
Thanks for your reply. I am
Thanks for your reply. I am not creating the spline, its an existing spline. The spline has a profile for which I need to create a point at the peak(closest or minimum distance point) normal to a plane.
I am using Journal, I am trying to modify the existing Journal created using Python interface.
Regards
HPK
If you want to use a Spline
If you want to use a Spline in your Code,
you can select the Spline with the selection method:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports NXOpen.Utilities
Module NXJournal
Public ufs As UFSession = UFSession.GetUFSession()
Public theUI As UI = ui.GetUI
Public theSession As Session = Session.GetSession()
Public workPart As Part = theSession.Parts.Work
Public displayPart As Part = theSession.Parts.Display
Public title as String
Public selobj As NXObject
Public cursor As Point3d
Public spline1 As Spline
Sub Main
title="Select Spline"
If select_spline(selobj) = Selection.Response.Ok
spline1 = selobj
Else
Exit Sub
End If
End Sub
Function select_spline(ByRef selobj As NXObject) As Selection.Response
Dim theUI As UI = ui.GetUI
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.Curves}
Dim resp As Selection.Response = theUI.SelectionManager.SelectObject( _
"Select a spline", title, _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selobj, 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
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
Hi thank you, appreciate your
Hi thank you, appreciate your help and effort. My main requirement is creating a minimum distance between the spline and the normal plane. I am trying to do by NXOpen.UF.Obj.CycleByName where it automatically selects both the objects to create a min distance. Can you please help how to pass this arguments.
Regards,
HPK
HPK
re: cycle by name
If you need an example of using the ".CycleByName" method, one can be found here:
http://nxjournaling.com/comment/2628#comment-2628