Need help/info for CAD units to use ?

Everything else that doesn't fall into one of the other PB categories.
marc_256
Addict
Addict
Posts: 862
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Need help/info for CAD units to use ?

Post by marc_256 »

Hi everyone,

I need some help/info for use of CAD units...
I'm on the step of writing the procedure to store the CAD data on HD.
I will need to use metric and inch units.
For that i like to use a storing/project unit.
NO mm, NO inch but something like 0.001 mm as unit to store all measurements.

I found TWIPS but this is something for screen units...

Q) Is there an other unit to use ?

Thanks,
Marc,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
skywalk
Addict
Addict
Posts: 4318
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Need help/info for CAD units to use ?

Post by skywalk »

Not sure of all your requirements or design?
Can you not consider an integer scheme using quads for all your individual models and their relative vertices?
Do not use floats for internal storage. Only to display to user or for math calculations for mechanical design rule checks.
So the units your system uses is up to you.
If the user chooses a different unit, you simply convert the display, not the internal database.
Scale your smallest increment to an integer but report the real float values to the user.

0.05 in x 100 scale factor = 5 internal units
0.5 mm x 1000 scale factor = 500 internal units

This depends of course whether you are drawing small objects or city blocks. :wink:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Need help/info for CAD units to use ?

Post by Tenaja »

marc_256 wrote:NO mm, NO inch but something like 0.001 mm as unit to store all measurements.
Marc,
I use CAD regularly. You can tell which packages do not store your dimensions in your native unit when you scale the drawings. I run from those LIKE THE PLAGUE. Many of my features can be smaller than .01" (.254mm), and have successfully made some with .002" (.0508mm) features. I subscribe to some trade journals that contain articles making my designs seem large. If you scale anything in your software, you severely limit its capabilities.

ONLY store the dimensions in the unit of measure that the USER chooses. If they decide to scale it later, say 100x, they will not suddenly be surprised by "unexpected" sizes due to the programmer taking a shortcut. If they choose to scale it by 25.4 (up or down), then they can safely expect some rounding, but that should NEVER be seen.
User avatar
skywalk
Addict
Addict
Posts: 4318
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Need help/info for CAD units to use ?

Post by skywalk »

As I mentioned, if you are drawing or dealing with geometries in nanometers, then placing them somewhere on the planet is not going to be very accurate without scaling.
Before a user begins a design in a CAD package, they must be mindful of their extents.
Designing semiconductor chips in feet or kilometers would seem silly, don't you think :?:
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
marc_256
Addict
Addict
Posts: 862
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Need help/info for CAD units to use ?

Post by marc_256 »

Hey, thanks,

Thats what I want to do,
Store all the data in let say MyUnits who are equal to 0.0001 mm
and store all the data in .i values.

Example:
Object is 210.5 mm width the stored value is than 2105000 as .i value
So I can easily scale them <> than.

The user can then make is own selection to visualize it for him on the screen in mm or inches...
metric or imperial units.

But my question was more if there is a standard MyUnit value who is used worldwide ?
Maybe 0.0001 mm is not high enough.
and 0.000 01 mm is better as MyUnit.

Marc,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
User avatar
skywalk
Addict
Addict
Posts: 4318
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Need help/info for CAD units to use ?

Post by skywalk »

The internal units you use depends on the physical limitations of your output.
If you are driving a CNC machine that uses only english tools, then mils or inches would provide better accuracy than mm or cm.
One of the reasons many companies could not just adopt metric units willy nilly was the cost burden of acquiring all new tooling.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
rgs
New User
New User
Posts: 1
Joined: Sat Nov 12, 2011 10:01 am

Re: Need help/info for CAD units to use ?

Post by rgs »

IIRC .dxf CAD files store units as they are entered at the keyboard. Maybe the CAD application converts them to integers internally before it works with them. Maybe you could find the smallest unit in the drawing, calculate a number to multiply it by that will convert it to an integer, and then internally multiply all units by that when the drawing is opened.

You could also have a look at the BRL-CAD (http://brlcad.org) source code and see how they do it, or ask on their forums.
Post Reply