1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
FtpSantos
f830959be3 0033736: Shape Healing - Recursively update ShapeBuild_ReShape in ShapeCustom::ApplyModifier
Passed ShapeBuild_ReShape to recursive call to retrieve complete change history
2024-08-08 16:01:25 +01:00
12 changed files with 123 additions and 1111 deletions

View File

@@ -1,492 +0,0 @@
// Copyright (c) 2024 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <DE_ShapeFixConfigurationNode.hxx>
#include <DE_ConfigurationContext.hxx>
#include <DE_PluginHolder.hxx>
#include <DE_Wrapper.hxx>
IMPLEMENT_STANDARD_RTTIEXT(DE_ShapeFixConfigurationNode, DE_ConfigurationNode)
namespace
{
static const TCollection_AsciiString& THE_CONFIGURATION_SCOPE()
{
static const TCollection_AsciiString aScope = "provider";
return aScope;
}
}
//=======================================================================
// function : DE_ShapeFixConfigurationNode
// purpose :
//=======================================================================
DE_ShapeFixConfigurationNode::DE_ShapeFixConfigurationNode()
: DE_ConfigurationNode()
{}
//=======================================================================
// function : DE_ShapeFixConfigurationNode
// purpose :
//=======================================================================
DE_ShapeFixConfigurationNode::DE_ShapeFixConfigurationNode(const Handle(DE_ShapeFixConfigurationNode)& theNode)
: DE_ConfigurationNode(theNode)
{
}
//=======================================================================
// function : Load
// purpose :
//=======================================================================
bool DE_ShapeFixConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theResource)
{
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
HealingParameters.Tolerance3d = theResource->RealVal("tolerance3d", HealingParameters.Tolerance3d, aScope);
HealingParameters.MaxTolerance3d = theResource->RealVal("max.tolerance3d", HealingParameters.MaxTolerance3d, aScope);
HealingParameters.MinTolerance3d = theResource->RealVal("min.tolerance3d", HealingParameters.MinTolerance3d, aScope);
HealingParameters.FixFreeShellMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("free.shell", (int)HealingParameters.FixFreeShellMode, aScope);
HealingParameters.FixFreeFaceMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("free.face", (int)HealingParameters.FixFreeFaceMode, aScope);
HealingParameters.FixFreeWireMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("free.wire", (int)HealingParameters.FixFreeWireMode, aScope);
HealingParameters.FixSameParameterMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("same.parameter", (int)HealingParameters.FixSameParameterMode, aScope);
HealingParameters.FixSolidMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("solid", (int)HealingParameters.FixSolidMode, aScope);
HealingParameters.FixShellOrientationMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("shell.orientation", (int)HealingParameters.FixShellOrientationMode, aScope);
HealingParameters.CreateOpenSolidMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("create.open.solid", (int)HealingParameters.CreateOpenSolidMode, aScope);
HealingParameters.FixShellMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("shell", (int)HealingParameters.FixShellMode, aScope);
HealingParameters.FixFaceOrientationMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("face.orientation", (int)HealingParameters.FixFaceOrientationMode, aScope);
HealingParameters.FixFaceMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("face", (int)HealingParameters.FixFaceMode, aScope);
HealingParameters.FixWireMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("wire", (int)HealingParameters.FixWireMode, aScope);
HealingParameters.FixOrientationMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("orientation", (int)HealingParameters.FixOrientationMode, aScope);
HealingParameters.FixAddNaturalBoundMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("add.natural.bound", (int)HealingParameters.FixAddNaturalBoundMode, aScope);
HealingParameters.FixMissingSeamMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("missing.seam", (int)HealingParameters.FixMissingSeamMode, aScope);
HealingParameters.FixSmallAreaWireMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("small.area.wire", (int)HealingParameters.FixSmallAreaWireMode, aScope);
HealingParameters.RemoveSmallAreaFaceMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("remove.small.area.face", (int)HealingParameters.RemoveSmallAreaFaceMode, aScope);
HealingParameters.FixIntersectingWiresMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("intersecting.wires", (int)HealingParameters.FixIntersectingWiresMode, aScope);
HealingParameters.FixLoopWiresMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("loop.wires", (int)HealingParameters.FixLoopWiresMode, aScope);
HealingParameters.FixSplitFaceMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("split.face", (int)HealingParameters.FixSplitFaceMode, aScope);
HealingParameters.AutoCorrectPrecisionMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("auto.correct.precision", (int)HealingParameters.AutoCorrectPrecisionMode, aScope);
HealingParameters.ModifyTopologyMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("modify.topology", (int)HealingParameters.ModifyTopologyMode, aScope);
HealingParameters.ModifyGeometryMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("modify.geometry", (int)HealingParameters.ModifyGeometryMode, aScope);
HealingParameters.ClosedWireMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("closed.wire", (int)HealingParameters.ClosedWireMode, aScope);
HealingParameters.PreferencePCurveMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("preference.pcurve", (int)HealingParameters.PreferencePCurveMode, aScope);
HealingParameters.FixReorderMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("reorder.edges", (int)HealingParameters.FixReorderMode, aScope);
HealingParameters.FixSmallMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("remove.small.edges", (int)HealingParameters.FixSmallMode, aScope);
HealingParameters.FixConnectedMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("connected.edges", (int)HealingParameters.FixConnectedMode, aScope);
HealingParameters.FixEdgeCurvesMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("edge.curves", (int)HealingParameters.FixEdgeCurvesMode, aScope);
HealingParameters.FixDegeneratedMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("add.degenerated.edges", (int)HealingParameters.FixDegeneratedMode, aScope);
HealingParameters.FixLackingMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("add.lacking.edges", (int)HealingParameters.FixLackingMode, aScope);
HealingParameters.FixSelfIntersectionMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("selfintersection", (int)HealingParameters.FixSelfIntersectionMode, aScope);
HealingParameters.RemoveLoopMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("remove.loop", (int)HealingParameters.RemoveLoopMode, aScope);
HealingParameters.FixReversed2dMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("reversed2d", (int)HealingParameters.FixReversed2dMode, aScope);
HealingParameters.FixRemovePCurveMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("remove.pcurve", (int)HealingParameters.FixRemovePCurveMode, aScope);
HealingParameters.FixRemoveCurve3dMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("remove.curve3d", (int)HealingParameters.FixRemoveCurve3dMode, aScope);
HealingParameters.FixAddPCurveMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("add.pcurve", (int)HealingParameters.FixAddPCurveMode, aScope);
HealingParameters.FixAddCurve3dMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("add.curve3d", (int)HealingParameters.FixAddCurve3dMode, aScope);
HealingParameters.FixSeamMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("correct.order.in.seam", (int)HealingParameters.FixSeamMode, aScope);
HealingParameters.FixShiftedMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("shifted", (int)HealingParameters.FixShiftedMode, aScope);
HealingParameters.FixEdgeSameParameterMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("edge.same.parameter", (int)HealingParameters.FixEdgeSameParameterMode, aScope);
HealingParameters.FixNotchedEdgesMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("notched.edges", (int)HealingParameters.FixNotchedEdgesMode, aScope);
HealingParameters.FixTailMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("tail", (int)HealingParameters.FixTailMode, aScope);
HealingParameters.MaxTailAngle = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("max.tail.angle", (int)HealingParameters.MaxTailAngle, aScope);
HealingParameters.MaxTailWidth = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("max.tail.width", (int)HealingParameters.MaxTailWidth, aScope);
HealingParameters.FixSelfIntersectingEdgeMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("selfintersecting.edge", (int)HealingParameters.FixSelfIntersectingEdgeMode, aScope);
HealingParameters.FixIntersectingEdgesMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("intersecting.edges", (int)HealingParameters.FixIntersectingEdgesMode, aScope);
HealingParameters.FixNonAdjacentIntersectingEdgesMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("nonadjacent.intersecting.edges", (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode, aScope);
HealingParameters.FixVertexPositionMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("vertex.position", (int)HealingParameters.FixVertexPositionMode, aScope);
HealingParameters.FixVertexToleranceMode = (DE_ShapeFixParameters::FixMode)
theResource->IntegerVal("vertex.tolerance", (int)HealingParameters.FixVertexToleranceMode, aScope);
return true;
}
//=======================================================================
// function : Save
// purpose :
//=======================================================================
TCollection_AsciiString DE_ShapeFixConfigurationNode::Save() const
{
TCollection_AsciiString aResult;
TCollection_AsciiString aScope = THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor() + ".healing";
aResult += "!\n";
aResult += "!Shape healing parameters:\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the maximum allowable tolerance\n";
aResult += "!Default value: 1.e-6. Available values: any real positive (non null) value\n";
aResult += aScope + "tolerance3d :\t " + HealingParameters.Tolerance3d + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the maximum allowable tolerance\n";
aResult += "!Default value: 1.0. Available values: any real positive (non null) value\n";
aResult += aScope + "max.tolerance3d :\t " + HealingParameters.MaxTolerance3d + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the minimum allowable tolerance\n";
aResult += "!Default value: 1.e-7. Available values: any real positive (non null) value\n";
aResult += aScope + "min.tolerance3d :\t " + HealingParameters.MinTolerance3d + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Shape\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "free.shell :\t " + (int)HealingParameters.FixFreeShellMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Face for ShapeFix_Shape\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "free.face :\t " + (int)HealingParameters.FixFreeFaceMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Wire for ShapeFix_Shape\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "free.wire :\t " + (int)HealingParameters.FixFreeWireMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying ShapeFix::SameParameter after all fixes\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "same.parameter :\t " + (int)HealingParameters.FixSameParameterMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Solid\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "solid :\t " + (int)HealingParameters.FixSolidMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying analysis and fixes of orientation of shells in the solid\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "shell.orientation :\t " + (int)HealingParameters.FixShellOrientationMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for creation of solids. If operation is executed then solids are created from open shells ";
aResult += "else solids are created from closed shells only\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "create.open.solid :\t " + (int)HealingParameters.CreateOpenSolidMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Shell for ShapeFix_Solid\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "shell :\t " + (int)HealingParameters.FixShellMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying analysis and fixes of orientation of faces in the shell\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "face.orientation :\t " + (int)HealingParameters.FixFaceOrientationMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Face\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "face :\t " + (int)HealingParameters.FixFaceMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying fixes of ShapeFix_Wire\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "wire :\t " + (int)HealingParameters.FixWireMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying a fix for the orientation of faces in the shell\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "orientation :\t " + (int)HealingParameters.FixOrientationMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the add natural bound mode. If operation is executed then natural boundary is added on faces that miss them\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "add.natural.bound :\t " + (int)HealingParameters.FixAddNaturalBoundMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the fix missing seam mode (tries to insert seam is missed)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "missing.seam :\t " + (int)HealingParameters.FixMissingSeamMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the fix small area wire mode (drops small wires)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "small.area.wire :\t " + (int)HealingParameters.FixSmallAreaWireMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the remove face with small area (drops faces with small outer wires)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "remove.small.area.face :\t " + (int)HealingParameters.RemoveSmallAreaFaceMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the fix intersecting wires mode in ShapeFix_Face\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "intersecting.wires :\t " + (int)HealingParameters.FixIntersectingWiresMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the fix loop wires mode in ShapeFix_Face\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "loop.wires :\t " + (int)HealingParameters.FixLoopWiresMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the fix split face mode in ShapeFix_Face\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "split.face :\t " + (int)HealingParameters.FixSplitFaceMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the auto-correct precision mode in ShapeFix_Face\n";
aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "auto.correct.precision :\t " + (int)HealingParameters.AutoCorrectPrecisionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to modify topology of the wire during fixing (adding/removing edges etc.)\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "modify.topology :\t " + (int)HealingParameters.ModifyTopologyMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to modify geometry of the edges and vertices\n";
aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "modify.geometry :\t " + (int)HealingParameters.ModifyGeometryMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to defines whether the wire is to be closed (by calling methods like FixDegenerated() ";
aResult += "!and FixConnected() for lastand first edges\n";
aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "closed.wire :\t " + (int)HealingParameters.ClosedWireMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to defines the 2d representation of the wire is preferable over 3d one ";
aResult += "(in the case of ambiguity in FixEdgeCurves)\n";
aResult += "!and FixConnected() for lastand first edges\n";
aResult += "!Default value: \"Fix\"(1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "preference.pcurve :\t " + (int)HealingParameters.PreferencePCurveMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to reorder edges in the wire\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "reorder.edges :\t " + (int)HealingParameters.FixReorderMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to remove small edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "remove.small.edges :\t " + (int)HealingParameters.FixSmallMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix connecting edges in the wire\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "connected.edges :\t " + (int)HealingParameters.FixConnectedMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix edges (3Dcurves and 2D curves)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "edge.curves :\t " + (int)HealingParameters.FixEdgeCurvesMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for add degenerated edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "add.degenerated.edges :\t " + (int)HealingParameters.FixDegeneratedMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for add lacking edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "add.lacking.edges :\t " + (int)HealingParameters.FixLackingMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix selfintersection edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "selfintersection :\t " + (int)HealingParameters.FixSelfIntersectionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to remove loop\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "remove.loop :\t " + (int)HealingParameters.RemoveLoopMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to fix edge if pcurve is directed opposite to 3d curve\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "reversed2d :\t " + (int)HealingParameters.FixReversed2dMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to remove the pcurve(s) of the edge if it does not match the vertices\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "remove.pcurve :\t " + (int)HealingParameters.FixRemovePCurveMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to remove 3d curve of the edge if it does not match the vertices\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "remove.curve3d :\t " + (int)HealingParameters.FixRemoveCurve3dMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to add pcurve(s) of the edge if missing (by projecting 3d curve)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "add.pcurve :\t " + (int)HealingParameters.FixAddPCurveMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to build 3d curve of the edge if missing\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "add.curve3d :\t " + (int)HealingParameters.FixAddCurve3dMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to correct order of pcurves in the seam edge depends on its orientation\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "correct.order.in.seam :\t " + (int)HealingParameters.FixSeamMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode allowed to shifts wrong 2D curves back, ensuring that the 2D curves of the edges in the wire are connected\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "shifted :\t " + (int)HealingParameters.FixShiftedMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying EdgeSameParameter\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "edge.same.parameter :\t " + (int)HealingParameters.FixEdgeSameParameterMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix notched edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "notched.edges :\t " + (int)HealingParameters.FixNotchedEdgesMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix tail in wire\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "tail :\t " + (int)HealingParameters.FixTailMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for max angle of the tails\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "max.tail.angle :\t " + (int)HealingParameters.MaxTailAngle + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for max tail width\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "max.tail.width :\t " + (int)HealingParameters.MaxTailWidth + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix selfintersecting of edge\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "selfintersecting.edge :\t " + (int)HealingParameters.FixSelfIntersectingEdgeMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix intersecting edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "intersecting.edges :\t " + (int)HealingParameters.FixIntersectingEdgesMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for fix non adjacent intersecting edges\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "nonadjacent.intersecting.edges :\t " + (int)HealingParameters.FixNonAdjacentIntersectingEdgesMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for applying ShapeFix::FixVertexPosition before all fixes\n";
aResult += "!Default value: \"NotFix\"(0). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "vertex.position :\t " + (int)HealingParameters.FixVertexPositionMode + "\n";
aResult += "!\n";
aResult += "!\n";
aResult += "!Defines the mode for increases the tolerances of the edge vertices to comprise ";
aResult += "!the ends of 3d curve and pcurve on the given face (first method) or all pcurves stored in an edge (second one)\n";
aResult += "!Default value: \"FixOrNot\"(-1). Available values: \"FixOrNot\"(-1), \"NotFix\"(0), \"Fix\"(1)\n";
aResult += aScope + "vertex.tolerance :\t " + (int)HealingParameters.FixVertexToleranceMode + "\n";
aResult += "!\n";
return aResult;
}

View File

@@ -1,51 +0,0 @@
// Copyright (c) 2024 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _DE_ShapeFixConfigurationNode_HeaderFile
#define _DE_ShapeFixConfigurationNode_HeaderFile
#include <DE_ConfigurationNode.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <TColStd_ListOfAsciiString.hxx>
class DE_ConfigurationContext;
//! Base class to work with shape healing parameters for child classes.
class DE_ShapeFixConfigurationNode : public DE_ConfigurationNode
{
DEFINE_STANDARD_RTTIEXT(DE_ShapeFixConfigurationNode, DE_ConfigurationNode)
public:
//! Initializes all field by default
Standard_EXPORT DE_ShapeFixConfigurationNode();
//! Copies values of all fields
//! @param[in] theConfigurationNode object to copy
Standard_EXPORT DE_ShapeFixConfigurationNode(const Handle(DE_ShapeFixConfigurationNode)& theConfigurationNode);
//! Updates values according the resource
//! @param[in] theResource input resource to use
//! @return True if Load was successful
Standard_EXPORT virtual bool Load(const Handle(DE_ConfigurationContext)& theResource) Standard_OVERRIDE;
//! Writes configuration to the string
//! @return result resource string
Standard_EXPORT virtual TCollection_AsciiString Save() const Standard_OVERRIDE;
public:
DE_ShapeFixParameters HealingParameters; //!< Shape healing parameters
};
#endif // _DE_ShapeFixConfigurationNode_HeaderFile

View File

@@ -1,82 +0,0 @@
// Copyright (c) 2024 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _DE_ShapeFixParameters_HeaderFile
#define _DE_ShapeFixParameters_HeaderFile
//! Struct for shape healing parameters storage
struct DE_ShapeFixParameters
{
//! Enum, classifying a type of value for parameters
enum class FixMode : char
{
FixOrNot = -1, //!< Procedure will be executed or not (depending on the situation)
NotFix = 0, //!< Procedure will be executed
Fix = 1 //!< Procedure will be executed anyway
};
double Tolerance3d = 1.e-3;
double MaxTolerance3d = 1.0;
double MinTolerance3d = 1.e-7;
FixMode FixFreeShellMode = FixMode::FixOrNot;
FixMode FixFreeFaceMode = FixMode::FixOrNot;
FixMode FixFreeWireMode = FixMode::FixOrNot;
FixMode FixSameParameterMode = FixMode::FixOrNot;
FixMode FixSolidMode = FixMode::FixOrNot;
FixMode FixShellOrientationMode = FixMode::FixOrNot;
FixMode CreateOpenSolidMode = FixMode::NotFix;
FixMode FixShellMode = FixMode::FixOrNot;
FixMode FixFaceOrientationMode = FixMode::FixOrNot;
FixMode FixFaceMode = FixMode::FixOrNot;
FixMode FixWireMode = FixMode::FixOrNot;
FixMode FixOrientationMode = FixMode::FixOrNot;
FixMode FixAddNaturalBoundMode = FixMode::FixOrNot;
FixMode FixMissingSeamMode = FixMode::FixOrNot;
FixMode FixSmallAreaWireMode = FixMode::FixOrNot;
FixMode RemoveSmallAreaFaceMode = FixMode::FixOrNot;
FixMode FixIntersectingWiresMode = FixMode::FixOrNot;
FixMode FixLoopWiresMode = FixMode::FixOrNot;
FixMode FixSplitFaceMode = FixMode::FixOrNot;
FixMode AutoCorrectPrecisionMode = FixMode::FixOrNot;
FixMode ModifyTopologyMode = FixMode::NotFix;
FixMode ModifyGeometryMode = FixMode::Fix;
FixMode ClosedWireMode = FixMode::Fix;
FixMode PreferencePCurveMode = FixMode::Fix;
FixMode FixReorderMode = FixMode::FixOrNot;
FixMode FixSmallMode = FixMode::FixOrNot;
FixMode FixConnectedMode = FixMode::FixOrNot;
FixMode FixEdgeCurvesMode = FixMode::FixOrNot;
FixMode FixDegeneratedMode = FixMode::FixOrNot;
FixMode FixLackingMode = FixMode::FixOrNot;
FixMode FixSelfIntersectionMode = FixMode::FixOrNot;
FixMode RemoveLoopMode = FixMode::FixOrNot;
FixMode FixReversed2dMode = FixMode::FixOrNot;
FixMode FixRemovePCurveMode = FixMode::FixOrNot;
FixMode FixRemoveCurve3dMode = FixMode::FixOrNot;
FixMode FixAddPCurveMode = FixMode::FixOrNot;
FixMode FixAddCurve3dMode = FixMode::FixOrNot;
FixMode FixSeamMode = FixMode::FixOrNot;
FixMode FixShiftedMode = FixMode::FixOrNot;
FixMode FixEdgeSameParameterMode = FixMode::NotFix;
FixMode FixNotchedEdgesMode = FixMode::FixOrNot;
FixMode FixTailMode = FixMode::NotFix;
FixMode MaxTailAngle = FixMode::NotFix;
FixMode MaxTailWidth = FixMode::FixOrNot;
FixMode FixSelfIntersectingEdgeMode = FixMode::FixOrNot;
FixMode FixIntersectingEdgesMode = FixMode::FixOrNot;
FixMode FixNonAdjacentIntersectingEdgesMode = FixMode::FixOrNot;
FixMode FixVertexPositionMode = FixMode::NotFix;
FixMode FixVertexToleranceMode = FixMode::FixOrNot;
};
#endif // _DE_ShapeFixParameters_HeaderFile

View File

@@ -5,8 +5,5 @@ DE_ConfigurationNode.hxx
DE_PluginHolder.hxx
DE_Provider.cxx
DE_Provider.hxx
DE_ShapeFixConfigurationNode.cxx
DE_ShapeFixConfigurationNode.hxx
DE_ShapeFixParameters.hxx
DE_Wrapper.cxx
DE_Wrapper.hxx

View File

@@ -38,63 +38,36 @@
namespace
{
//=======================================================================
//function : UpdateHistoryShape
//purpose : Updates ShapeBuild_ReShape by the info of the given shape
//=======================================================================
bool UpdateHistoryShape (const TopoDS_Shape& theShape,
const BRepTools_Modifier& theModifier,
const Handle(ShapeBuild_ReShape)& theReShape)
{
TopoDS_Shape aResult;
try
{
OCC_CATCH_SIGNALS
aResult = theModifier.ModifiedShape (theShape);
}
catch (Standard_NoSuchObject const&)
{
// the sub shape isn't in the map
aResult.Nullify();
}
if (!aResult.IsNull() && !theShape.IsSame (aResult))
{
theReShape->Replace (theShape, aResult);
return true;
}
return false;
}
//=======================================================================
//function : UpdateHistory
//purpose : Recursively updates ShapeBuild_ReShape to add information of all sub-shapes
//=======================================================================
void UpdateHistory (const TopoDS_Shape& theShape,
const BRepTools_Modifier& theModifier,
const Handle(ShapeBuild_ReShape)& theReShape)
{
for (TopoDS_Iterator theIterator (theShape, Standard_False); theIterator.More(); theIterator.Next())
{
const TopoDS_Shape& aCurrent = theIterator.Value();
if (UpdateHistoryShape (aCurrent, theModifier, theReShape))
{
UpdateHistory (aCurrent, theModifier, theReShape);
}
}
}
//=======================================================================
//function : UpdateShapeBuild
//purpose : Recursively updates ShapeBuild_ReShape to add information of all sub-shapes
//=======================================================================
void UpdateShapeBuild (const TopoDS_Shape& theShape,
const BRepTools_Modifier& theModifier,
const Handle(ShapeBuild_ReShape)& theReShape)
{
UpdateHistoryShape (theShape, theModifier, theReShape);
UpdateHistory (theShape, theModifier, theReShape);
for (TopoDS_Iterator anIterator (theShape, Standard_False); anIterator.More(); anIterator.Next())
{
const TopoDS_Shape& aCurrent = anIterator.Value();
TopoDS_Shape aResult;
try
{
OCC_CATCH_SIGNALS
aResult = theModifier.ModifiedShape (aCurrent);
}
catch (Standard_NoSuchObject const &)
{
// the sub shape isn't in the map
aResult.Nullify();
}
if (!aResult.IsNull() && !aCurrent.IsSame (aResult))
{
theReShape->Replace (aCurrent, aResult);
UpdateShapeBuild (aCurrent, theModifier, theReShape);
}
}
}
}
@@ -120,35 +93,25 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
BRep_Builder B;
B.MakeCompound ( C );
SF.Location (TopLoc_Location());
Standard_Integer aShapeCount = SF.NbChildren();
Message_ProgressScope aPS(theProgress, "Applying Modifier For Solids", aShapeCount);
for (TopoDS_Iterator it(SF); it.More() && aPS.More(); it.Next())
{
Message_ProgressRange aRange = aPS.Next();
TopoDS_Shape shape = it.Value();
TopoDS_Shape aShapeNoLoc = it.Value();
aShapeNoLoc.Location (TopLoc_Location());
for ( TopoDS_Iterator it(SF); it.More() && aPS.More(); it.Next()) {
TopoDS_Shape shape = it.Value();
TopLoc_Location L = shape.Location(), nullLoc;
shape.Location ( nullLoc );
TopoDS_Shape res;
if (context.Find (aShapeNoLoc, res))
{
res.Orientation (shape.Orientation());
res.Location (shape.Location(), Standard_False);
}
Message_ProgressRange aRange = aPS.Next();
if ( context.IsBound ( shape ) )
res = context.Find ( shape ).Oriented ( shape.Orientation() );
else
{
res = ApplyModifier (shape, M, context, MD, aRange, aReShape);
}
res = ApplyModifier ( shape, M, context ,MD, aRange, aReShape );
if ( !res.IsSame (shape) )
{
context.Bind (aShapeNoLoc, res.Located (TopLoc_Location()));
if ( ! res.IsSame ( shape ) ) {
context.Bind ( shape, res );
locModified = Standard_True;
}
B.Add (C, res);
res.Location ( L, Standard_False );
B.Add ( C, res );
}
if ( !aPS.More() )
@@ -157,16 +120,9 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
return S;
}
if ( !locModified )
{
return S;
}
if ( ! locModified ) return S;
context.Bind ( SF, C );
C.Orientation (S.Orientation());
C.Location (S.Location(), Standard_False);
return C;
return C.Oriented ( S.Orientation() );
}
Message_ProgressScope aPS(theProgress, "Modify the Shape", 1);
@@ -177,7 +133,7 @@ TopoDS_Shape ShapeCustom::ApplyModifier (const TopoDS_Shape &S,
if ( !aPS.More() || !MD.IsDone() ) return S;
if ( !aReShape.IsNull() )
{
UpdateShapeBuild ( SF, MD, aReShape );
UpdateShapeBuild (SF, MD, aReShape);
}
return MD.ModifiedShape(SF).Oriented(S.Orientation());

View File

@@ -1,4 +1,3 @@
TKDE
TKBRep
TKernel
TKMath

View File

@@ -241,9 +241,11 @@ void XCAFDoc_LayerTool::SetLayer(const TDF_Label& L,
Handle(XCAFDoc_GraphNode) FGNode;
Handle(XCAFDoc_GraphNode) ChGNode;
if (! LayerL.FindAttribute( XCAFDoc::LayerRefGUID(), FGNode) ) {
FGNode = new XCAFDoc_GraphNode;
FGNode = XCAFDoc_GraphNode::Set(LayerL);
}
if (! L.FindAttribute( XCAFDoc::LayerRefGUID(), ChGNode) ) {
ChGNode = new XCAFDoc_GraphNode;
ChGNode = XCAFDoc_GraphNode::Set(L);
}
FGNode->SetGraphID( XCAFDoc::LayerRefGUID() );

View File

@@ -3,8 +3,6 @@ XSAlgo.hxx
XSAlgo_AlgoContainer.cxx
XSAlgo_AlgoContainer.hxx
XSAlgo_AlgoContainer.lxx
XSAlgo_AlgoProcessShape.cxx
XSAlgo_AlgoProcessShape.hxx
XSAlgo_Caller.hxx
XSAlgo_ToolContainer.cxx
XSAlgo_ToolContainer.hxx

View File

@@ -56,7 +56,6 @@
#include <TransferBRep_ShapeMapper.hxx>
#include <UnitsMethods.hxx>
#include <XSAlgo_AlgoContainer.hxx>
#include <XSAlgo_AlgoProcessShape.hxx>
#include <XSAlgo_ToolContainer.hxx>
#include <TopExp_Explorer.hxx>
@@ -67,7 +66,6 @@ IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,Standard_Transient)
//purpose :
//=======================================================================
XSAlgo_AlgoContainer::XSAlgo_AlgoContainer()
: myDEHealingParamsUsage(false)
{
myTC = new XSAlgo_ToolContainer;
}
@@ -102,21 +100,88 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
return theShape;
}
XSAlgo_AlgoProcessShape aProcessShape;
aProcessShape.SetShape(theShape);
aProcessShape.SetPrscfile(thePrscfile);
aProcessShape.SetPseq(thePseq);
aProcessShape.SetInfo(theInfo);
aProcessShape.SetHealingParamsFlag(myDEHealingParamsUsage);
aProcessShape.SetHealingParameters(myHealingParameters);
aProcessShape.SetDetalisationLevel(theDetalisationLevel);
aProcessShape.SetNonManifold(theNonManifold);
aProcessShape.SetProgressRange(theProgress);
aProcessShape.SetPrecision(thePrec);
aProcessShape.SetMaxTol(theMaxTol);
aProcessShape.SetReShape(theReShape);
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(theInfo);
if (aContext.IsNull())
{
Standard_CString aRscfile = Interface_Static::CVal(thePrscfile);
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
if (!aContext->ResourceManager()->IsInitialized())
{
// If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
aContext->SetDetalisation(theDetalisationLevel);
}
aContext->SetNonManifold(theNonManifold);
theInfo = aContext;
return aProcessShape.ProcessShape();
Standard_CString aSeq = Interface_Static::CVal(thePseq);
if (!aSeq) aSeq = thePseq;
// if resource file is not loaded or does not define <seq>.exec.op,
// do default fixes
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
TCollection_AsciiString aStr(aSeq);
aStr += ".exec.op";
if (!aRsc->Find(aStr.ToCString()))
{
#ifdef OCCT_DEBUG
{
static Standard_Integer aTime = 0;
if (!aTime)
std::cout << "Warning: XSAlgo_AlgoContainer::ProcessShape(): Sequence " << aStr.ToCString() <<
" is not defined in " << thePrscfile << " resource; do default processing" << std::endl;
aTime++;
}
#endif
// if reading, do default ShapeFix
if (!strncmp(thePseq, "read.", 5))
{
try {
OCC_CATCH_SIGNALS
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
aSfs->Init(theShape);
aSfs->SetMsgRegistrator(aMsg);
aSfs->SetPrecision(thePrec);
aSfs->SetMaxTolerance(theMaxTol);
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
aSfs->SetContext(theReShape);
aSfs->Perform(theProgress);
TopoDS_Shape aShape = aSfs->Shape();
if (!aShape.IsNull() && aShape != theShape)
{
aContext->RecordModification(aSfs->Context(), aMsg);
aContext->SetResult(aShape);
}
}
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
}
return aContext->Result();
}
// for writing, define default sequence of DirectFaces
else if (!strncmp(thePseq, "write.", 6))
{
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
}
}
// Define runtime tolerances and do Shape Processing
aRsc->SetResource("Runtime.Tolerance", thePrec);
aRsc->SetResource("Runtime.MaxTolerance", theMaxTol);
if (!ShapeProcess::Perform(aContext, aSeq, theProgress))
return theShape; // return original shape
return aContext->Result();
}
//=======================================================================

View File

@@ -19,7 +19,6 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Message_ProgressRange.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
@@ -47,35 +46,10 @@ public:
Standard_EXPORT XSAlgo_AlgoContainer();
//! Sets ToolContainer
void SetToolContainer (const Handle(XSAlgo_ToolContainer)& TC);
//! Gets healing parameters flag
const bool GetHealingParameteresFlag()
{
return myDEHealingParamsUsage;
}
//! Sets healing parameters flag
//! Uses defined DE healing parameters (if true) or parameters from resource file/Static_Interface
void SetHealingParametersFlag(const bool theHealingParamsFlag)
{
myDEHealingParamsUsage = theHealingParamsFlag;
}
//! Gets healing parameters
const DE_ShapeFixParameters& GetHealingParameteres()
{
return myHealingParameters;
}
//! Sets healing parameters
void SetHealingParameters(const DE_ShapeFixParameters& theHealingParams)
{
myHealingParameters = theHealingParams;
}
void SetToolContainer (const Handle(XSAlgo_ToolContainer)& TC);
//! Returns ToolContainer
Handle(XSAlgo_ToolContainer) ToolContainer() const;
Handle(XSAlgo_ToolContainer) ToolContainer() const;
//! Performs actions necessary for preparing environment
//! for transfer. Empty in Open version.
@@ -148,9 +122,8 @@ protected:
private:
bool myDEHealingParamsUsage;
Handle(XSAlgo_ToolContainer) myTC;
DE_ShapeFixParameters myHealingParameters;
};

