Hide menu
Loading...
Searching...
No Matches
sheet_metal/feature_recognizer/main.cxx

Refer to the Sheet Metal Feature Recognizer Example

feature_group.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#ifndef _FeatureGroup_HeaderFile
#define _FeatureGroup_HeaderFile
#include <cadex/ModelData_Direction.hxx>
#include <cadex/MTKBase_Feature.hxx>
#include <cadex/MTKBase_FeatureComparator.hxx>
#include <algorithm>
#include <array>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
using namespace cadex;
using namespace std;
typedef std::pair<double, double> PairType;
typedef std::array<double, 3> ArrayType;
inline std::ostream& operator<< (std::ostream& theStream, const PairType& thePair)
{
return theStream << thePair.first << " x " << thePair.second;
}
inline std::ostream& operator<< (std::ostream& theStream, const ArrayType& theArray)
{
return theStream << theArray[0] << " x " << theArray[1] << " x " << theArray[2];
}
inline std::ostream& operator<< (std::ostream& theStream, const ModelData_Direction& theDir)
{
stringstream aStream;
aStream << setprecision(2) << fixed << "(" << theDir.X() << ", " << theDir.Y() << ", " << theDir.Z() << ")";
return theStream << aStream.str();
}
class FeatureGroupManager
{
public:
void AddFeature (const char* theGroupName,
const char* theSubgroupName,
bool theHasParameters,
const MTKBase_Feature& theFeature)
{
//find or create
auto aRes = std::find_if (myGroups.begin(), myGroups.end(),
[&] (const FeatureGroup& theGroup) { return theGroup.myName == theGroupName; });
if (aRes == myGroups.end()) {
aRes = myGroups.insert (aRes, FeatureGroup (theGroupName, theSubgroupName, theHasParameters));
}
//update
auto& aGroup = *aRes;
++aGroup.myFeatureSubgroups[theFeature];
}
void Print (const char* theFeatureType, function<void (MTKBase_Feature)> thePrintFeatureParameters)
{
sort (myGroups.begin(), myGroups.end(), FeatureGroupComparator());
cout << setprecision(6);
size_t aTotalCount = 0;
for (const auto& aFeatureGroup : myGroups) {
size_t aFeatureCount = aFeatureGroup.FeatureCount();
aTotalCount += aFeatureCount;
cout << " " << aFeatureGroup.myName << ": " << aFeatureCount << endl;
if (!aFeatureGroup.myHasParameters) {
continue;
}
const char* aSubgroupName = aFeatureGroup.mySubgroupName.c_str();
for (const auto& aFeatureSubgroup : aFeatureGroup.myFeatureSubgroups) {
cout << " " << aFeatureSubgroup.second << " " << aSubgroupName << " with" << endl;
thePrintFeatureParameters (aFeatureSubgroup.first);
}
}
cout << "\n Total " << theFeatureType << ": " << aTotalCount << "\n" << endl;
}
template <typename T>
static void PrintFeatureParameter (const char* theName, const T& theValue, const char* theUnits)
{
cout << " " << theName << ": " << theValue << " " << theUnits << endl;
}
private:
class FeatureGroup
{
public:
FeatureGroup (const std::string& theName, const std::string& theSubgroupName, bool theHasParameters) :
myName (theName), mySubgroupName (theSubgroupName), myHasParameters (theHasParameters)
{}
size_t FeatureCount() const
{
size_t aCount = 0;
for (const auto& aFeatureSubgroup : myFeatureSubgroups) {
aCount += aFeatureSubgroup.second;
}
return aCount;
}
string myName;
string mySubgroupName;
bool myHasParameters;
map<MTKBase_Feature, size_t, MTKBase_FeatureComparator> myFeatureSubgroups;
};
class FeatureGroupComparator
{
public:
bool operator() (const FeatureGroup& theA, const FeatureGroup& theB) const
{
const auto& anAName = theA.myName;
const auto& aBName = theB.myName;
if (anAName == aBName) {
return false;
}
const auto& anAFeatureSubgroups = theA.myFeatureSubgroups;
const auto& aBFeatureSubgroups = theB.myFeatureSubgroups;
if (anAFeatureSubgroups.empty() || aBFeatureSubgroups.empty()) {
return anAName < aBName;
}
return MTKBase_FeatureComparator() (anAFeatureSubgroups.begin()->first,
aBFeatureSubgroups.begin()->first);
}
};
vector<FeatureGroup> myGroups;
};
#endif
Provides possibility to compare MTK based features depending on their type and parameters.
Definition: MTKBase_FeatureComparator.hxx:29
Describes a base class of MTK based features.
Definition: MTKBase_Feature.hxx:34
Defines a 3D direction.
Definition: ModelData_Direction.hxx:180
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22

