OCCT icon indicating copy to clipboard operation
OCCT copied to clipboard

STEP import fails if cascade unit it set to M

Open martin-bernhard opened this issue 6 months ago • 1 comments

Description

multi_solids.zip

When trying to import the attached STEP file in OCCT 7.9.0 with "xstep.cascade.unit" set to "M" (metre), the imported shape results in infinite geometry.
If I set the "xstep.cascade.unit" to "MM", the geometry gets correctly imported.

Here are 2 screenshots of the bad imported geometry and the expected result:

Image

Image

Expected Behavior

Independent of the "xstep.cascade.unit", OCCT should correctly import the geometry from the given STEP file.

Actually, it is only working with the following units for the provided STEP file:

  • INCH - inch
  • MIL - milliinch
  • UIN - microinch
  • CM - centimetre
  • MM - millimetre
  • UM - micrometre

Actual Behavior

see my comments above

Sample Code or DRAW Tcl Script

pload ALL

param xstep.cascade.unit MM
ReadStep D [locate_data_file multi_solids.stp]
# File STEP to read : /home/bernhard/Shared/bos/45226_step_import_cm/multi_solids.stp
# Document saved with name D
XGetOneShape a D
vinit
vdisplay a
vfit
bounding a -dump
# Axes-aligned bounding box
# X-range: -31.975459667726181 101.93416041481758
# Y-range: -79.027293612043579 43.863713731452073
# Z-range: -16.554082429459584 35.138490205886491

param xstep.cascade.unit M
ReadStep E [locate_data_file multi_solids.stp]
# File STEP to read : /home/bernhard/Shared/bos/45226_step_import_cm/multi_solids.stp
# Document saved with name E
XGetOneShape b E
vinit
vdisplay b
vfit
bounding b -dump
# Axes-aligned bounding box
# X-range: -1e+100 1e+100
# Y-range: -1e+100 1e+100
# Z-range: -1e+100 1e+100
# Finite part
# X-range: -0.02003913202440074 0.089799471907124742
# Y-range: -0.07902451695281075 0.043860937072219226
# Z-range: -0.014049934531451954 0.021795381331441693

Operating System

Linux

Compiler

GCC

Bitness

64-bit

OCCT Version

7.9.0

Additional Files

No response

martin-bernhard avatar May 06 '25 19:05 martin-bernhard

Are there any news on that topic? Can you reproduce the workflow? Let me know, whether you need additional information.

martin-bernhard avatar May 23 '25 09:05 martin-bernhard

No information is required. The import with different units is usually not so stable. Thank you for the report. The patch will be planned as a ongoing R&D activity. If no header will be updated, version can be 7.9.2

dpasukhi avatar Jun 27 '25 20:06 dpasukhi

Hello,

I've found out the reason of this issue and possible fix.

The attached step file has a lot of vectors with small magnitude:

#3975=VECTOR('',#4500,1.0E-06);

Converted from centimeters to meters, it becomes less than Precision::Confusion(), that is why Line creation fails:

Handle(Geom_Line) StepToGeom::MakeLine(...) { ... if (D->Vec().SquareMagnitude() < Precision::Confusion() * Precision::Confusion()) return 0;

I propose to comment out this check of vector magnitude. Our tests show good result in this case and no regressions. But I haven't run OCCT tests.

Please note also, that there is no vector magnitude check in neighbor method StepToGeom::MakeLine2d.

julia-dorovskikh avatar Nov 17 '25 17:11 julia-dorovskikh