×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Get the edge Blend Radius using NX Open Code ?2

## Get the edge Blend Radius using NX Open Code ?

(OP)
Hello Everyone.

How can i get the edge blend radius using NXOpen Code ?

Thanks and Regards,
Amitabh

### RE: Get the edge Blend Radius using NX Open Code ?

Hi Amitabh, the way i found was using the Information->Object option equivalent in NXOpen for VB.net, i store face information in a text file and then i search the radius value in the text file.

thesession.ListingWindow.SelectDevice(ListingWindow.DeviceType.File, "c:\3D_Log.txt") // Sets the listing window output to a text file

Dim selectedobjects(0) As NXObject
selectedobjects(0) = obj // obj=the face you want to check
thesession.Information.DisplayObjectsDetails(selectedobjects)//Stores the face info in the text file
thesession.ListingWindow.Close()

thesession.ListingWindow.SelectDevice(ListingWindow.DeviceType.None, "")// Sets the information window output to nothing so i can access the contents
of the text file

Dim stream As New IO.StreamWriter("c:\3D_Log.txt", False)
stream.WriteLine("")//Delete the contents of the text file to avoid having info of more than 1 face
stream.Close()

Public Function findradius(ByVal objectinforeport As String) As Double
Return Math.Round(Double.Parse(objectinforeport.Substring(objectinforeport.IndexOf("=", objectinforeport.IndexOf("Radius")) + 1, 12)), 2)
End Function

Hope this helps

Regards
LBD

### RE: Get the edge Blend Radius using NX Open Code ?

(OP)
Thank you LBD.

That is a different way of approaching the result although it is effective.
I was just wondering is there a API which can do the work for me.

Regards,
Amitabh

### RE: Get the edge Blend Radius using NX Open Code ?

(OP)
Hi LBD,

I have a query , How do i clear of the text file to which the listing window output is generated so that i can read the edge radius for more than one edges using the same principle ?

Regards,
Amitabh

### RE: Get the edge Blend Radius using NX Open Code ?

Amitabh, the section in bold opens the txt file and writes an "empty" string in the file = stream.WriteLine("") and then closes the stream, this clears the txt file contents.

Something i forgot to mention is that i use this code in unparametrized bodies where i dont actually have a "blendind design feature", but a set of blended faces.

thesession.ListingWindow.SelectDevice(ListingWindow.DeviceType.File, "c:\3D_Log.txt") // Sets the listing window output to a text file

Dim selectedobjects(0) As NXObject
selectedobjects(0) = obj // obj=the face you want to check
thesession.Information.DisplayObjectsDetails(selectedobjects)//Stores the face info in the text file
thesession.ListingWindow.Close()

thesession.ListingWindow.SelectDevice(ListingWindow.DeviceType.None, "")// Sets the information window output to nothing so i can access the contents
of the text file

Dim stream As New IO.StreamWriter("c:\3D_Log.txt", False)
stream.WriteLine("")//Delete the contents of the text file to avoid having info of more than 1 face
stream.Close()

Regards
LBD

### RE: Get the edge Blend Radius using NX Open Code ?

In code you can selecting an edge blend feature you can ask for the expressions belonging to the edge blend. For a simple edge blend (one radius) the expression contains the blend radius value.

Frank Swinkels

### RE: Get the edge Blend Radius using NX Open Code ?

(OP)
Thank you Frank Swinkels for the approach but in my code the user is not selecting any features rather i am retrieving all the features from the NX feature tree. In that case how can i retrieve the radius value for both the Edge Blend and the Face Blend.

Regards,
Amitabh

### RE: Get the edge Blend Radius using NX Open Code ?

2
Here is simple code that uses a feature collection. I then check for features that are either BLEND or FACE_BLEND features. I then get the expressions for radii and then list the radius value.

Hope this helps.

#### CODE -->

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Features

Module BlendInfo

Sub Main()
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
Dim dp As Part = s.Parts.Work
Dim exps() As Expression
Dim expression_name As String = Nothing
Dim featcoll As FeatureCollection = dp.Features
Dim index1 As Integer = 0
lw.Open()
For Each f As Feature In featcoll
'   lw.WriteLine("Feature Type: " & f.FeatureType.ToString)
If f.FeatureType = "BLEND" Then
exps = f.GetExpressions()
For Each exp As Expression In exps
expression_name = exp.Description
If index1 > 0 Then
lw.WriteLine(f.FeatureType.ToString & " Radius: " & exp.RightHandSide.ToString)
End If
Next
ElseIf f.FeatureType = "FACE_BLEND" Then
exps = f.GetExpressions()
For Each exp As Expression In exps
expression_name = exp.Description
If index1 > 0 Then
lw.WriteLine(f.FeatureType.ToString & " Radius: " & exp.RightHandSide.ToString)
End If
Next

End If
Next
End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
End Function

End Module 

Frank Swinkels

### RE: Get the edge Blend Radius using NX Open Code ?

(OP)
Thank you !!!
Works perfectly.

Regards,
Amitabh

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

The Low-Code Digital Transformation Guide
Change the way you develop apps and, in turn, change the way your business operates and engages with customers, leading to new channels of revenue. This ebook is the culmination of 14 years of experience with 4,000 customers that have all transformed their business through low-code development. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!