shape_processor.hxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#ifndef _ShapeProcessor_HeaderFile
#define _ShapeProcessor_HeaderFile
#include <cadex/Base_UTF16String.hxx>
#include <cadex/ModelData_Body.hxx>
#include <cadex/ModelData_BodyList.hxx>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_Model.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cadex/ModelData_Shell.hxx>
#include <cadex/ModelData_Solid.hxx>
#include <iostream>
using namespace cadex;
using namespace std;
class ShapeProcessor : public ModelData_Model::VoidElementVisitor
{
public:
void operator() (const ModelData_Part& thePart) override
{
auto aPartName = thePart.Name().IsEmpty() ? "noname" : thePart.Name();
auto aBRep = thePart.BRepRepresentation();
if (aBRep) {
const auto& aBodyList = aBRep.Get();
for (size_t i = 0, n = aBodyList.Size(); i < n; ++i) {
const auto& aBody = aBodyList[i];
ModelData_Shape::Iterator aShapeIt (aBody);
while (aShapeIt.HasNext()) {
const auto& aShape = aShapeIt.Next();
if (aShape.Type() == ModelData_ST_Solid) {
cout << "Part #" << myPartIndex << " [\"" << aPartName << "\"] - solid #" << std::to_string (i) << " has:" << endl;
ProcessSolid (ModelData_Solid::Cast (aShape));
} else if (aShape.Type() == ModelData_ST_Shell) {
cout << "Part #" << myPartIndex << " [\"" << aPartName << "\"] - shell #" << std::to_string (i) << " has:" << endl;
ProcessShell (ModelData_Shell::Cast (aShape));
}
}
}
}
++myPartIndex;
}
virtual void ProcessSolid (const ModelData_Solid& theSolid) = 0;
virtual void ProcessShell (const ModelData_Shell& theShell) = 0;
private:
size_t myPartIndex = 0;
};
class SolidProcessor : public ModelData_Model::VoidElementVisitor
{
public:
void operator() (const ModelData_Part& thePart) override
{
auto aPartName = thePart.Name().IsEmpty() ? "noname" : thePart.Name();
auto aBRep = thePart.BRepRepresentation();
if (aBRep) {
const auto& aBodyList = aBRep.Get();
for (size_t i = 0, n = aBodyList.Size(); i < n; ++i) {
const auto& aBody = aBodyList[i];
ModelData_Shape::Iterator aShapeIt (aBody);
while (aShapeIt.HasNext()) {
const auto& aShape = aShapeIt.Next();
if (aShape.Type() == ModelData_ST_Solid) {
cout << "Part #" << myPartIndex << " [\"" << aPartName << "\"] - solid #" << std::to_string (i) << " has:" << endl;
ProcessSolid (ModelData_Solid::Cast (aShape));
}
}
}
}
++myPartIndex;
}
virtual void ProcessSolid (const ModelData_Solid& theSolid) = 0;
private:
size_t myPartIndex = 0;
};
#endif
bool IsEmpty() const
Returns true if the string is empty.
Definition: Base_UTF16String.cxx:233
const ModelData_BodyList & Get() const
Returns an associated topological object.
Definition: ModelData_BRepRepresentation.cxx:626
Base_UTF16String Name() const
Definition: ModelData_BaseObject.cxx:218
Element visitor with empty implementation.
Definition: ModelData_Model.hxx:113
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Defines a connected set of faces.
Definition: ModelData_Shell.hxx:31
Defines a topological solid.
Definition: ModelData_Solid.hxx:31

