jmarkus
Mechanical
- Jul 11, 2001
- 377
Okay, I'm just trying to get NX to put a point at the center of an arc. Seems simple enough in concept. But it's not working for me. Here's my code (ultimately I'm just trying to get the "createpoint" method to work - the rest is just to try it out):
If I have an arc on the screen I click on it and the journal completes without errors but I don't get any new points created. Is there another method I should be using?
Thanks,
Jeff
Code:
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpenUI
Imports System.Windows.Forms
Imports System.Environment
Module report_selected_object_type_and_subtype
Sub Main
Dim s As Session = Session.GetSession()
Dim ufs As NXOpen.UF.UFSession = NXOpen.UF.UFSession.GetUFSession()
Dim selobj As NXObject
Dim arc1 as ibasecurve
dim workpart as part = s.Parts.Work
dim cpoint as point = nothing
dim kk as integer=0
Dim type As Integer
Dim subtype As Integer
Dim lw As ListingWindow = s.ListingWindow
While select_anything(selobj) = Selection.Response.Ok
ufs.Obj.AskTypeAndSubtype(selobj.Tag, type, subtype)
lw.open()
lw.writeline(selobj.tostring)
End While
arc1=ctype(selobj,ibasecurve)
cpoint=workpart.points.createpoint(arc1,smartobject.updateoption.withinmodeling)
cpoint.SetVisibility(SmartObject.VisibilityOption.Visible)
End Sub
Function select_anything(ByRef selobj As NXObject) As Selection.Response
Dim theUI As UI = ui.GetUI
Dim cursor As Point3d
Dim typeArray() As Selection.SelectionType = _
{ Selection.SelectionType.curves }
Dim resp As Selection.Response = theUI.SelectionManager.SelectObject("Select anything", _
"Select anything", _
Selection.SelectionScope.WorkPart, _
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
End Module
If I have an arc on the screen I click on it and the journal completes without errors but I don't get any new points created. Is there another method I should be using?
Thanks,
Jeff