Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only selectable values for a given variable (pick from list)

Status
Not open for further replies.

mar2805

Structural
Dec 21, 2008
372
Hi folks!
I was wondering if its possible in Mathcad to eg. define a value for concrete compressive strenght fck, but instead of manualy entering values (like 20MPa,25MPa,30MPs...) I would only choose values from a some sort of list that pups-up when clicking in the "fck"=... value box.
Another thing, when you select a value of fck=30MPa is there any chance that MATHCAD automaticly uses value of modulus of elesticity coresponding to fck=30MPa.... Emodulus=30.000MPa?
Egsample, when you select a value for fck, a coresponding value for E would be automaticly choosen for later calculations...
fck=20MPa ---> E=25.000MPa
fck=25MPa ---> E=29.000MPa
fck=30MPa ---> E=31.000MPa

Thank you.
 
Replies continue below

Recommended for you

Seems ok.
Is that fck "list box" collapsable or youll always see the whole list of available values?
How did you create it?

Can you explain a bit that small programing pice of how to choose E values for selected fck value.
Thanx a lot! :)
 
I don't understand why you cant just have the equation to calculate E after fck is define. A lot easier than a programming routine to do the exact same thing.
 
Sorry, should be all M[fck-1 in the "if"-statement.
 
In this case you add the ListBox over "Insert"-"Control" and "List Box". Then you right click on "Edit Script" and edit the "One", "Two" and "Three" characters and put in your own - or even add some more. I don't quite understand what you mean by "see the whole list of the available values" because in the original post you said: "select value for fck" - doesn't that mean they should all be there to be able to select?
 
@struct
can you place an egsample...you mean to use a formula for calculating E based on fck value?
I did that but I want to use code specific values for E

@occupant
Thank you, will try and report back :)
 
I guess the attached file is what you are searching for. If you are willing to type in all the data in the component properties you may chose to use a Web Control. But I assume you have a bigger list of values to chose from and so in my version the Listbox entries are generated dynamically depending on a vector of force values and that way I had to use a scripted component. This means that on opening the file you will be asked if you want to disable scripting and have to click "No".

Concerning you question about all values being visible: Unfortunately there is no dropdown menu like component in Mathcad, at least not out of the box. The best we can use for this purpose are listboxes. But you can size those boxes so that only a limited number of entries are shown at once and you may scroll to get the rest, but the box will not expand dynamically when you click on it like a dropdown would do. To resize the component (I chose to see three entries out of the five or six I typed) you should first right click and chose "Show Arguments".

BTW, it may be a good idea to state which version of Mathcad you use when asking a question like this. If you would use Prime, the answer would have been much easier: No, you can't do that as we have no components in Prime.

@Occupant: I am not sure but is there any specific reason for posting pdf's rather than the real files? I guess a pdf is much less useful and if someone asks about Mathcad he sure is able to open a Mathcad document.
 
 http://files.engineering.com/getfile.aspx?folder=66b5c2f3-e644-45df-a66e-d0010a1e2ba9&file=SelectForce.xmcdz
rmix22: That's really very simple, if somebody doesn't phraze their question with an accompanying Mathcad sheet, I do the same.
 
@Occupant: I understand and I consider it annyoing, too, if people ask and post pics or the like and assume others to retype. But in case of this question the worksheet wouldn't have helped other than at least showing which version the question is for - but then, we both assumed real Mathcad anyway ;-)
 
mar2805 said:
Mathcad 14...sorry guys... smile
The sheet I posted was created with MC15[M030] but that should not be a problem for MC14.
 
Guys sorry for the long delay I had a accident and broke my arm.
Anyway I tried to use what you have presented in .pdf files but I cant simulate even the most simpliest egsample.
In the file attched i made a listbox were I defined values for fck.
I can select the value from the list.
When I type fck anywhere in the sheet I get an value that reperesnts the row number and not the value thats defined in the list box ?!
How to change this?

Linking E value to this fck list box value now seems like science fiction to me :-(
Can oyu explain how to do this and attach some egsample please.
 
 http://files.engineering.com/getfile.aspx?folder=2fabc08f-f914-4c4a-9c83-895ed7dc13aa&file=list1.xmcd
The values displayed are string but you do not want the string as result I guess.

Did you look at the sheet I posted? Its not a pdf and it looks to me that it does what you want and you can define the values you want to be displayed for choice as a normal Mathcad vector and do not need to edit the script to change values.
 
Yes Ive seen it but I would like to Know how it Works.
Dont get me wrong but I hate to copy something without any knowledge of how the thing works :-(
If you where maybe kind enough to explain command you used it would be great couse I dont understand any of them :_(

 
I assume that the creation of fck_list and E_list as normal Mathcad vectors is clear.
Then I create a vector of strings consisting of the values of fck_list (numbers only, therefore divide by MPa) and added the string "MPa".
This string "name_list" is passed to the component as input, the output of the component is the index "sel" of the string which was selected. Depending on the value of "sel" f.ck and E are chosen from their appropriate vectors.
The component itself contains just a few VBS commands you may look at by right clicking the component and select "edit script".
I have put the creation creation of name_list and the assignments of f.ck and E in collapsed regions to put them out of the way.
For more information about VBS you may look up the appropriate help pages at the Microsoft site or all a lot of other ressources in the net. You have to keep in mind, though, that VBS (Visual Basic Script) is similar in some respects but not the same as pure VB or VBA (Visual Basic for Applications, the script languange in Excel, Word, ...).
 
rmix22 thatx a lot.
Can you tell me plase how dod you mae that scroll bar in the control box?
 
If you size the box so that not all items fit in place it will come automatically if you have selected that you want it. You do so by right clicking the listbox, go to "Mathsoft ListBox Control-Object", chose "Properties" and in tab "General" activate "Vertical Scroll".

In my opinion its much harder to maintain a sheet if the items are hard coded in the VBScript. Thats the reason I prefer to pass it to the component as normal Mathcad vector. Code is much easier and transparent to manage that way an the component is reusable without any change (other than the names of the input and output variable). Furthermore its much easier to pick the value from a vector using the returned index as vector index (minus 1, if ORIGIN is 0) than to write the series of if statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor