Home

Units

by John_S Spatial Employee on 09-09-2007 09:08 PM

I got an e-mail question a while back: “Does the ACIS Modeler work in Nano?”

After making sure that the sender was asking if ACIS can handle models at typical nanotechnology length scales, I sent back the following response:

Yes, you can choose “1.0” unit in ACIS to be whatever distance you want it to be.  So a block of size “1.0” in a nano app could be defined to be 10 nanometers on a side.

This answer might seem pretty obvious, but every so often I get a similar question from a customer who’s confused about how units work in ACIS.  And this confusion sometimes leads the customer to implement units in their application in a way that makes it much harder to deal with changing units between models. 

The way to navigate through this confusion is to always remember the following tautology: a length or distance always has units of length.  In other words, there’s no such thing as an edge of length “1.0” – it’s really an edge of length “1.0 model units”.  These model units can then be converted into “interface units” (the units used in the user interface), which might, for example, be mm, cm, or inches.  The right way to manage this conversion in your application is to have a variable for each model that holds the conversion factor “X interface units / 1 model unit” and apply it to queries of and inputs to the model, rather than by hard-wiring your application to a particular choice such as 1 model unit = 1mm.

Here’s a trick question that goes to the heart of this point: If I hand you two SAT files, one containing a cube of size 1.0 and the other containing a cube of size 10.0, are the cubes of the same size?  The correct answer is “I don’t know – you didn’t give me enough information about the SAT files”.  The reason is that “1.0” and “10.0” are lengths expressed in “model units”, which can be different from model to model.  Every SAT file also contains a field that tells how many mm correspond to 1 model unit; if I had told you that this value was 10.0 in the first file and 1.0 in the second then the answer would have been “yes”, since both cubes would be 10mm on a side.  If your application holds a similar variable for each model which converts between model units and interface units, then you can read both files in without any rescaling – the first model’s conversion factor will simply be 10 times as big as the second’s. 

For example, considers applications A and B.  Both of them use interface units of mm.  Application A is written so that 1 modeler unit is always 1mm, while application B is written so that 1 modeler unit is X mm, where X is a variable that is associated with the model.  This is a bit more work for application B, since every query that returns a length needs to be multiplied by X, every query that returns a volume needs an X^2, and so on, while construction inputs such as extrusion distances will need to be divided by the appropriate power of X.  The advantage of application B shows up when reading the first SAT file.  In application B, X is merely set to 10.  In application A, however, the model needs to be rescaled by a factor of 10.  This is important because, given a choice between rescaling a model or not rescaling a model, not rescaling the model is better.  This is because rescaling transformations should ALWAYS be fixed (ACIS is VERY non-robust against unfixed BODY transforms), which means that the actual geometry of the model is rescaled, which in turn runs the risk of kicking some geometric corner case over the edge of stability of some algorithm.

Application B also has an advantage if the Product Managers decide to enhance the interface to allow, for example, interface units of mm, cm, m, and inches.  This is trivial to code up in application B – only the code that sets X needs to be changed.  In application A, however, the conversion factor work that was done upfront in B will need to be done, but it is likely that the conversion factors will be fixed to 1 modeler unit = 1 mm.  Since figuring out which queries/inputs need what power of X is the hard part of coding up application B, it doesn’t make a lot of sense to hard-wire model units to a particular, physical value.

Note that even application B can’t avoid all rescalings of models.  If you want to perform operations (such as a Boolean) between two bodies that are in different units, one of the two will have to be rescaled (or copied and rescaled).  

So the message for today is “write your application so that the model units of each model can be adjusted independently and independent of interface units”.  That’s not the whole story though – we still haven’t talked about resabs!!

 

Comments
by mbusha on 11-28-2007 10:53 AM
 
by mbusha on 11-28-2007 10:59 AM - last edited on 11-28-2007 11:01 AM
OK, without the trick question. Our software uses ACIS. Is there (in english) an inch/mm tag in a .sat file? I think I understand that there is not, and it's the application that should determine the unit displayed. However, I have an ACIS model that if brought into our software while the setting is inch it's unusable. When the application is in metric, everything is fine. If it's simply CAD unit's, should this not work?

Message Edited by mbusha on 11-28-2007 11:01 AM
by John_S Spatial Employee on 12-02-2007 06:08 PM
There's a numerical field in the .sat file (it's part of the header information) that is the number of model units per mm. If the field is "1.0", then you're model is in mm. If it's "25.4", then it's in inches. If it's "10.0", then it's in cm. I'm not sure if this is what you mean by a "tag".

And you're right - it's the application's responsibility to look at this field and do the appropriate rescalings (either of dimensionful values that appear of the interface or of the model itself, as discussed in the post) between model units and the units the application is presenting to the end user.

I'm a little confused by what you mean by "the setting" in your application - is this the units which you're presenting to your end user? I'm also not sure what you mean by "unusable" - I would expect that if there were a problem with units it would simply show up as the model looking too big (e.g. it was written out to be a cube that is 1 mm on a side but appears to be 1 inch on a side in your app).

Thanks for the question!
John