Cancel
Showing results for 
Search instead for 
Did you mean: 

User Input At Post Time

Valued Contributor
Valued Contributor

Today I managed to get a USER INPUT dialog box to be functional. I used the UGWISH_64 command function. The example that was suggested in my TK Dialog post did indeed work. I built my USER INPUT dialog box around this to send back the input expected from UGWISH_64.

 

Long story short. I’d like to streamline the process and be able to pass back an array with the 7 or 8 input values expected directly to the calling program instead of dumping them into a file and retrieving them from a file for output to my program . I also would like to - not have a second dialog box to address in order to make this a functional item.

 

I haven’t analyzed UGWISH_64 enough to be able to construct a pipeline that will allow m to pass back an array holding the data I need in the post. But, after looking at it briefly it seems to be taylored specifically to handle a tk_messagebox.

 

Check out the files that I’ve attached that will initiate the input window as well as send back the expected response from the required dialog box to answer to the calling function.

 

I haven't developed the code needed to collect the input from the output file yet but I think you will get the Idea.

 

8 REPLIES

Re: User Input At Post Time

Esteemed Contributor
Esteemed Contributor

You could try using globals, but (as you are spawning a separate process) I'm not sure globals will work in this directiion.

 

You can pass data *to* the TK script using ENV variables:

Calling routine (main post tcl):

global env
set env(Moog_Data_In) "This is a question"

 Then in the TK script

global env
set question $env(Moog_Data_In)

 

I don't remember if I tried the other direction or not, and if I tired, if it worked (or not).

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: User Input At Post Time

Valued Contributor
Valued Contributor

Thanks Ken,

 

The company has the computers pretty well locked up so I couldn't write to that location. I have solved the probem I was trying to thanks to CAM_GOD_RAMBO and the advise from you that got me to start thinking about the project in a different manner that ultimately brought me to a solution.

 

I've attached the completed and documented tk file that is fully functional with minor adjustments to the UGWISH_win64 { tcl } command after it was imported. I think I learned a hell of a lot from this project.

 

 

Re: User Input At Post Time

Esteemed Contributor
Esteemed Contributor

Glad you solved your issue.

 

Note a lot of that kind of data I store as attributes in the part (File -> Properties -> Attributes tab)

As it is, the attibutes is not a very tailored GUI, but a "simple Journal program" * should be able to get it done with a nicer dialog (and you could add some error checking, if possible)

(as I work in Teamcenter, if properly created, the part has some of this info already set up as part attributes)

If stored as an attribute, you don't need to ask the user (over an over) for the same info.

 

Note if you extend TCL with some API code, you can write the TK dialog info back to the part (as attributes or whatever) so you *could* only ask the user for info if the attrbutes don't already exist.

 

Ken

* - in days long gone, everything was solved by a "you could write a simple GRIP program to do that".  Merely adapting that to the current "state of the state" :-)

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: User Input At Post Time

Valued Contributor
Valued Contributor

It is evident that you have considerable experience with matters such as this. I, in comparison am a novice at best. I think from exchanges like this it opens doors that give me incentive to reach even further for optimum results. 

 

Thanks again!

Re: User Input At Post Time

Valued Contributor
Valued Contributor

Ken,

 

I looked at the possibility of putting this data in the Part Attributes area. I think it’s a great idea, but I think it’s more convenient for the GUI to come up at post time, have the operator fill in the required data, and then assign the input data to the Part Attribute variables. At this point my Proc would test for the required input. If all data has been input the User Input widget will not execute. If there is any missing data, the window will re-appear with the available data already in the appropriate fields leaving the fields empty that required further input.

 

This would eliminate the possibility of the programmer typing in erroneous variable names that my program wouldn’t recognize.

 

My question now is………………How do I assign the input date to the NX PART Attributes with the variable names I assign as data is input by the programmer?

Re: User Input At Post Time

Esteemed Contributor
Esteemed Contributor

I would create my own block styler dialog and wouldn't do all this in Tcl.

 

The post should just translate the internal path to NC code and not do fancy things with user interaction.

 

The block styler dialog will be able to prepare everything before the post is executed or just block the post from execution till the correct values are entered.

 

It is easy to save things to attributes from a block styler dialog, but impossible from Tcl without a custom DLL.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: User Input At Post Time

Valued Contributor
Valued Contributor

Ya...........I started to look at that but was already heavily engrossed in creating a User Input window wit tcl\tk. After reading your reply I decided to re-visit UI Blocker. Is there any good intro info on how to use it? The NX help isn’t very robust.

Re: User Input At Post Time

Esteemed Contributor
Esteemed Contributor

The block styler is just creating the outline to display a dialog in NX.

 

Information about the different blocks can be found in the NX documentation under Programming Tools => Block UI Styler or %UGII_BASE_DIR%/UGDOC/html_files/nx_api/index.html

The NXOpen API help is not installed automatically, you need to alter the NX documentation installation to add it.

 

The styler is just a visual dialog editor that allows to save the dialog framework.

You will get callbacks that need to be filled with the code to manage the users input.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Learn online





Solution Information