 |
DATAKIT API
V2025.3
|
|
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);
{
Dtk_ID faceid = Face->get_info()->GetId();
SampleBrepFileForFace.
add_int(faceid);
SampleBrepFileForFace += ".brep";
BRepTools::Write(facewithid, SampleBrepFileForFace.
c_str());
}
}
}
}
if (!facewithid.IsNull())
{
Dtk_EntityPtr CorrespondingFace = TmpBody->GetEntity(DatakitFaceID);
}
}
{
}
{
std::cout <<
"NodeName = " << inNode->
Name().
c_str() <<
";";
if (err_tess == 0)
{
for (i = 0; i < nbmeshes; i++)
{
}
}
{
}
}
}
}
uint32_t Dtk_ID
Definition: define.h:689
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
void PdfWriteEntity(Dtk_EntityPtr inEntity)
Definition: PdfWrite.cpp:173
Dtk_string GetName() const
Retrieves the entity name.
int GetInfiniteGeometryFlag() const
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:18
void WriteDtk_Mesh(const Dtk_MeshPtr &inMeshToWrite)
Definition: WriteMesh.cpp:8
#define DTK_TRUE
Definition: define.h:727
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:58
size_t Dtk_Size_t
Definition: define.h:712
char Dtk_bool
Definition: define.h:725
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.
const Dtk_string & Name() const
Retrieves the Dtk_DocElement Name - read only -.
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 -.
static Dtk_SmartPtr< Dtk_Entity > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
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_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Dtk_transfo CurrentMatrix
Definition: WritePrototype.cpp:11
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:16
void XmlWriteBody(const Dtk_BodyPtr &inBody)
Definition: XmlWrite.cpp:118
int GetTesselationStatus()
Definition: TesselationEngine.cpp:8
Dtk_MeshPtr GetDtk_MeshPtr()
Retrieves the Dtk_Node as a Dtk_meshPtr - if exists -.
Dtk_ErrorStatus tess_BodyToMeshes(const Dtk_BodyPtr &inBodyToWrite, Dtk_tab< Dtk_MeshPtr > &outMeshes, Dtk_tab< Dtk_Int32 > &outIsSolid, Dtk_bool inTessWireframe=DTK_FALSE, Dtk_bool inApplyRenderInfos=DTK_FALSE)
: Make Tesselation from a Dtk_body and create a Set of Dtk_mesh if available
int GetShapeID(const TopoDS_Shape &inShape) const
Get ID from Shape.
This is a high level array class.
Definition: util_stl_dtk.hpp:85
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:504
Dtk_bool IsXmlDumpActivated()
Definition: XmlWrite.cpp:17
int len() const
Retrieve the length of the Dtk_string.
@ dtkNoError
Definition: error_dtk.hpp:144
void WriteBody(Dtk_NodePtr inNode)
Definition: WriteBody.cpp:13
Dtk_bool IsPdfDumpActivated()
Definition: PdfWrite.cpp:26
Dtk_BodyPtr GetDtk_BodyPtr()
Retrieves the Dtk_Node as a Dtk_BodyPtr - if exists -.