Reporting Model Unit Information in a Repeat Region...
<<Taken from an email to a user... reformatted as a document to distribute to the wider user community.>>
One common complaint among designers is that there is currently no simple parameter to access model units in a repeat region.
We don't have access to a parameter that reports IPS, Pro/E Default, mmks, or other units. It just doesn't exist.
Some people mistakenly try to pull the units from &ptc_material_units... but this is dangerous and does not work. That parameter only gives you the units of your current material file. You could be in a metric part using a material file written in English/Imperial units. The material units will automatically convert themselves to metric... but the value of &ptc_material_units will actually report IMPERIAL. &ptc_material_units only reports the unit of measure the material file was created in... it doesn't care what the units of the actual model are.
Without using J-Link or other tricks, there's no great way to get the units in one parameter. However, since WF2 there is a way you can tell Pro/E to consider units in relations. By exploiting this feature, you can easily extract units information from your model. You can extract the following UNITS:
Note that you can certainly also get the actual VALUES of any of these mass properties... but we're going to use them to grab the UNITS.
One of the parameters available in your repeat region is &mbr.ptc_unit.<user_defined> . When added to your repeat region, this gives you the UNIT of measure associated to your <user defined> parameter if and only if you have unit sensitivity turned on.
To turn on unit sensitivity, go into Tools->Relations and select the Utilities menu from the Relations tool. Select Units Sensitive from the drop-down. As shown below...
Once this option is activated, any new relation can retain optional units information. Old relations are not affected. Most of the time you'd use this feature to specify a dimension with units. For example d1 = 5 * 6[mm]. In this case, d1 would be set to 30mm. Later, if the model units were changed from metric to English, that "6[mm]" would be converted to "152.4[inch]" automatically. We're not going to use the feature this way.
Since you MUST have a new relation to pick up the units and we don't really want to specify dimensions as in the previous example, we're just going to make a few new mass properties parameters. We'll set the values of our new "user defined" parameters to be equivalent to system mass properties parameters that already exist.
mass = pro_mp_mass
density = pro_mp_density
length = pro_mp_cogx
By setting those 3 relations above, we create 3 new user-defined parameters called mass, density, and length.However we're not really interested in the VALUES of those parameters. We've only set them so we can ask Pro/E what the UNITS of those parameters are. This is the only way to get the units information.
If we wanted the mass or density, we could just look at pro_mp_mass or pro_mp_density. There are about a dozen other parameters like this for every model as shown in the image below. Select "Reported Mass Properties" from the drop-down (circled) to see the standard mass properties values for any model. Notice there's a column labeled UNITS (blue rectangle) but we can't see any of those units in our repeat region. Why? Because these system parameters already existed before we turned on the Units Sensitive option. Click the image below for a larger representation.
Notice in the upper half of the window, you'll see the 3 relations I mentioned earlier.
Now that we've set these 3 relations, we'll be able to pull units parameters from them in our BOM or other repeat region. We'd use the following repeat region parameters to grab the units:
For &mbr.ptc_unit.mass we'd see "kg"
For &mbr.ptc_unit.density we'd see "km/mm^3"
For &mbr.ptc_unit.cogx we'd see "mm"
We're using pro_mp_cogx because that will give us a center of gravity measurement in length units which happen to be mm in this case.
Using this technique, we can grab any of the units in the blue rectangle. So although we can't get the name of the system of units (like Pro/E Default, IPS, or mmks), we can get the currently active units for our model using this clever relations trick.
You'll need to activate Units Sensitive for all your models then add (or copy/paste) the relations above (or create your own). Once you do this, you can use the report parameters above (or your own) to pull units data into your BOM.
If you need to apply these settings to many, many models, there are a few ways to do this. You can try using ModelCheck to set the Units Sensitive switch and add the relations. You could also make a trail file script to open each model, turn on the switch, add the relations, and save the file. T
To prevent having to modify your models to incorporate these features In the future, you can turn on the switch and add the relations to the Post Regeneration section in your start parts. Once this is done, all future parts will have units data available with no added hassle.