if (theTessellatedGeomParam == 1 || (theTessellatedGeomParam == 2 && myResult.IsNull()))
{
- TopoDSToStep_MakeTessellatedItem MkTessShell(myShell, myTool, FP, aPS.Next());
+ TopoDSToStep_MakeTessellatedItem MkTessShell(myShell,
+ myTool,
+ FP,
+ theLocalFactors,
+ aPS.Next());
if (MkTessShell.IsDone())
{
myTessellatedResult = MkTessShell.Value();
Message_ProgressScope aPS(theProgress, NULL, 1);
// fourth parameter is true in order to create a tessellated_surface_set entity
// or put false to create a triangulated_face instead
- MkTessFace.Init(Face, myTool, FP, Standard_True, aPS.Next());
+ MkTessFace.Init(Face, myTool, FP, Standard_True, theLocalFactors, aPS.Next());
}
if (MkFace.IsDone() || MkTessFace.IsDone())
#include <MoniTool_DataMapOfShapeTransient.hxx>
#include <Poly.hxx>
#include <StdFail_NotDone.hxx>
+#include <StepData_Factors.hxx>
#include <StepVisual_FaceOrSurface.hxx>
#include <StepShape_TopologicalRepresentationItem.hxx>
#include <StepVisual_TessellatedShell.hxx>
Handle(TColgp_HArray1OfXYZ)& thePoints,
Handle(TColStd_HArray2OfReal)& theNormals,
Handle(TColStd_HArray1OfInteger)& theIndices,
- Handle(TColStd_HArray2OfInteger)& theTrias)
+ Handle(TColStd_HArray2OfInteger)& theTrias,
+ const StepData_Factors& theLocalFactors)
{
+ Standard_Real aFactor = theLocalFactors.LengthFactor();
for (Standard_Integer aNodeIndex = 1; aNodeIndex <= theMesh->NbNodes(); ++aNodeIndex)
{
- thePoints->SetValue(aNodeIndex, theMesh->Node(aNodeIndex).XYZ());
+ thePoints->SetValue(aNodeIndex, theMesh->Node(aNodeIndex).XYZ() / aFactor);
}
theCoordinates->Init(theName, thePoints);
if (!theMesh->HasNormals())
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
const Standard_Boolean theToPreferSurfaceSet,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress)
: TopoDSToStep_Root()
{
- Init(theFace, theTool, theFP, theToPreferSurfaceSet, theProgress);
+ Init(theFace, theTool, theFP, theToPreferSurfaceSet, theLocalFactors, theProgress);
}
//=================================================================================================
const TopoDS_Shell& theShell,
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress)
: TopoDSToStep_Root()
{
- Init(theShell, theTool, theFP, theProgress);
+ Init(theShell, theTool, theFP, theLocalFactors, theProgress);
}
//=============================================================================
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
const Standard_Boolean theToPreferSurfaceSet,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress)
{
done = Standard_False;
Handle(TColStd_HArray1OfInteger) anIndices = new TColStd_HArray1OfInteger(1, aMesh->NbNodes());
Handle(TColStd_HArray2OfInteger) aTrias =
new TColStd_HArray2OfInteger(1, aMesh->NbTriangles(), 1, 3);
- InitTriangulation(aMesh, aName, aCoordinates, aPoints, aNormals, anIndices, aTrias);
+ InitTriangulation(aMesh,
+ aName,
+ aCoordinates,
+ aPoints,
+ aNormals,
+ anIndices,
+ aTrias,
+ theLocalFactors);
const Standard_Boolean aHasGeomLink = theTool.IsBound(theFace);
StepVisual_FaceOrSurface aGeomLink;
void TopoDSToStep_MakeTessellatedItem::Init(const TopoDS_Shell& theShell,
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress)
{
done = Standard_False;
for (anExp.Init(theShell, TopAbs_FACE); anExp.More() && aPS.More(); anExp.Next(), aPS.Next())
{
const TopoDS_Face aFace = TopoDS::Face(anExp.Current());
- TopoDSToStep_MakeTessellatedItem aMakeFace(aFace, theTool, theFP, Standard_False, aPS.Next());
+ TopoDSToStep_MakeTessellatedItem aMakeFace(aFace,
+ theTool,
+ theFP,
+ Standard_False,
+ theLocalFactors,
+ aPS.Next());
if (aMakeFace.IsDone())
{
aTessFaces.Append(Handle(StepVisual_TessellatedStructuredItem)::DownCast(aMakeFace.Value()));
#include <TopoDSToStep_Root.hxx>
#include <Message_ProgressRange.hxx>
+class StepData_Factors;
class StepVisual_TessellatedItem;
class TopoDS_Face;
class TopoDS_Shell;
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
const Standard_Boolean theToPreferSurfaceSet,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT TopoDSToStep_MakeTessellatedItem(
const TopoDS_Shell& theShell,
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init(const TopoDS_Face& theFace,
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
const Standard_Boolean theToPreferSurfaceSet,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Init(const TopoDS_Shell& theShell,
TopoDSToStep_Tool& theTool,
const Handle(Transfer_FinderProcess)& theFP,
+ const StepData_Factors& theLocalFactors,
const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT const Handle(StepVisual_TessellatedItem)& Value() const;
--- /dev/null
+puts "================================================"
+puts "OCP-1949: Apply a scaling transformation to STEP"
+puts "================================================"
+puts ""
+
+pload OCAF
+
+Close D1 -silent
+Close D2 -silent
+
+# Create simple mesh
+box b 1 1 1
+incmesh b 1
+writestl b "$imagedir/${casename}.stl"
+readstl b "$imagedir/${casename}.stl"
+
+# Create document with meters as internal units
+XNewDoc D1
+XSetLengthUnit D1 m
+XAddShape D1 b
+
+# apply parameters for tessellation export
+set conf "
+provider.STEP.OCC.write.schema : 5
+provider.STEP.OCC.write.tessellated : 1
+"
+
+WriteFile D1 "$imagedir/${casename}.stp" -conf ${conf}
+ReadFile D2 "$imagedir/${casename}.stp"
+
+XGetOneShape a1 D1
+XGetOneShape a2 D2
+
+# check sizes
+set m_diag [eval distpp [bounding a1]]
+set mm_diag [eval distpp [bounding a2]]
+set tol 0.1
+
+if {([expr abs($m_diag * 1000 - $mm_diag)] > $tol)} {
+ puts "Error: wrong size of models."
+ }
+
+# cleaning
+Close D1
+Close D2
+file delete "$imagedir/${casename}.stp"
+file delete "$imagedir/${casename}.stl"
+