Cancel
Showing results for 
Search instead for 
Did you mean: 

How to create complex UI

Valued Contributor
Valued Contributor

Hello again,

 

I am currently building a rather complex UI for NX12.

I figured that BlockStyler has limitations and the Code behing would be rather complex when it comes to updating and handling the UI. Maybe I am just doing this wrong.

 

So tried to add this as a WinForm or WPF which worked. But I couldn't figure out how to implement a BodyPicker and FacePicker. For example in my BlockStylerUI I implemented a PointPicker, the user can select a point on any surface and a specific feature will be added to this coordinates.

 

I have two questions:

  • Is BlockStyler the correct way for complex UI's? If yes, is there any example of how to handle all the code behind including updating UI etc.
  • When it comes to WinForms or WPF, is there a way to add a feature like the PointPicker mentioned above without closing the WinForm or WPF?
11 REPLIES 11

Re: How to create complex UI

Legend
Legend

@WT 

 

I never felt diffcult to use UI block styler for complex UI. Block styler can able to handle all NX functionalities. 

 

If you are using WinForm and need to select a point or face try ufunc wrapper functions. They may help you. 

 

https://docs.plm.automation.siemens.com/data_services/resources/nx/11/nx_api/custom/en_US/ugopen_doc...

 

If your application is only with NX, I suggest to use NX block styler.

 

Tell us about your complex UI.

伊尔凡

Re: How to create complex UI

Gears Phenom Gears Phenom
Gears Phenom

I agree, I've created some pretty complicated dialogs with Blockstyler...

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Dell 7530 Precision, Win10, 32GB. Developing in: Java | C | KF
Production: [NX12.0.2 MP1]

Re: How to create complex UI

Siemens Phenom Siemens Phenom
Siemens Phenom

Every dialog added to NX in the past ten years or so uses Block Styler. Is your UI more complex than all those dialogs? Probably not.

 

If you use WinForms, then you'll have to do a lot of work to get your UI to look and behave like the rest of NX. You'll have problems with things like selecting objects, selection pre-highlighting, specifying point locations, etc.

 

If your functions doesn't do any interaction in the graphics window, and you don't have a Block Styler license, then using a WinForm might be appropriate. Otherwise, I'd strongly suggest that you use Block Styler. You might have to write a lot of code in callback functions to get the behaviour you want, but this code wouldn't be any simpler with a WinForm, would it?

 

 

山田
yamada

Re: How to create complex UI

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Posting an image of your dialog would help to suggest how to do things in a simple manner.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide
Highlighted

Re: How to create complex UI

Valued Contributor
Valued Contributor

Hello all,

 

maybe I should have provided more informations, sorry about that.

I bascially have two bigger issues where I have the feeling that im doing it not in the best way:

 

UI-Design

I was struggling with the placement and order of the blocks.

For example I was not able to have two columns of enums with the same size. Or change the size of a specific element in its height and width.DemoUI.png

As a workaround I used Group-Block without a header, its still not that good, but it gets closer to what I want to achive.

 

Code-Behind

I have multiple Listboxes, Enums, etc that will be filled from a (for now local) database.

As a example: The available selections of Listbox2 is changed everytime you change the selection of Listbox1.

 

I haven't found a better way than structuring my code like this:

 

ExampleUI (this one comes from BlockStyler)

I made this a partial class to have the population of the UI handled in a different file for better reading.

 

Populate (partial class from ExampleUI)

In here I will read from the databases and populate all the blocks.

 

Commands (partial class from ExampleUI)

Same as the Populate but this one contains all the Buttonroutines.

 

SelectionChanged (partial class from ExampleUI)

This one will re-populate / filter the UI according to the selection changes of each single block.

 

My main thought about that structure was an "easy-to-maintain" code whenever you change the design of the BlockStyler or the Database. All sub-partical-classes will call regluar classes to handle the single actions.

 

 

Re: How to create complex UI

Gears Phenom Gears Phenom
Gears Phenom

You can get pretty much what you want just using block attachments, see the attached example dialog:

ExampleDialog.png

Is that any good?

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Dell 7530 Precision, Win10, 32GB. Developing in: Java | C | KF
Production: [NX12.0.2 MP1]

Re: How to create complex UI

Gears Phenom Gears Phenom
Gears Phenom

Some more information about how I've forced the layout of Block dialogs in the past can be seen in these posts:

https://community.plm.automation.siemens.com/t5/NX-Programming-Customization-Forum/SNAP-Output-Messa...

https://community.plm.automation.siemens.com/t5/NX-Programming-Customization-Forum/Block-Styler-Dial...

Hope this helps.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Dell 7530 Precision, Win10, 32GB. Developing in: Java | C | KF
Production: [NX12.0.2 MP1]

Re: How to create complex UI

Valued Contributor
Valued Contributor

Thanks Inch,

that helped me alot. Do you have any suggestion how how to make the code architecture?

I am currently trying to split it with partial classes to achive a better maintainability, but I am not happy with this solution.

 

Edit:

I changed the Code and made separate classes for each group of controls and pass the BlockStylerItems into the class.

That way I can maintain each single group easily and I have a good structured code.

Re: How to create complex UI

Gears Phenom Gears Phenom
Gears Phenom

I'm not sure what language you're using, but I guess VB or C#, which I'm not really familiar with. We're using Java which has very different structure and requirements. I've heard of others creating partial classes (in C# I think), but thats not possible in Java, so we've come up with another solution that does not use the code generated by Blockstyler at all.

The only thing I should say is do not use the code generated by Blockstyler directly, always make a copy because if you edit the dialog in Blockstyler and save it, it will overwrite the source code too and you'll lose all of your edits.

 

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Dell 7530 Precision, Win10, 32GB. Developing in: Java | C | KF
Production: [NX12.0.2 MP1]