Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen.net Read Expressions

Status
Not open for further replies.

benwade

Mechanical
Jan 5, 2011
4
Hi, I'm using NX7.5 and Visual Studio 2010. I'm trying to read the numerical value of an expression (e.g 20mm) and display this in a text box in my visual basic program. This is the code I have so far which was created using the NX Journal feature.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Load default values
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")
Dim expression1 As Expression = CType(workPart.Expressions.FindObject("dblRawMaterialWidth"), Expression)



This is finding a dimension which I have called 'dblRawMaterialWidth' but I now want to read the value of this and display it in a text box on my form. Any ideas?

Many Thanks,
Ben
 
Replies continue below

Recommended for you

Eventually got there after many hours!

Just needed this simple line:

txtChangeMaterialWidth.Text = expression1.Value.ToString

Where txtchangematerialwidth is the name of the text box
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor