How to edit the INP file (Advanced 1)

Items Covered

1. Adding a pull down menu

2. Adding pictures to the pull down menu

3. Graying out Parameters (make inactive)

4. Turing off parameters/pictures

 

Situation

More information

Change the default automatically created dialog to suit the users requirements

 

 

 

After creating a custom component (connection, detail, part) a dialog is automatically created.

 

 

This dialog is controlled by an INP file automatically generated in the model directory

This can easily be accessed through the "Tools" menu. This file can then be edited using a normal text editor such as "Notepad" or "Wordpad"

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The file will look like this:

 

Add a picture and move the input parameters P1-P7 to the correct places

Refer to "Edit the INP file (basic)" tutorial

This leaves P11 the input parameter we wish to change from simple numeric input to a pull down menu

To do replace the line with the following lines:

 

               attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90)

            {

               value ("square ", 1)

               value ("round ", 0)

               value ("pyramid ", 0)

        }

This will give the following result                                   X,Y, Length

 

 

The value show in apostrophes is show as text in the pull down menu

 

To change from text to pictures, first create 3 bitmap pictures and save them in the teklastructures\”version”\nt\bitmaps directory

 

                         

square.bmp    round.bmp     pyramid.bmp

 

These bitmaps are 50*50

 

 

               attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90)

            {

               value ("square.xbm ", 1)

               value ("round.xbm ", 0)

               value ("pyramid.xbm ", 0)

        }

 

Replace the text with the bitmap name. NOTE! change the extension from "bmp" to "xbm"

 

This will give the following result                                  

 

 

 

Adobe Systems

NOTE!

 value ("square.xbm ", 1)

value ("round.xbm ", 0)

value ("pyramid.xbm ", 0)

 

The "1" value defines the default setting  in the pulldown menu (which one shows in the dialog)

The values returned when selecting from the pulldown menu Follow in order

E.g.

value ("square.xbm ", 1) =0

value ("round.xbm ", 0) =1

value ("pyramid.xbm ", 0) =2

 

 

 

 

 

 

 

 

 

 

 

 

To Gray out unused parameters add the following text to the attribute line "toggle_field:P2=1"

 

attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90,"toggle_field:P2=1)

 

This mean to gray out (make inactive) parameter P2 when the value select from the pulldown menu is 1 (round)

 

We also want to gray out P2 when value 3 is selected (pyramid), simply add ",3" at the end

 

attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90,"toggle_field:P2=1,3)

 

This now means P2 will be inactive if the user selects either round or pyramid; it is only active when 1 (square) is selected.

 

We can then add the full options

 

attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90,"toggle_field:P2=1,2;P3=1,2;P4=0,2;P5=0,1;P6=0,1;P7=0,1")

 

So now P2 & P3 are only active when "square is selected", P4 when "round" is selected, P5, P6 & P7 when "pyramid" is selected

 

To turn the parameters off simply add an "!" exclamation mark in front of the parameter

 

attribute ("P11", "", option, "%s", none, none, "0.0", "0.0", 160,50,90,"toggle_field:!P2=1,2;!P3=1,2;P4=0,2;P5=0,1;P6=0,1;P7=0,1")

 

This will then turn off P2 & P3 (to turn off a picture simply substitute the parameter name for the picture name)