Exporting STP file in inches

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
gwlund
Posts: 3
Joined: Fri Oct 11, 2019 2:50 pm

Exporting STP file in inches

Postby gwlund » Fri Oct 11, 2019 3:06 pm

Hello,

I need to export a STP file and Points file in inch units. I have both the Preferences -> Import/Export -> STEP -> Units for export of STEP -> nches and the Preferences -> General -> Units -> User System -> Imperical dcimal (in/lb). Both will export in milimeters

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16131 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 3129ae4296e40ed20e7b3d460b86e6969acbe1c3
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

File attachment link won't upload because of file size but below is a download to the STP file i'm importing.
https://leisfs.lundeng.com/link/Ii3DkVTffkUVjySamQpJHE

This part is 57.99 inches x 54.00 inches (see attached)
Part.jpg
Part.jpg (97.63 KiB) Viewed 323 times
Thanks,
openBrain
Posts: 3091
Joined: Fri Nov 09, 2018 5:38 pm

Re: Exporting STP file in inches

Postby openBrain » Fri Oct 11, 2019 4:31 pm

Hi gwlund, welcome.

Hmmm... I'm not sure it's possible. But anyway, the question is why ? :)
STL is an exchange format so there should be no inconvenience that it is exported in standard millimeters. ;)
gwlund
Posts: 3
Joined: Fri Oct 11, 2019 2:50 pm

Re: Exporting STP file in inches

Postby gwlund » Mon Oct 14, 2019 12:29 am

Since the preferences dialog for STEP export has a drop-down box for "Units for export of STEP" I would assume it worked at one point.
Annotation 2019-10-13 172217.jpg
Annotation 2019-10-13 172217.jpg (91.95 KiB) Viewed 281 times
User avatar
pl7i92LCNC
Posts: 209
Joined: Tue Mar 12, 2019 3:03 pm
Location: RLP DE

Re: Exporting STP file in inches

Postby pl7i92LCNC » Mon Oct 14, 2019 7:21 am

does it work ?
and if can you please mark this tread as solved so other users will Click your tread as first
wmayer
Site Admin
Posts: 15298
Joined: Thu Feb 19, 2009 10:32 am

Re: Exporting STP file in inches

Postby wmayer » Mon Oct 14, 2019 8:03 am

What format do you mean when talking about "Points file"?

The settings Preferences -> General -> Units -> User System -> Imperial decimal (in/lb) only affects the graphical user interface and doesn't control any import or export. Independent of what unit you choose the internal unit for length in FreeCAD is always in mm.
I have both the Preferences -> Import/Export -> STEP -> Units for export of STEP -> Inches
I did the following test.
  1. Create a standard box in Part wb
  2. Set export unit of STEP to mm and save the box to a step file box_mm.step
  3. Set export unit of STEP to in and save the box to a step file box_in.step
  4. Open the two files in a text editor or a diff tool to see the changes
The file box_mm.step has these lines:

Code: Select all

#346 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#347 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#348 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
The file box_in.step has these lines:

Code: Select all

#346 = ( CONVERSION_BASED_UNIT('INCH',#348) LENGTH_UNIT() NAMED_UNIT(
  #347) );
#347 = DIMENSIONAL_EXPONENTS(1.,0.,0.,0.,0.,0.,0.);
#348 = LENGTH_MEASURE_WITH_UNIT(25.4,#349);
#349 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#350 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#351 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
From the latter file you can see that units are based in inch and it also contains the conversion factor to later compute the coordinates in mm.
Now when you search for the CARTESIAN_POINT entities you can easily see that they are converted in inch.


Tested with:
OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17696 (Git)
Build type: Release
Branch: master
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
gwlund
Posts: 3
Joined: Fri Oct 11, 2019 2:50 pm

Re: Exporting STP file in inches

Postby gwlund » Thu Oct 24, 2019 9:15 pm

Thanks for the response. Interesting to see your results when exporting a natively drawn part. My problem manifests when first importing a STP file (link in the original post) which is in mm (SI units) and then trying to export it to at STP file in inches (Imperial units).

Not sure why it wouldn't work just like your test but it does not.

The output STP does not have any reference to INCH units like you show in your example

Code: Select all

#42017 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#42018 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#42019 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#42020 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#42017,
  'distance_accuracy_value','confusion accuracy');
When exporting as Points I mean using the Points WB to export to an ASCII points file. It also is hard-coded to use mm apparently.
Annotation 2019-10-24 141241.jpg
Annotation 2019-10-24 141241.jpg (150.67 KiB) Viewed 183 times