×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ListBox with multiple parameters
2

ListBox with multiple parameters

ListBox with multiple parameters

(OP)
Hi there,
I am trying to optimize my work as a structural engineer, and create a file that has reduced input on my behalf.
I am currently looking for a solution to the following problem :
-I want to select the concrete class used (figured using a listbox ) ex: C12/15 , C16/20 , C20/25 etc
-class parameters should change based on selection.

Problem there are 14 parameters i need to include, and the listbox only allows for 1.

I was thinking of defining them in another mathcad file as vectors, and calling them out based on selection.

Is there any way i can do this?I'm using Mathcad 14.
Any suggestions would be greatly appreciated.I'm not that good at programming.

Thank you.
Best regards,
Dan

RE: ListBox with multiple parameters

?? Which version of MC? MC15's listbox is VBscript, which you edit to add entries. The default entries are "One", "Two", and "Three"

TTFN
FAQ731-376: Eng-Tips.com Forum Policies
[IMG http://tinyurl.com/7ofakss]
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers


Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
There is a homework forum hosted by engineering.com: http://www.engineering.com/AskForum/aff/32.aspx

RE: ListBox with multiple parameters

I think you should be able to add items to the listbox in M14. Right-click on the listbox, choose Edit Script from the various options. At the top of the code, as IRStuff says, you should see a few lines of VBScript along the lines of:

Rem Add Strings here as needed
ListBox.AddString("One")
ListBox.AddString("Two")

Just copy and paste one (or both) of the ListBox.AddString("xxx") lines as many times as you want and replace "One" and "Two" with what you want.

It's also possible to modify the code the read in a vector of strings from the Mathcad worksheet, but that takes a little more effort and the above should do what you want.

RE: ListBox with multiple parameters

From what I recall, as already indicated, you can add as many as 256 items to the List. But is that really what you wanted? I may be wrong, reading your post I got the impression that you wanted for every input an output of up to 14 parameters.

RE: ListBox with multiple parameters

Quote (Occupant)

From what I recall, as already indicated, you can add as many as 256 items to the List. But is that really what you wanted? I may be wrong, reading your post I got the impression that you wanted for every input an output of up to 14 parameters.

If that's the case (and it makes sense upon a re-reading of the question) and the 14-parameter set is uniquely defined by the (one of < 256) concrete class, then there are several ways to skin the cat.

One way is to define the characteristics inside the listbox (script) as an array (or 14 separate arrays). The listbox index could then choose the appropriate set of parameters corresponding to the concrete class and return them as a vector. The listbox could be exported as a component, which would give the advantage of being updateable for every worksheet that used it.

Another way would be to just return concrete class index and, as the OP suggested, use that to index the parameter arrays in the worksheet. There are several ways to get the values into the worksheet without using up large amounts of visible worksheet in the process, eg:

a. Put all of the arrays in an Area and collapse it to hide the definitions. Has the advantage of encapsulating the parameters within the worksheet so that its provenance is readily established. The cloud in the silver lining is that, should the parameter values change, the values would need updating in each worksheet that had them ... not too bad for a couple of sheets but a right pain for many sheets and a possible configuration issue - although one way round this might be to use a scripting language (or even Mathcad) to change the values in the worksheet xmcd (xml) files (not sure if this can be done in Prime, though).

b. Put the values in a text/Excel file and read that in to the worksheet.

c. Define the values in a worksheet and directly link it using a Mathcad Reference (the 'parameter value' worksheet could also be used to create and update a data file.

RE: ListBox with multiple parameters

(OP)
Thank you all for the replies.

Quote (excognito)

a. Put all of the arrays in an Area and collapse it to hide the definitions.
This is what i was doing until now, but the parameters never change.

As for option b), i'm currently experimenting with CSV files, and what i've learned is that i would need to define a csv for each class (not a problem), however excel or csv, i seem to have the same problem.
I can't figure out how to tell the dropdown when i select a class to return a row from that matrix/table/specific csv.After that i can manage. :)

Thank you all again for you're help.

Dan

RE: ListBox with multiple parameters

If the parameters never change, then you're probably best off leaving them in the worksheet and making a Template of your "minimal" worksheet.

Your listbox should return an integer. In which case the easiest way in M14 to get a row from an array is to transpose it and use the column operator. Alternatively, use the submatrix function, eg if k is your index and the parameters are in array P, then submatrix(P,k,k,0,cols(P)-1) will return row k (assuming your using 0 as your array index base, drop the -1 if you're using base 1)

RE: ListBox with multiple parameters

Not really clear that you're trying to do, but you can do something like:

TTFN
FAQ731-376: Eng-Tips.com Forum Policies
[IMG http://tinyurl.com/7ofakss]
Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers


Of course I can. I can do anything. I can do absolutely anything. I'm an expert!
There is a homework forum hosted by engineering.com: http://www.engineering.com/AskForum/aff/32.aspx

RE: ListBox with multiple parameters

(OP)
Thank you both,
I've managed to achieve my goal.

RE: ListBox with multiple parameters

How?? So others can learn from your problem.

Jim

RE: ListBox with multiple parameters

(OP)
Well,after some thought weather it's worth a more complicated solution at this moment, i've chosen to do exactly how IRstuff has shown.
Basically , every column represents a class with it's coresponding parameters. This is enclosed in a region i hide.
Edited the script for the ListBox just so i can add as many classes as i need.Didn't even bother with the fact that it will start showing results from the second row, since matrix col/row numbering starts from 0 in mathcad.I added an empty row for that. Since it's hidden, it doesn't have to be pretty, it just has to work.
call out the selected column (ctrl+6) and that's it.

I literally just gave a written explanation on what he shown with that example.

This was the best solution for me at the moment.

Thanks again to both of you for you're help.

Dan

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close