For improvements 20019 and 20324.

This commit is contained in:
skl 2009-06-03 07:11:35 +00:00
parent 85595cc3bf
commit dc33391ec7
5 changed files with 67 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -13,6 +13,7 @@ By the links below you can find sample scripts for all operations
provided by Geometry module. provided by Geometry module.
<ul> <ul>
<li>\subpage tui_import_export_page</li>
<li>\subpage tui_viewing_geom_objs_page</li> <li>\subpage tui_viewing_geom_objs_page</li>
<li>\subpage tui_creating_geom_objs_page</li> <li>\subpage tui_creating_geom_objs_page</li>
<ul> <ul>

View File

@ -22,6 +22,24 @@ Select the required file and click \b Open. Your file will be imported in
the module and its contents (geometrical object) will be displayed in the module and its contents (geometrical object) will be displayed in
the <b>Object Browser</b>. the <b>Object Browser</b>.
\note If type of selected file is IGES and length unit in this file is not
equal to meter following question will be offer to user:
\image html iges_unit.png
\par
If answer is <b>Yes</b> result will be scaled from file unit to meter.
\note If type of selected file is ACIS (optionally - for users with
special license) and this file contains names for some shapes
following question will be offer to user:
\image html sat_named_shapes.png
\par
If answer is <b>Yes</b> needed groups by types (solid, face, edge and
vertex) for all named shapes will be created.
\note It is possible to re-open from the initial file a previously imported shape if \note It is possible to re-open from the initial file a previously imported shape if
the file has been changed on disk. For this, select the file has been changed on disk. For this, select
<b>Reload From Disk</b> in the context menu of the imported <b>Reload From Disk</b> in the context menu of the imported
@ -43,5 +61,8 @@ the name and the location of the file for exportation.
\par \par
Click \b Save to confirm your exportation. Click \b Save to confirm your exportation.
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_import_export_page
*/ */

View File

@ -0,0 +1,45 @@
/*!
\page tui_import_export_page Import/Export
\code
import geompy
import salome
# Example of import from IGES using various formats
# get a path to SAMPLES_SRC
import os
thePath = os.getenv("DATA_DIR")
# create filenames
theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs"
theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs"
#print "thePath = ", thePath
# get units from files
UnitName1 = geompy.GetIGESUnit(theFileName1)
UnitName2 = geompy.GetIGESUnit(theFileName2)
print "UnitName1 = ", UnitName1
print "UnitName2 = ", UnitName2
# import shapes
Shape1 = geompy.ImportIGES(theFileName1)
Shape2 = geompy.ImportIGES(theFileName2)
Shape3 = geompy.Import(theFileName2,"IGES_SCALE")
[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)
geompy.addToStudy(Shape1, "3Dipsos_m")
geompy.addToStudy(Shape2, "3Dipsos_mm")
geompy.addToStudy(Shape3, "3Dipsos_mm_scaled")
d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1)
d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2)
d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3)
import math
dd32 = math.sqrt(d3/d2)
dd12 = math.sqrt(d1/d2)
dd31 = math.sqrt(d3/d1)
# values dd31, dd12 and dd31 can be using for checking
print "dd32 = ",dd32," dd12 = ",dd12," dd31 = ",dd31
\endcode
*/