Personal tools
You are here: Home Forum Use Scale of STEP import

Scale of STEP import

Up to Use

Scale of STEP import

Posted by JMB at August 07. 2010

According to help:

Help on method Import in module salome:

Import(self, theFileName, theFormatName) method of salome.geompyDC instance
    ## Import a shape from the BREP or IGES or STEP file
    #  (depends on given format) with given name.
    #  @param theFileName The file, containing the shape.
    #  @param theFormatName Specify format for the file reading.
    #         Available formats can be obtained with InsertOp.ImportTranslators() method.
    #         If format 'IGES_SCALE' is used instead 'IGES' length unit will be
    #         set to 'meter' and result model will be scaled.
    #  @return New GEOM_Object, containing the imported shape.
    #  @ref swig_Import_Export "Example"

IGES seems to have a parameter one can use to adjust the units to [m].  In the more recent versions of Salome a STEP file import seems to require a scale x1000 operation in order to import models that are created in [mm].  Is there a similar feature such as STEP_SCALE that is not documented.  Or was this never implemented in the code?



Re: Scale of STEP import

Posted by JMB at August 25. 2010


Anybody in the development group who can comment on this please?



Re: Scale of STEP import

Posted by Edward AGAPOV at August 26. 2010

Hello JMB


Currently in Salome there is no a feature similar to IGES_SCALE "format" to scale STEP models.


Best regards


Re: Scale of STEP import

Posted by Ulrich Leiseder at April 01. 2015


Hello JMB and Edward,


ich wrote a function to set the unite from default (meter) to mm after the export (here to test.step). You may edit the STEP-file manually, too.


Feel free to re-write my "first time python code".


Best regards





import shutil

filen = test.step'

def step_to_mm( filen ):

    """Replaces the SI_UNIT "m" to "mm" in a STEP-file - use the full pathname!


    step_m_str = "= ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT($,.METRE.) );"

    step_mm_str = step_m_str.replace( "$", ".MILLI.")

    i = 0

    with file( filen, "rU" ) as source:

        sinkn = filen+"_mm"

        with file( sinkn, "w" ) as sink:   

            for line in source: 

                i += 1

                new_l = line.replace( step_m_str, step_mm_str )

                if step_mm_str in  new_l:

                    print "Replaced unite at line no ", i

                sink.write( new_l ) 

    #shutil.move( sinkn, filen )   # uncomment to overwrite/replace the original file



Re: Scale of STEP import

Posted by sheaker at November 26. 2018
Just FYI. The best way to change scale in step file before importing is to open step file with notepad++ and change "LENGTH_MEASURE_WITH_UNIT( LENGTH_MEASURE( 1.00000000000000 )" to "LENGTH_MEASURE_WITH_UNIT( LENGTH_MEASURE( 1000.00000000000 )". Sheaker
Powered by Ploneboard
Document Actions