View File

@@ -1,208 +0,0 @@
// Created on: 2000-01-19
// Created by: data exchange team
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <XSAlgo_AlgoProcessShape.hxx>
#include <Interface_Static.hxx>
#include <Resource_Manager.hxx>
#include <ShapeAlgo.hxx>
#include <ShapeAlgo_AlgoContainer.hxx>
#include <ShapeAlgo_ToolContainer.hxx>
#include <ShapeBuild_ReShape.hxx>
#include <ShapeExtend_MsgRegistrator.hxx>
#include <ShapeFix_Shape.hxx>
#include <ShapeProcess.hxx>
#include <ShapeProcess_ShapeContext.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoProcessShape, Standard_Transient)
//=======================================================================
//function : XSAlgo_AlgoProcessShape
//purpose :
//=======================================================================
XSAlgo_AlgoProcessShape::XSAlgo_AlgoProcessShape()
: myPrscfile(""),
myPseq(""),
myPrecision(0.001),
myMaxTol(1.),
myNonManifold(false),
myDetalisationLevel(TopAbs_VERTEX),
myDEHealingParamsUsage(false),
myProgressRange(Message_ProgressRange())
{
}
//=======================================================================
//function : ProcessShape
//purpose :
//=======================================================================
TopoDS_Shape XSAlgo_AlgoProcessShape::ProcessShape()
{
if (myShape.IsNull())
{
return myShape;
}
Standard_CString aRscfile = "";
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast(myInfo);
if (aContext.IsNull())
{
aRscfile = Interface_Static::CVal(myPrscfile);
aContext = new ShapeProcess_ShapeContext(myShape, aRscfile);
if (myDEHealingParamsUsage)
{
// Use defined shape healing parameters
FillMap(aContext->ResourceManager()->GetMap());
}
else if (!aContext->ResourceManager()->IsInitialized())
{
// If resource file wasn't found, use static values instead
Interface_Static::FillMap(aContext->ResourceManager()->GetMap());
}
}
aContext->SetDetalisation(myDetalisationLevel);
aContext->SetNonManifold(myNonManifold);
myInfo = aContext;
Standard_CString aSeq = Interface_Static::CVal(myPseq);
if (!aSeq) aSeq = myPseq;
// if resource file is not loaded or does not define <seq>.exec.op,
// do default fixes
Handle(Resource_Manager) aRsc = aContext->ResourceManager();
TCollection_AsciiString aStr(aSeq);
aStr += ".exec.op";
if (strncmp(myPseq, "read.", 5) == 0)
{
aRsc->SetResource(aStr.ToCString(), "FixShape");
try {
OCC_CATCH_SIGNALS
Handle(ShapeExtend_MsgRegistrator) aMsg = new ShapeExtend_MsgRegistrator;
Handle(ShapeFix_Shape) aSfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
aSfs->Init(myShape);
aSfs->SetMsgRegistrator(aMsg);
aSfs->SetPrecision(myPrecision);
aSfs->SetMaxTolerance(myMaxTol);
aSfs->FixFaceTool()->FixWireTool()->FixSameParameterMode() = Standard_False;
if (strcmp(aRscfile, "IGES") == 0 || strcmp(aRscfile, "XT") == 0)
{
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_True;
}
else
{
aSfs->FixSolidTool()->CreateOpenSolidMode() = Standard_False;
}
aSfs->SetContext(myReShape);
aSfs->Perform(myProgressRange);
TopoDS_Shape aShape = aSfs->Shape();
if (!aShape.IsNull() && aShape != myShape)
{
aContext->RecordModification(aSfs->Context(), aMsg);
aContext->SetResult(aShape);
}
}
catch (Standard_Failure const& anException)
{
#ifdef OCCT_DEBUG
std::cout << "Error: XSAlgo_AlgoContainer::ProcessShape(): Exception in ShapeFix::Shape" << std::endl;
anException.Print(std::cout); std::cout << std::endl;
#endif
(void)anException;
}
return aContext->Result();
}
else if (strncmp(myPseq, "write.", 6) == 0)
{
if (strcmp(aRscfile, "STEP") == 0)
{
aRsc->SetResource(aStr.ToCString(), "SplitCommonVertex,DirectFaces");
}
else
{
aRsc->SetResource(aStr.ToCString(), "DirectFaces");
}
}
// Define runtime tolerances and do Shape Processing
aRsc->SetResource("Runtime.Tolerance", myPrecision);
aRsc->SetResource("Runtime.MaxTolerance", myMaxTol);
if (!ShapeProcess::Perform(aContext, aSeq, myProgressRange))
return myShape; // return original shape
return aContext->Result();
}
//=======================================================================
//function : FillMap
//purpose :
//=======================================================================
void XSAlgo_AlgoProcessShape::FillMap(NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theMap) const
{
theMap.Clear();
theMap.Bind("Tolerance3d", TCollection_AsciiString(myHealingParameters.Tolerance3d));
theMap.Bind("MinTolerance3d", TCollection_AsciiString(myHealingParameters.MinTolerance3d));
theMap.Bind("MaxTolerance3d", TCollection_AsciiString(myHealingParameters.MaxTolerance3d));
theMap.Bind("FixFreeShellMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFreeShellMode)));
theMap.Bind("FixFreeFaceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFreeFaceMode)));
theMap.Bind("FixFreeFaceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFreeFaceMode)));
theMap.Bind("FixFreeWireMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFreeWireMode)));
theMap.Bind("FixSameParameterMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSameParameterMode)));
theMap.Bind("FixSolidMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSolidMode)));
theMap.Bind("FixShellOrientationMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixShellOrientationMode)));
theMap.Bind("CreateOpenSolidMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.CreateOpenSolidMode)));
theMap.Bind("FixShellMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixShellMode)));
theMap.Bind("FixFaceOrientationMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFaceOrientationMode)));
theMap.Bind("FixFaceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixFaceMode)));
theMap.Bind("FixWireMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixWireMode)));
theMap.Bind("FixOrientationMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixOrientationMode)));
theMap.Bind("FixAddNaturalBoundMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixAddNaturalBoundMode)));
theMap.Bind("FixMissingSeamMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixMissingSeamMode)));
theMap.Bind("FixSmallAreaWireMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSmallAreaWireMode)));
theMap.Bind("RemoveSmallAreaFaceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.RemoveSmallAreaFaceMode)));
theMap.Bind("FixIntersectingWiresMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixIntersectingWiresMode)));
theMap.Bind("FixLoopWiresMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixLoopWiresMode)));
theMap.Bind("FixSplitFaceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSplitFaceMode)));
theMap.Bind("AutoCorrectPrecisionMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.AutoCorrectPrecisionMode)));
theMap.Bind("ModifyTopologyMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.ModifyTopologyMode)));
theMap.Bind("ClosedWireMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.ClosedWireMode)));
theMap.Bind("PreferencePCurveMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.PreferencePCurveMode)));
theMap.Bind("FixReorderMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixReorderMode)));
theMap.Bind("FixSmallMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSmallMode)));
theMap.Bind("FixConnectedMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixConnectedMode)));
theMap.Bind("FixEdgeCurvesMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixEdgeCurvesMode)));
theMap.Bind("FixDegeneratedMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixDegeneratedMode)));
theMap.Bind("FixLackingMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixLackingMode)));
theMap.Bind("FixSelfIntersectionMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSelfIntersectionMode)));
theMap.Bind("RemoveLoopMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.RemoveLoopMode)));
theMap.Bind("FixReversed2dMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixReversed2dMode)));
theMap.Bind("FixRemovePCurveMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixRemovePCurveMode)));
theMap.Bind("FixRemoveCurve3dMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixRemoveCurve3dMode)));
theMap.Bind("FixAddPCurveMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixAddPCurveMode)));
theMap.Bind("FixAddCurve3dMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixAddCurve3dMode)));
theMap.Bind("FixSeamMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSeamMode)));
theMap.Bind("FixShiftedMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixShiftedMode)));
theMap.Bind("FixEdgeSameParameterMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixEdgeSameParameterMode)));
theMap.Bind("FixNotchedEdgesMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixNotchedEdgesMode)));
theMap.Bind("FixTailMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixTailMode)));
theMap.Bind("MaxTailAngle", TCollection_AsciiString(static_cast<int>(myHealingParameters.MaxTailAngle)));
theMap.Bind("MaxTailWidth", TCollection_AsciiString(static_cast<int>(myHealingParameters.MaxTailWidth)));
theMap.Bind("FixSelfIntersectingEdgeMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixSelfIntersectingEdgeMode)));
theMap.Bind("FixIntersectingEdgesMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixIntersectingEdgesMode)));
theMap.Bind("FixNonAdjacentIntersectingEdgesMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixNonAdjacentIntersectingEdgesMode)));
theMap.Bind("FixVertexPositionMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixVertexPositionMode)));
theMap.Bind("FixVertexToleranceMode", TCollection_AsciiString(static_cast<int>(myHealingParameters.FixVertexToleranceMode)));
}

View File

@@ -1,145 +0,0 @@
// Copyright (c) 2024 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _XSAlgo_AlgoProcessShape_HeaderFile
#define _XSAlgo_AlgoProcessShape_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <DE_ShapeFixParameters.hxx>
#include <Message_ProgressRange.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
class ShapeBuild_ReShape;
class XSAlgo_ToolContainer;
class TopoDS_Edge;
class TopoDS_Face;
class Transfer_TransientProcess;
class Transfer_FinderProcess;
class XSAlgo_AlgoProcessShape;
DEFINE_STANDARD_HANDLE(XSAlgo_AlgoProcessShape, Standard_Transient)
//! Class for shape processing
class XSAlgo_AlgoProcessShape : public Standard_Transient
{
public:
//! Empty constructor
Standard_EXPORT XSAlgo_AlgoProcessShape();
//! Shape processing with specified tolerances
Standard_EXPORT TopoDS_Shape ProcessShape();
//! Fill map from DE shape healing parameters
void FillMap(NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>& theMap) const;
//! Get shape for processing
const TopoDS_Shape& GetShape() { return myShape; }
//! Set shape for processing
void SetShape(const TopoDS_Shape& theShape) { myShape = theShape; }
//! Get name of the resource file
const Standard_CString& GetPrscfile() { return myPrscfile; }
//! Set name of the resource file
void SetPrscfile(const Standard_CString& thePrscfile) { myPrscfile = thePrscfile; }
//! Get name of the sequence of operators defined in the resource file for Shape Processing
const Standard_CString& GetPseq() { return myPseq; }
//! Set name of the sequence of operators defined in the resource file for Shape Processing
void SetPseq(const Standard_CString& thePseq) { myPseq = thePseq; }
//! Get information to be recorded in the translation map
const Handle(Standard_Transient)& GetInfo() { return myInfo; }
//! Set information to be recorded in the translation map
void SetInfo(const Handle(Standard_Transient)& theInfo) { myInfo = theInfo; }
//! Get flag of healing parameters
const bool GetHealingParamsFlag() { return myDEHealingParamsUsage; }
//! Set flag of healing parameters
//! Uses defined DE healing parameters (if true) or parameters from resource file/Static_Interface
void SetHealingParamsFlag(const bool theHealingParamsFlag) { myDEHealingParamsUsage = theHealingParamsFlag; }
//! Get healing parameters
const DE_ShapeFixParameters& GetHealingParameters() { return myHealingParameters; }
//! Set healing parameters
void SetHealingParameters(const DE_ShapeFixParameters& theHealingParams) { myHealingParameters = theHealingParams; }
//! Get flag to proceed with non-manifold topology
const bool GetNonManifold() { return myNonManifold; }
//! Set flag to proceed with non-manifold topology
void SetNonManifold(const bool theNonManifold) { myNonManifold = theNonManifold; }
//! Get detalisation level
const TopAbs_ShapeEnum GetDetalisationLevel() { return myDetalisationLevel; }
//! Set detalisation level
void SetDetalisationLevel(const TopAbs_ShapeEnum theDetalisationLevel) { myDetalisationLevel = theDetalisationLevel; }
//! Get progress indicator
const Message_ProgressRange& GetProgressRange() { return myProgressRange; }
//! Set progress indicator
void SetProgressRange(const Message_ProgressRange& theProgressRange) { myProgressRange = theProgressRange; }
//! Get maximum allowed tolerance
const double GetMaxTol() { return myMaxTol; }
//! Set maximum allowed tolerance
void SetMaxTol(const double theMaxTol) { myMaxTol = theMaxTol; }
//! Get basic precision
const double GetPrecision() { return myPrecision; }
//! Set basic precision
void SetPrecision(const double thePrecision) { myPrecision = thePrecision; }
//! Get tool to record the modifications of input shape
const Handle(ShapeBuild_ReShape)& GetReShape() { return myReShape; }
//! Set tool to record the modifications of input shape
void SetReShape(const Handle(ShapeBuild_ReShape)& theReShape) { myReShape = theReShape; }
DEFINE_STANDARD_RTTIEXT(XSAlgo_AlgoProcessShape, Standard_Transient)
private:
TopoDS_Shape myShape;
Standard_CString myPrscfile;
Standard_CString myPseq;
double myPrecision;
double myMaxTol;
bool myNonManifold;
TopAbs_ShapeEnum myDetalisationLevel;
bool myDEHealingParamsUsage;
DE_ShapeFixParameters myHealingParameters;
Message_ProgressRange myProgressRange;
Handle(Standard_Transient) myInfo;
Handle(ShapeBuild_ReShape) myReShape;
};
#endif // _XSAlgo_AlgoProcessShape_HeaderFile