 |
DATAKIT SDK
V2026.2
|
|
Using Datakit SDK for OpenCascade needs to go through assembly and construction tree like standard integration .
Then for Dtk_Node with type BodyType you can access to the Dtk_Body and convert it into TopoDS_Shape object. The following sample show you how to convert a Dtk_Body to an Opencascade binary object : TopoDS_Shape
#include "../LibReadersSample/WritingSample/PdfWrite/PdfWrite.hpp"
#include "../LibReadersSample/WritingSample/XmlWrite/XmlWrite.hpp"
#include <TopoDS_Shape.hxx>
#include <BRepTools.hxx>
{
if (NodeInfiniteGeometry == 0)
{
{
{
}
TopoDS_Shape res;
if (res.IsNull())
{
return;
}
static int numbrep = 0;
numbrep++;
{
if (bodyname.
len() == 0) bodyname =
"???";
}
std::cout <<
"Writing ToOpenCascade Body " << numbrep <<
" name: " << bodyname.
c_str() << std::endl;
filebrep += "_";
filebrep += ".brep";
BRepTools::Write(res, filebrep.
c_str());
TopoDS_Shape facewithid;
TmpBody->GetLump(0,
Lump);
{
{
{
Shell->GetFace(0, Face, orient);
{
SampleBrepFileForFace.
add_int(faceid);
SampleBrepFileForFace += ".brep";
BRepTools::Write(facewithid, SampleBrepFileForFace.
c_str());
}
}
}
}
if( !facewithid.IsNull() )
{
Dtk_ErrorStatus err = TmpBody->GetEntities( DatakitFaceID, CorrespondingFaces );
std::unordered_map<Dtk_ID, std::vector<Dtk_Size_t>> map;
TmpBody->FillTopologicalEntitiesIdMapping( map );
for(
Dtk_Size_t i = 0; i < map.at( DatakitFaceID ).size() > 0; ++i )
{
CorrespondingFacesWithGetPtr.
push_back( TmpBody->GetPtr( map.at( DatakitFaceID )[ i ] ) );
}
}
}
}
}
Dtk_InfoPtr get_info() const
uint32_t Dtk_ID
Definition: define.h:681
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_string GetName() const
Retrieves the entity name.
int GetInfiniteGeometryFlag() const
Retrieves the Flag for Infinite Geometry.
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
Dtk_ErrorStatus ConvertBody(const Dtk_BodyPtr &inBody)
Convert a Dtk_Body to set of TopoDS_Shape representing all topological entities.
@ Shell
Definition: testcreatecube.cpp:14
void WriteDtk_Mesh(const Dtk_MeshPtr &inMeshToWrite)
Definition: WriteMesh.cpp:8
#define DTK_TRUE
Definition: define.h:719
Class DKOC_Body2OCCBRep This class allow the conversion from a Dtk_BodyPtr to a set of TopoDS_Shape b...
Definition: DKOC_Body2OCCBRep.hpp:14
This is a high level string class.
Definition: dtk_string.hpp:53
size_t Dtk_Size_t
Definition: define.h:704
char Dtk_bool
Definition: define.h:717
void add_int(const int integer, int force_unsigned_int=0)
concat an int to the Dtk_string (convert the int to Dtk_string)
int GetDtkID(const int inShapeID) const
Get Dtk_ID from a ShapeID.
void SetConfigShapeFix(const Dtk_bool inMode)
Option to activate ShapeFix or not (activated by default)
TopoDS_Shape ShapeFromDtkID(const int inDtkID) const
Get Shape with inDtkID stored in Dtk_Entity->getinfo()->GetID()
Dtk_InfoPtr GetInfos() const
Retrieves the Dtk_DocElement Dtk_InfoPtr - read only -.
void SetConfigKeepPcurves(const Dtk_bool inMode)
Option to keep existing pcurves or not (activated by default)
TopoDS_Shape GetMainShape() const
Get the highest level TopoDS_Shape shape.
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_transfo CurrentMatrix
Definition: WritePrototype.cpp:13
Definition: util_ptr_dtk.hpp:37
Dtk_string dtkTypeError(Dtk_Int32 errNumero)
const char * c_str() const
Retrieve the ASCII conversion string.
@ Lump
Definition: testcreatecube.cpp:12
void XmlWriteBody(const Dtk_BodyPtr &inBody)
Definition: XmlWrite.cpp:118
int GetTesselationStatus()
Definition: TesselationEngine.cpp:11
int GetShapeID(const TopoDS_Shape &inShape) const
Get ID from Shape.
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Dtk_bool IsXmlDumpActivated()
Definition: XmlWrite.cpp:17
int len() const
Retrieve the length of the Dtk_string.
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
void WriteBody(Dtk_NodePtr inNode)
Definition: WriteBody.cpp:13
Dtk_BodyPtr GetDtk_BodyPtr()
Retrieves the Dtk_Node as a Dtk_BodyPtr - if exists -.