Journal/code to auto populate attributes
Journal/code to auto populate attributes
(OP)
Hi all,
Would anyone be able to help me out with some code that I could assign to a button that when pressed would open a menu/text entry box that would allow me to populate some attributes in the model such as project number and client name? Cowski, I'm looking in your direction
Cheers
Si.
Would anyone be able to help me out with some code that I could assign to a button that when pressed would open a menu/text entry box that would allow me to populate some attributes in the model such as project number and client name? Cowski, I'm looking in your direction
Cheers
Si.
Best regards
Simon
NX7.5 NX8.5 NX9 NX10 NX11
NX Consultant
www.team-eng.com





RE: Journal/code to auto populate attributes
be opened and lets you assigne an attributes to that body.
RE: Journal/code to auto populate attributes
1. create a model
2. Assign a material (standard library)
3. The seed part would have some additional attribute (Project number and client and perhaps a couple more)
4. I would then want to press a button and have a menu appear with two (or more) entry fields (project and client) I would manually type these values in and when I press OK the attribute would now be populated.
5. I then create a drawing and populate the title box but the fields in the title box for project and client would be locked and automatically populated based on the attributes that were assigned in the model.
cheers
Si
Best regards
Simon
NX7.5 NX8.5 NX9 NX10 NX11
NX Consultant
www.team-eng.com
RE: Journal/code to auto populate attributes
CODE --> vb
'Created By Jeremy Shooks 08-11-2017 Option Strict Off Imports System Imports System.Collections.Generic Imports System.Windows.Forms Imports NXOpen Imports NXOpenUI Module NXJournal Sub Main (ByVal args() As String) Dim theSession As Session = Session.GetSession() Dim theUI As UI = UI.GetUI() 'Insert code here Dim cur_MM_ProjectNumber As String Dim MM_ProjectNumber As String Dim cur_MM_ClientName As String Dim MM_ClientName As String MM_ProjectNumber: Try cur_MM_ProjectNumber = thesession.Parts.Work.GetStringAttribute("MM_ProjectNumber") Catch exc As NXException MM_ProjectNumber = NXInputBox.GetInputString("Enter ProjectNumber Number", "Enter ProjectNumber Number","Number") MM_ProjectNumber = MM_ProjectNumber.ToUpper() theSession.Parts.Work.SetAttribute("MM_ProjectNumber", MM_ProjectNumber) goto Client_Name End Try MM_ProjectNumber = NXInputBox.GetInputString("Enter ProjectNumber Numbe", "Enter ProjectNumber Number",cur_MM_ProjectNumber) MM_ProjectNumber = MM_ProjectNumber.ToUpper() theSession.Parts.Work.SetAttribute("MM_ProjectNumber", MM_ProjectNumber) Client_Name: Try cur_MM_ClientName = thesession.Parts.Work.GetStringAttribute("MM_ClientName") Catch exc As NXException MM_ClientName = NXInputBox.GetInputString("Enter ClientName Number", "Enter ClientName Number","Name") MM_ClientName = MM_ClientName.ToUpper() theSession.Parts.Work.SetAttribute("MM_ClientName", MM_ClientName) goto Last End Try MM_ClientName = NXInputBox.GetInputString("Enter ClientName Numbe", "Enter ClientName Number",cur_MM_ClientName) MM_ClientName = MM_ClientName.ToUpper() theSession.Parts.Work.SetAttribute("MM_ClientName", MM_ClientName) Last: End Sub End ModuleRE: Journal/code to auto populate attributes
http://nxjournaling.com/content/using-winforms-jou...
thread561-332871: Journal - Show Attribute Value on TextBox (User Form)
thread561-354838: Macro help - to assign part attributes (NX 7.5)
thread561-353249: Windows edit attribute
www.nxjournaling.com
RE: Journal/code to auto populate attributes
Best regards
Simon
NX7.5 NX8.5 NX9 NX10 NX11
NX Consultant
www.team-eng.com