main.cxx

// ****************************************************************************
// $Id$
//
// Copyright (C) 2008-2014, Roman Lygin. All rights reserved.
// Copyright (C) 2014-2023, CADEX. All rights reserved.
//
// This file is part of the CAD Exchanger software.
//
// You may use this file under the terms of the BSD license as follows:
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ****************************************************************************
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelAlgo_ValidationProperty.hxx>
#include <cadex/ModelData_Axis3Placement.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <cadex/ModelData_SceneGraphElementUniqueVisitor.hxx>
#include <cadex/MTKBase_FeatureList.hxx>
#include <cadex/SheetMetal_Bead.hxx>
#include <cadex/SheetMetal_Bridge.hxx>
#include <cadex/SheetMetal_ComplexHole.hxx>
#include <cadex/SheetMetal_CompoundBend.hxx>
#include <cadex/SheetMetal_CurvedBend.hxx>
#include <cadex/SheetMetal_Cutout.hxx>
#include <cadex/SheetMetal_FeatureRecognizer.hxx>
#include <cadex/SheetMetal_HemBend.hxx>
#include <cadex/SheetMetal_HemBendType.hxx>
#include <cadex/SheetMetal_Louver.hxx>
#include <cadex/SheetMetal_Notch.hxx>
#include <cadex/SheetMetal_StraightNotch.hxx>
#include <cadex/SheetMetal_Tab.hxx>
#include <cadex/SheetMetal_VNotch.hxx>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include "../../helpers/feature_group.hxx"
#include "../../helpers/shape_processor.hxx"
#include "../../../cadex_license.cxx"
#include "../../../mtk_license.cxx"
using namespace cadex;
using namespace std;
double ToDegrees (double theAngleRad)
{
return theAngleRad * 180. / M_PI;
}
const char* HemTypeToString (SheetMetal_HemBendType theType)
{
switch (theType) {
case SheetMetal_HBT_Flattened: return "Flattened Hem Bend(s)";
case SheetMetal_HBT_Open: return "Open Hem Bend(s)";
case SheetMetal_HBT_Teardrop: return "Teardrop Hem Bend(s)";
case SheetMetal_HBT_Rope: return "Rope Hem Bend(s)";
case SheetMetal_HBT_Rolled: return "Rolled Hem Bend(s)";
default:
break;
}
return "Hem Bend(s)";
}
const char* BendName (const SheetMetal_Bend& theBend)
{
if (theBend.IsOfType<SheetMetal_HemBend>()) {
const auto& aHemBend = static_cast<const SheetMetal_HemBend&> (theBend);
return HemTypeToString (aHemBend.Type());
} else if (theBend.IsOfType<SheetMetal_CurvedBend>()) {
return "Curved Bend(s)";
}
return "Bend(s)";
}
const char* HoleName (const SheetMetal_Hole& theHole)
{
if (theHole.IsOfType<SheetMetal_ComplexHole>()) {
return "Complex Hole(s)";
}
return "Hole(s)";
}
const char* NotchName (const SheetMetal_Notch& theNotch)
{
if (theNotch.IsOfType<SheetMetal_StraightNotch>()) {
return "Straight Notch(es)";
} else if (theNotch.IsOfType<SheetMetal_VNotch>()) {
return "V Notch(es)";
}
return "Notch(es)";
}
void PrintFeatures (const MTKBase_FeatureList& theFeatureList)
{
FeatureGroupManager aManager;
//group by parameters to provide more compact information about features
std::function<void(MTKBase_FeatureList)> GroupByParameters = [&] (const MTKBase_FeatureList& theFeatures) -> void {
for (size_t i = 0; i < theFeatures.Size(); ++i) {
const auto& aFeature = theFeatures[i];
if (aFeature.IsOfType<SheetMetal_Bead>()) {
aManager.AddFeature ("Bead(s)", "Bead(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Cutout>()) {
aManager.AddFeature ("Cutout(s)", "Cutout(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Louver>()) {
aManager.AddFeature ("Louver(s)", "", false, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Bridge>()) {
aManager.AddFeature ("Bridge(s)", "Bridge(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Hole>()) {
const auto& aHole = static_cast<const SheetMetal_Hole&> (aFeature);
aManager.AddFeature (HoleName (aHole), "Hole(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Bend>()) {
const auto& aBend = static_cast<const SheetMetal_Bend&> (aFeature);
aManager.AddFeature (BendName (aBend), "Bend(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Notch>()) {
const auto& aNotch = static_cast<const SheetMetal_Notch&> (aFeature);
aManager.AddFeature (NotchName (aNotch), "Notch(es)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_Tab>()) {
aManager.AddFeature ("Tab(s)", "Tab(s)", true, aFeature);
} else if (aFeature.IsOfType<SheetMetal_CompoundBend>()) {
const auto& aCompoundBend = static_cast<const SheetMetal_CompoundBend&> (aFeature);
GroupByParameters (aCompoundBend.FeatureList());
}
}
};
GroupByParameters (theFeatureList);
//print
auto PrintFeatureParameters = [] (const MTKBase_Feature& theFeature)
{
if (theFeature.IsOfType<SheetMetal_Bead>()) {
const auto& aBead = static_cast<const SheetMetal_Bead&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("depth", aBead.Depth(), "mm");
} else if (theFeature.IsOfType<SheetMetal_Cutout>()) {
const auto& aCutout = static_cast<const SheetMetal_Cutout&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("perimeter", aCutout.Perimeter(), "mm");
} else if (theFeature.IsOfType<SheetMetal_Louver>()) {
const auto& aLouver = static_cast<const SheetMetal_Louver&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("depth", aLouver.Depth(), "mm");
} else if (theFeature.IsOfType<SheetMetal_Bridge>()) {
const auto& aBridge = static_cast<const SheetMetal_Bridge&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("length", aBridge.Length(), "mm");
FeatureGroupManager::PrintFeatureParameter ("depth", aBridge.Depth(), "mm");
} else if (theFeature.IsOfType<SheetMetal_Hole>()) {
const auto& aHole = static_cast<const SheetMetal_Hole&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("radius", aHole.Radius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("depth", aHole.Depth(), "mm");
FeatureGroupManager::PrintFeatureParameter ("axis", aHole.Axis().Axis(), "");
} else if (theFeature.IsOfType<SheetMetal_Bend>()) {
const auto& aBend = static_cast<const SheetMetal_Bend&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("radius", aBend.Radius(), "mm");
FeatureGroupManager::PrintFeatureParameter ("angle", ToDegrees (aBend.Angle()), "deg");
FeatureGroupManager::PrintFeatureParameter ("length", aBend.Length(), "mm");
FeatureGroupManager::PrintFeatureParameter ("width", aBend.Width(), "mm");
} else if (theFeature.IsOfType<SheetMetal_Notch>()) {
const auto& aNotch = static_cast<const SheetMetal_Notch&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("length", aNotch.Length(), "mm");
FeatureGroupManager::PrintFeatureParameter ("width", aNotch.Width(), "mm");
if (aNotch.IsOfType<SheetMetal_StraightNotch>()) {
const auto& aStraightNotch = static_cast<const SheetMetal_StraightNotch&> (aNotch);
FeatureGroupManager::PrintFeatureParameter ("corner fillet radius", aStraightNotch.CornerFilletRadius(), "mm");
} else if (aNotch.IsOfType<SheetMetal_VNotch>()) {
const auto& aVNotch = static_cast<const SheetMetal_VNotch&> (aNotch);
FeatureGroupManager::PrintFeatureParameter ("angle", ToDegrees (aVNotch.Angle()), "deg");
}
} else if (theFeature.IsOfType<SheetMetal_Tab>()) {
const auto& aTab = static_cast<const SheetMetal_Tab&> (theFeature);
FeatureGroupManager::PrintFeatureParameter ("length", aTab.Length(), "mm");
FeatureGroupManager::PrintFeatureParameter ("width", aTab.Width(), "mm");
}
};
aManager.Print ("features", PrintFeatureParameters);
}
//Compute approximate thickness value, which can be used as the input thickness value for SheetMetal_FeatureRecognizer.
double CalculateInitialThicknessValue (const ModelData_Shape& theShape)
{
double aVolume = ModelAlgo_ValidationProperty::ComputeVolume (theShape);
double aSurfaceArea = ModelAlgo_ValidationProperty::ComputeSurfaceArea (theShape);
double aThickness = aVolume / (aSurfaceArea / 2.);
return aThickness;
}
class PartProcessor : public ShapeProcessor
{
public:
void ProcessSolid (const ModelData_Solid& theSolid) override
{
double aThickness = CalculateInitialThicknessValue (theSolid);
auto aFeatureList = myRecognizer.Perform (theSolid, aThickness);
PrintFeatures (aFeatureList);
}
void ProcessShell (const ModelData_Shell& theShell) override
{
auto aFeatureList = myRecognizer.Perform (theShell);
PrintFeatures (aFeatureList);
}
private:
};
int main (int argc, char* argv[])
{
auto aKey = LicenseKey::Value();
auto anMTKKey = MTKLicenseKey::Value();
// Activate the license (aKey must be defined in cadex_license.cxx
// and anMTKKey must be defined in mtk_license.cxx)
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
if (!CADExLicense_Activate (anMTKKey)) {
cerr << "Failed to activate Manufacturing Toolkit license." << endl;
return 1;
}
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <input_file>, where:" << endl;
cerr << " <input_file> is a name of the file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
// Reading the file
if (!aReader.Read (aSource, aModel)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
cout << "Model: " << aModel.Name() << "\n" << endl;
//processing
PartProcessor aPartProcessor;
ModelData_SceneGraphElementUniqueVisitor aVisitor (aPartProcessor);
aModel.Accept (aVisitor);
return 0;
}
Defines a list of features.
Definition: MTKBase_FeatureList.hxx:37
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
const Base_UTF16String & Name() const
Returns a model name.
Definition: ModelData_Model.cxx:358
void Accept(ElementVisitor &theVisitor) const
Accepts a visitor.
Definition: ModelData_Model.cxx:882
Reads any format that CAD Exchanger can import.
Definition: ModelData_ModelReader.hxx:33
bool Read(const Base_UTF16String &theFilePath, ModelData_Model &theModel)
Reads the file at the specified path into the specified model.
Definition: ModelData_ModelReader.cxx:182
Defines a visitor that visits each unique element only once.
Definition: ModelData_SceneGraphElementUniqueVisitor.hxx:33
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
Describes a sheet metal bead.
Definition: SheetMetal_Bead.hxx:31
Describes a bend in sheet metal.
Definition: SheetMetal_Bend.hxx:35
Describes a sheet metal bridge feature.
Definition: SheetMetal_Bridge.hxx:31
Describes a sheet metal complex hole feature.
Definition: SheetMetal_ComplexHole.hxx:31
Describes a sheet metal compound bend feature.
Definition: SheetMetal_CompoundBend.hxx:31
Describes a sheet metal curved bend feature.
Definition: SheetMetal_CurvedBend.hxx:31
Describes a cutout in sheet metal.
Definition: SheetMetal_Cutout.hxx:31
Provides an interface to recognizing sheet metal features tool. Is used for recognition of features s...
Definition: SheetMetal_FeatureRecognizer.hxx:38
Describes a sheet metal Hem bend feature.
Definition: SheetMetal_HemBend.hxx:32
Describes a circle hole drilled or punched in sheet metal.
Definition: SheetMetal_Hole.hxx:35
Describes a sheet metal louver feature.
Definition: SheetMetal_Louver.hxx:31
Describes a sheet metal notch.
Definition: SheetMetal_Notch.hxx:35
Describes a sheet metal straight notch.
Definition: SheetMetal_StraightNotch.hxx:31
Describes a sheet metal tab.
Definition: SheetMetal_Tab.hxx:31
Describes a sheet metal V-notch.
Definition: SheetMetal_VNotch.hxx:31
SheetMetal_HemBendType
Defines a hem bend type in sheet metal.
Definition: SheetMetal_HemBendType.hxx:29