cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Mathcad Prime 7.0 Combo Box doesn't support unit with exponents?

brandesm
5-Regular Member

Mathcad Prime 7.0 Combo Box doesn't support unit with exponents?

Does Mathcad Prime 7.0's Combo Box support units with exponents?  I am trying to enter steel properties in and when I type in^4 and in^3 that is exactly how it looks instead of in⁴ or in³.

 

brandesm_0-1615506216677.png

 

22 REPLIES 22

No, the combo box does not support units at all.  (Why would you ever need units?)

The built-in table in Prime is better.

Fred_Kohlhepp_0-1615552800088.png

 

Not sure that I understand. Here is the example from  Prime 7 help.

rgunwaldsen_0-1615556135860.png

I would think the place to put the exponent would be in the data, not the units?

LucMeekes
23-Emerald III
(To:rgunwaldsen)

But would it accept square metres as a unit?

(Combo-box is a Premium feature, not accessible in Express)

 

Luc

Maybe limited to SI Base units.

 

By the way, like Fred, I also like tables.

LucMeekes
23-Emerald III
(To:rgunwaldsen)

Stupid limitation.

I wonder if this is another 3rd party add-on; just like the plot component: badly integrated.

 

Luc

Who knows...

 

The combo seems to me to be a convenient way to simultaneously select a set of parameters.

 

Of course there are many ways to accomplish this.

Maybe set up a table (with units) and use a combo box to select the table row.  The table carries the unit definitions.

Not possible to return the indice from the combo box though I suppose it could be a variable. But how to populate the combo box when there are several hundred rows to fill. I use a script function to strip the first column of data to populate a dropdown list from which the indice is returned and hence the data from the table may be extracted.

A work around:

Fred_Kohlhepp_0-1615565481518.png

 

Have not downloaded P7 so i can't try myself.

Which unit do you get as finial result for the variables, if you put in^4 or the like in the box as was shown in the initial post? From the pic it looked like the in^4 are still labelled as unit and the OP did nor mention any error message he got, so I assumed it was just the ugly display he was moaning about.

brandesm
5-Regular Member
(To:Werner_E)

No, it creates an error.

brandesm_0-1615568475946.png

If I leave off the exponent and enter it as a straight length, it works fine.  So it is recognizing the in^4 as a unit, but it's not recognizing the ^4 as an actual exponent.  If I didn't have any error messages, I wouldn't have to come here looking for a solution.

LucMeekes
23-Emerald III
(To:brandesm)

Well, coming here is one thing...

You should report this serious bug to PTC.

 

Success!
Luc

I opened PTC  case    C15793488 with   attached screen shot of Fred's work around which seems to be an excellent characterization of the problem. 

 

rgunwaldsen_0-1615571856498.png

 

brandesm
5-Regular Member
(To:rgunwaldsen)

Thanks, I also logged a case with the support assistant as well.  Just wondering if anybody else had the same issue or if I was doing something wrong.

Nicholas
4-Participant
(To:rgunwaldsen)

I tried the same method (3 values of the spring constant depending on 3 different materials) but failed.

Nicholas_1-1615977067620.png

 

It looks like "unt" is not declared a unit label in your version.  

Fred_Kohlhepp_0-1615981056277.png

Try forcing it:

Fred_Kohlhepp_1-1615981139332.png

 

 

Thanks. By defining unt as a unit thru Labels is was accepted and worked.

Thanks again.

RantEng
14-Alexandrite
(To:brandesm)

This oversight is a problem.  I made a work around.  I defined temporary units hidden in a collapsed area.

RantEng_0-1618424274818.png

These units are equivalent, will work, and are never seen.

 

Bob

JeffH1
16-Pearl
(To:RantEng)

So I've played around with this quite a bit now.  The thing to remember is that this component is dumb.  It works, but it's dumb.  It has no idea that it lives inside a Mathcad Prime document.

 

  1. Unit expressions are just text strings that attempt to get translated to a unit.  The "string" can have no math in it, so units like (m/s), (Pa*s), (BTU/lb/ft²) will not work unless you define those "strings" as units.  (By the way, you can get a square (²) by typing double quotes, entering the expression using <Alt>0178 to get the ² symbol and then deleting one of the quotes.)

  2. Interestingly, using the double-quote method in 1, you can also enter affine temperature units, °F & °C, using <Alt>0176 for the ° symbol and these units are already defined.
     
  3. The values for the choices are similarly just text strings that get translated to numeric values.  They can also contain no math.  Unfortunately, the translation to a numeric value also does not understand any form of exponential notation.  So, you can't enter a value of 5.6E-6, but have to enter 0.0000056 as the value.  Like I said...

If you understand all this going in, it is quite functional and you can hide your "string" unit definitions in a collapsible area or keep commonly used "string" units in another worksheet that can be referenced before the Combo box (or after if you define them globally).  It also allow you to hide the assignment expression/matrix, which is a throwback to legacy behavior and makes a very clean combo box.  You can also use Math Formatting to shade the text and background color.

 

It's not ideal and in desperate need of a better translator for the units and values, but it is functional.  I've attached a Prime 7.0 file with examples for making the "unit" strings more readable.

RantEng
14-Alexandrite
(To:JeffH1)

Wow!  You just gave me the hint on how to type math characters that I couldn't type before:  For example y-bar: a y with a horizontal bar over it:

RantEng_0-1620324605861.png

I had to cheat here.  Open MS Word and type the letter and the ascii code.  In this case y0304.  Then Alt-x that puts character 0304 over the y.  Now  your trick with the quotes and paste this between the quotes.  Now delete the quote.

 

Bob

JeffH1
16-Pearl
(To:RantEng)

You can insert that character and other Combining Diacritical Marks from the Windows Character Map application.  Select Group by: Unicode Sub-Range and you can find all kinds of interesting characters to insert into your variables.

DJF
16-Pearl
16-Pearl
(To:JeffH1)

Just to expand this a bit, it appears the entire combo box is just strings.  For example, you can't enter numbers in scientific notation.  or even 10*2.

30.0*10^6 is not recognized as a number, but as text.  So in the follow-on steps you'll be using a string for math - which doesn't work.  So you need to type out 30000000.  In short, avoid all operators anywhere in the combo box(+,-,*,/,^).

 

I'd shake my head in disbelief, but ... hard to reach disbelief anymore.

Announcements

Top Tags