circular edge radius or diameter

Hi,
I'm looking for a solution to get the circular edge radius with nx open.
I have found getlength, but nothing for radi or diameter.
Another approach can be the diameter/radius of the circular face from the edge above ... but how
thank you in advance

With NX Open, get the cylindrical face first, and then get its radius:

NXOpen.UF.UFModl.AskEdgeFaces()
NXOpen.UF.UFModl.AskFaceData()

With SNAP:

Dim arcEdge As NX.Edge.Arc = ...
Dim arcGeom As Geom.Curve.Arc = arcEdge.Geometry
Dim r As Double = arcGeom.Radius

I begin to like, it
thx

what to do ?:
Adding c:\ugs\nx9.0\ugii\managed\\MiniSnap.dll as a reference item
Evaluating whether to add Snap library:
Cannot obtain authoring license from server

SNAP requires a separate license to run. There is a subset included (MiniSNAP) for free so you can evaluate SNAP. At a guess, I'd say that the function you are trying to use isn't in MiniSNAP and you do not have a full SNAP license, therefore you are getting a license error when executing the code.




Below is some journal code that demonstrates 2 ways to get the edge radius information: the first way uses an evaluator object, the second way extracts a curve from the edge and queries the properties of the curve object.





Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim myEdge As Edge
If SelectEdge("select circular edge", myEdge) = Selection.Response.Cancel Then
Return
End If

'lw.WriteLine(myEdge.Tag)

'method 1: use evaluator
Dim edgeEvaluator As System.IntPtr
theUfSession.Eval.Initialize(myEdge.Tag, edgeEvaluator)
Dim arcInfo As UFEval.Arc
theUfSession.Eval.AskArc(edgeEvaluator, arcInfo)
lw.WriteLine("method 1: edge evaluator")
lw.WriteLine("radius: " & arcInfo.radius.ToString)
lw.WriteLine("")

'method 2: extract arc, query radius
Dim edgeArcTag As Tag
theUfSession.Modl.CreateCurveFromEdge(myEdge.Tag, edgeArcTag)
Dim edgeCurve As Arc = Utilities.NXObjectManager.Get(edgeArcTag)
lw.WriteLine("method 2: extracted curve from edge")
lw.WriteLine("radius: " & edgeCurve.Radius.ToString)
'delete curve
Dim markId2 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Delete Arc")
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(edgeCurve)
Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

lw.Close()

End Sub

Function SelectEdge(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response

Dim theUI As UI = UI.GetUI
Dim title As String = "Select circular edge"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple

With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_CIRCULAR_EDGE
End With

Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selobj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

End Module

I will give it a try thank you.
You my think I'm asking because I'm lazy to search for,
my biggest problem to find something in the nx api reference
regards

I don't think you are lazy. The .net API ref documentation is large and not very user friendly. You almost have to know the exact search term to use to find what you need. Even when you find an older function that does what you want, it isn't always obvious how to use it.

One of the reasons this site was started was to post example code; I hope it helps you.

As explained above, MiniSNAP is a small subset of SNAP. If you want to see which functions are included, you can use the Object Browser in Visual Studio to look at the contents of MiniSNAP. If the function you are calling is not included, then this would explain the erro message.

To use MiniSNAP, you have to put "Imports MiniSnap" at the top of your journal file, of course, not "Imports Snap"

What would be the purpose of this journal?
Would it not be easier to just use Geometric properties where can just hover the cursor over a face or edge and have it display the information on the fly?

The code above isn't a complete solution to a problem, rather it is just to illustrate how to get the radius of a circular edge with NXOpen commands. I'm assuming the OP will use this information to help create other geometry or generate some sort of report. You are correct in that the code in its current state has no advantage over using the geometric propeties or info object commands.