Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Jan 5, 2011
Messages
4
Location
GB
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
 
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

Back
Top