 |
DATAKIT SDK
V2026.4
|
|
{
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
cube1->info()->SetName("FirstCube");
cube2->info()->SetName("SecondCube");
Dtk_transfo translate(
Dtk_dir(1, 0, 0),
Dtk_dir(0, 1, 0),
Dtk_dir(0, 0, 1),
Dtk_pnt(200, 0, 0));
cube2->Transform(translate);
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
CubeMesh->info()->SetName("MyMesh");
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
axis->SetName("MyAxisSystem");
axis->info()->AddAttribute(
"NXNAME",
Dtk_Val(
"ANOTHERAXISSYSTEM"));
axis->info()->SetColor(255, 255, 0);
axis->SetMatrix(axisTransform);
return axis;
}
{
body->info()->SetName("MyReferencePlane");
body->info()->AddAttribute(
"NXNAME",
Dtk_Val(
"MYPLANE"));
body->info()->SetColor(0, 255, 255);
body->AddOpenShell(shell);
return body;
}
{
body->info()->SetName("MyFixedRefPlane");
body->info()->AddAttribute(
"NXNAME",
Dtk_Val(
"ANOTHERFIXEDPLANENAME"));
body->info()->SetColor(0, 0, 255);
body->AddOpenShell(shell);
double trim[] = { -10,10,-10,10 };
plane->SetTrimUVBox(trim);
return body;
}
{
body->info()->SetName("MyRefAxis");
body->info()->AddAttribute(
"NXNAME",
Dtk_Val(
"ANOTHERAXISNAME"));
body->info()->SetColor(0, 255, 0);
body->AddOpenShell(shell);
shell->AddWire(tab);
return body;
}
{
body->info()->SetName("MyRefPoint");
body->info()->SetColor(255, 100, 0);
body->AddOpenShell(shell);
shell->AddWire(tab);
return body;
}
{
cube->info()->SetName("MyCube");
cube->info()->AddAttribute(
"NXNAME",
Dtk_Val(
"SOLIDBODYNAME"));
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
if (!parasolidFile)
{
std::cout <<
"error : " << inParasolidFilePath.
c_str() <<
" does not exist" << std::endl;
}
fseek(parasolidFile, 0, SEEK_END);
flux.
resize(ftell(parasolidFile));
fseek(parasolidFile, 0, SEEK_SET);
fread(&flux[0], 1, flux.
size(), parasolidFile);
fclose(parasolidFile);
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
if (!jtFile)
{
std::cout <<
"error : " << inJtFilePath.
c_str() <<
" does not exist" << std::endl;
}
fseek(jtFile, 0, SEEK_END);
fseek(jtFile, 0, SEEK_SET);
fread(&flux[0], 1, flux.
size(), jtFile);
fclose(jtFile);
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
Dtk_transfo translatescale(
Dtk_dir(20, 0, 0),
Dtk_dir(0, 20, 0),
Dtk_dir(0, 0, 20),
Dtk_pnt(150, 0, 0));
CylMesh->Transform(translatescale);
CubeBody->info()->SetLayer(5);
CylMesh->info()->SetLayer(6);
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
cube1->info()->SetName("FirstCube");
cube2->info()->SetName("SecondCube");
Dtk_transfo translate(
Dtk_dir(1, 0, 0),
Dtk_dir(0, 1, 0),
Dtk_dir(0, 0, 1),
Dtk_pnt(200, 0, 0));
cube2->Transform(translate);
CylMesh->info()->SetName("OneMesh");
Dtk_transfo translatescale(
Dtk_dir(10, 0, 0),
Dtk_dir(0, 10, 0),
Dtk_dir(0, 0, 10),
Dtk_pnt(-100, 0, 0));
CylMesh->Transform(translatescale);
WireBody->Transform(translatescale);
cube1->info()->AddAttribute(
"NXGROUPS",
Dtk_Val(
"GroupRoot\\Sub1\\"));
cube2->info()->AddAttribute(
"NXGROUPS",
Dtk_Val(
"GroupRoot\\Sub1\\\\GroupRoot\\Sub2\\"));
CylMesh->info()->AddAttribute(
"NXGROUPS",
Dtk_Val(
"GroupRoot\\Sub2\\"));
WireBody->info()->AddAttribute(
"NXGROUPS",
Dtk_Val(
"GroupRoot\\Sub2\\"));
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
cube1->info()->SetName("FirstCube");
cube2->info()->SetName("SecondCube");
Dtk_transfo translate(
Dtk_dir(1, 0, 0),
Dtk_dir(0, 1, 0),
Dtk_dir(0, 0, 1),
Dtk_pnt(200, 0, 0));
cube2->Transform(translate);
cube1->info()->AddAttribute(
"NXREFERENCESET",
Dtk_Val(
"MyRef1\\MyRef2\\MyRef3\\"));
cube2->info()->AddAttribute(
"NXREFERENCESET",
Dtk_Val(
"MyRef1\\MyRef3\\"));
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
meta->SetCategory(inCategory);
return meta;
}
{
def.
unit = Ugw::DefaultParameters::Unit::inch;
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
for (int colorIdx = 0; colorIdx < 217; colorIdx++)
{
}
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
if (!inVisible)
if (inLayer != -1)
return infos;
}
{
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
#ifdef USE_NX_READER
extern void nxreader_GetData(
const Dtk_string&,
void*&);
#define NX_RETRIEVE_ASSEMBLYDATA nxreader_GetData
#else
#define NX_RETRIEVE_ASSEMBLYDATA NULL
#endif
{
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
symb->Texts() = compotext;
double arrowlength = 5.5;
leader->GetInfo()->SetColor(
Dtk_RGB(0, 0, 255));
leader->GetInfo()->SetCurveThickNessInMM(0.7);
leader->GetInfo()->AddAttribute("NX_TextToLineGap", 10.0);
leader->GetInfo()->AddAttribute("NX_TextOverStubFactor", 0.1);
leader->GetInfo()->AddAttribute("NX_StubLength", 20.0);
leader->GetInfo()->AddAttribute("NX_StubSide", 1);
leader->GetInfo()->AddAttribute("NX_TextAlignment", 1);
leader->GetArrowHead().GetInfo()->AddAttribute("NX_ArrowAngle", 30.0);
leader->GetArrowHead().GetInfo()->AddAttribute("NX_DotDiameter", 1.5);
leader->GetArrowHead().GetInfo()->SetColor(
Dtk_RGB(255, 0, 255));
leader->GetArrowHead().GetInfo()->SetCurveThickNessInMM(2.0);
leader->GetArrowHead().GetInfo()->SetCurveLineType(
DTK_SOLIDLINE);
symb->AddLeader(leader);
pmi->info()->SetName("MyAnnot");
return pmi;
}
{
std::cout <<
"=> " << inOutputFileName.
c_str() << std::endl;
}
{
currentOutputFile = inOutputDirectory + L"simplebody.prt";
currentOutputFile = inOutputDirectory + L"twobodies.prt";
currentOutputFile = inOutputDirectory + L"mesh.prt";
errorStatus =
UgwMesh(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"wire.prt";
errorStatus =
UgwWire(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"refs.prt";
currentOutputFile = inOutputDirectory + L"extparasolid.prt";
errorStatus =
UgwExternParasolid(currentOutputFile,
"../InputFiles/Models/Parasolid/extparasolid.x_b", inVersion);
currentOutputFile = inOutputDirectory + L"extjt.prt";
errorStatus =
UgwExternJTMesh(currentOutputFile,
"../InputFiles/Models/JT/externjt.jt", inVersion);
currentOutputFile = inOutputDirectory + L"layers.prt";
errorStatus =
UgwLayers(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"groups.prt";
errorStatus =
UgwGroups(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"refsets.prt";
errorStatus =
UgwRefSets(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"meta.prt";
errorStatus =
UgwMeta(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"colors.prt";
errorStatus =
UgwColors(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"asm.prt";
errorStatus =
UgwAsm(currentOutputFile, inVersion);
currentOutputFile = inOutputDirectory + L"externasm.prt";
currentOutputFile = inOutputDirectory + L"annot.prt";
errorStatus =
UgwAnnot(currentOutputFile, inVersion);
return errorStatus;
}
{
std::cout << std::endl << "----------------------------------------------" << std::endl;
std::cout << "Ug Write start" << std::endl;
nxDirectory = inResultDirectory + L"NX-Unigraphics/";
inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx5/";
inOutputDirectory.
mkdir();
inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx1980/";
inOutputDirectory.
mkdir();
inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx2212/";
inOutputDirectory.
mkdir();
std::cout << "Ug Write end" << std::endl;
return errorStatus;
}
static Dtk_SmartPtr< Dtk_Info > Create()
Calls default constructor to allocate a new object.
Dtk_Double64 & Ratio()
Retrieves the text ratio - get/set -.
Dtk_SmartPtr< Dtk_Info > Dtk_InfoPtr
Handles a Dtk_Info object.
Definition: util_ptr_dtk.hpp:312
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
General solid_body
Definition: ugw.hpp:45
Dtk_ErrorStatus WriteAxisSystem(const Dtk_AxisSystemPtr &inAxisSystem)
Add an axis system into the current node.
Dtk_BodyPtr MakeRefAxis()
Definition: testlibugwrite.cpp:155
TextJustificationEnum & Justification()
Retrieves the text justification - get/set -.
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
@ JustificationLeft
Definition: util_draw_dtk.hpp:281
ObjectPreferences objectpreferences
Definition: ugw.hpp:52
static Dtk_PlaneSurfacePtr Create(const Dtk_pnt &inOrigin, const Dtk_dir &inNormal, const Dtk_dir &inUDirection, const Dtk_dir &inVDirection=Dtk_dir())
Create an infinite plane surface.
Dtk_ErrorStatus SetName(Dtk_string inName)
Dtk_ErrorStatus SetColorInTable(size_t inIth, const Dtk_RGB &inColor, const Dtk_string &inColorname)
Replace color value and color name on the palette.
This is the text_style. This class gathers information about text style.
Definition: util_draw_dtk.hpp:242
@ dtkErrorFileNotExist
Definition: error_dtk.hpp:103
Dtk_BodyPtr MakeRefPlane()
Definition: testlibugwrite.cpp:121
Dtk_ErrorStatus SetLayerData(const Dtk_LayerInfosSetPtr &inLayerDataSet, const Dtk_tab< Dtk_Int32 > &unused1=Dtk_tab< Dtk_Int32 >(), const Dtk_tab< Dtk_Int32 > &unused2=Dtk_tab< Dtk_Int32 >())
define Data for layers
Dtk_ErrorStatus AddExternInstance(const Dtk_string &inProtoFileName, const Dtk_transfo &inTrans, Dtk_InfoPtr inInfos, void(*innxread_getdata)(const Dtk_string &, void *&))
Open an extern file to add as instance in current assembly, inProtoFileName must be in the output dir...
Dtk_ErrorStatus UgwSimpleBody(const Dtk_string &inOutputFileName, int inVersion)
Sample 1.1: writes a single BRep cube body into an NX file.
Definition: testlibugwrite.cpp:18
Dtk_ErrorStatus UgwReferences(const Dtk_string &inOutputFileName, int inVersion)
Definition: testlibugwrite.cpp:186
#define DTK_TRUE
Definition: define.h:726
Dtk_ErrorStatus UgwRefSets(const Dtk_string &inOutputFileName, int inVersion)
Sample 2.3: writes bodies assigned to NX reference sets via the NXREFERENCESET attribute.
Definition: testlibugwrite.cpp:374
#define DTK_UGW_VERSION_NX5
Definition: ugw.hpp:7
@ dtk_text_type_value
Definition: str_def.h:14
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_ErrorStatus UgwTwoBodies(const Dtk_string &inOutputFileName, int inVersion)
Sample 1.2: writes two named cubes (translated apart) into an NX file.
Definition: testlibugwrite.cpp:44
Dtk_ErrorStatus WriteReferenceGeometry(const Dtk_BodyPtr &inRefgeom)
Add a reference geometry into the current node.
Dtk_ErrorStatus UgWriteSampleVersion(const Dtk_string &inOutputDirectory, int inVersion)
Entry point: runs all UGW sample functions for the given NX format version and output directory.
Definition: testlibugwrite.cpp:679
Dtk_ErrorStatus UgwExternJTMesh(const Dtk_string &inOutputFileName, const Dtk_string &inJtFilePath, int inVersion)
Sample 1.7: embeds an existing JT mesh stream into an NX file as external reference.
Definition: testlibugwrite.cpp:248
Dtk_ErrorStatus WriteExternJtMesh(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a JT file as lightweight body inside the file.
This is the base text class. It's part of Dtk_CompositeText. This class represents the texts and valu...
Definition: util_draw_dtk.hpp:1041
Dtk_ErrorStatus UgwMesh(const Dtk_string &inOutputFileName, int inVersion)
Sample 1.3: writes a cylinder mesh into an NX file.
Definition: testlibugwrite.cpp:77
static Dtk_BodyPtr Create()
Create a body.
Dtk_ErrorStatus WriteBody(const Dtk_BodyPtr &inBody)
Add a body inside the file.
Dtk_ErrorStatus UgwWire(const Dtk_string &inOutputFileName, int inVersion)
Sample 1.4: writes a wireframe body (curves) into an NX file.
Definition: testlibugwrite.cpp:93
FILE * OpenFile(const Dtk_string &inRights) const
File Utility : Open a file with the given rights.
Dtk_BodyPtr MakeFixedRefPlane()
Definition: testlibugwrite.cpp:137
@ DTK_SOLIDLINE
Definition: util_ent_dtk.hpp:49
static Dtk_SymbolPtr Create()
Calls default constructor to allocate a new object.
Dtk_ErrorStatus SetBlankedStatus(const Dtk_Int32 &inBlankedStatus)
Dtk_ErrorStatus UgwGroups(const Dtk_string &inOutputFileName, int inVersion)
Sample 2.2: writes bodies and a mesh grouped under named entity groups.
Definition: testlibugwrite.cpp:314
void add_int(const int integer, int force_unsigned_int=0)
concat an int to the Dtk_string (convert the int to Dtk_string)
Definition: dtk_val.hpp:67
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
Dtk_FdtPtr UGW_Sample_MakePMI()
Definition: testlibugwrite.cpp:587
Dtk_AxisSystemPtr MakeAxisSystem()
Definition: testlibugwrite.cpp:109
Dtk_InfoPtr MakeInstanceData(const Dtk_string &inInstanceName, const Dtk_RGB &inColor, bool inVisible, int inLayer)
Definition: testlibugwrite.cpp:474
double distance_tolerance
Definition: ugw.hpp:23
static Dtk_SmartPtr< Dtk_AxisSystem > Create()
Calls default constructor to allocate a new object.
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
Dtk_ErrorStatus UgwLayers(const Dtk_string &inOutputFileName, int inVersion)
Sample 2.1: writes a cube and a cylinder mesh each assigned to specific layers, with layer info set.
Definition: testlibugwrite.cpp:283
Dtk_ErrorStatus WritePMI(const Dtk_FdtPtr &inPmi)
Add a pmi inside the file.
Dtk_ErrorStatus WriteExternParasolidBody(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a Parasolid file as body inside the file.
Dtk_ErrorStatus UgwExternAsm(const Dtk_string &inOutputFileName, int inVersion)
Sample 3.2: writes an NX assembly referencing previously written external .prt files.
Definition: testlibugwrite.cpp:553
Dtk_ErrorStatus UgwAsm(const Dtk_string &inOutputFileName, int inVersion)
Sample 3.1: writes a multi-level NX assembly with named instances, colors, layers,...
Definition: testlibugwrite.cpp:487
Dtk_ErrorStatus CloseLastInstance()
Close the last instance.
Dtk_RGB background_color_top
Definition: ugw.hpp:36
@ DTK_PHANTOM
Definition: util_ent_dtk.hpp:53
Dtk_ErrorStatus SetGroupDatas(const Dtk_string &inGroupName, Dtk_InfoPtr inInfos)
define Visibility for a specific group
static Dtk_SmartPtr< T > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_ErrorStatus SetCurveThickNessInMM(const Dtk_Double64 inCurveThickNessInMM)
DtkErrorStatus UgWriteSample(const Dtk_string &inResultDirectory)
Definition: testlibugwrite.cpp:751
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
General def
Definition: ugw.hpp:45
static Dtk_FdtPtr Create()
Calls default constructor to allocate a new object.
void SetGeom(const Dtk_SurfacePtr &inSurface)
Set Geometry.
Dtk_ErrorStatus UgwMeta(const Dtk_string &inOutputFileName, int inVersion)
Sample 2.4: writes a cube with metadata (properties in categories) and custom unit/tolerance defaults...
Definition: testlibugwrite.cpp:414
Dtk_LayerInfosSetPtr CreateSetWithFlagsAndFilters()
Creates a layer info set with 257 layers (indices 0-256), alternating visible/selectable flags,...
Definition: testcreatelayerinfoset.cpp:81
#define CHECK_OK(X)
Definition: testwriters.h:8
Definition: util_ptr_dtk.hpp:37
Dtk_MetaDataPtr MakeMetaData(const Dtk_string &inPropertyName, const Dtk_string &inValue, const Dtk_string &inCategory="")
Definition: testlibugwrite.cpp:406
const char * c_str() const
Retrieve the ASCII conversion string.
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
Dtk_MeshPtr CreateMeshCylinder(int nbpoints)
Mesh Cylinder sample.
Definition: testcreatemesh.cpp:338
Dtk_RGB background_color_bottom
Definition: ugw.hpp:36
ModelingPreferences modelingpreferences
Definition: ugw.hpp:35
int mkdir() const
File Utility : Create a Directory.
Dtk_ErrorStatus SetLayer(const Dtk_Int32 &inLayer)
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
Unit unit
Definition: ugw.hpp:19
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
This is the composite text class. It's basically a Dtk_Text Container. This class represents a group ...
Definition: util_draw_dtk.hpp:1445
double density
Definition: ugw.hpp:25
DensityUnit density_unit
Definition: ugw.hpp:30
Dtk_ErrorStatus UgwColors(const Dtk_string &inOutputFileName, int inVersion)
Sample 2.5: writes a cube with a custom NX color table (217 entries) and then writes colored bodies.
Definition: testlibugwrite.cpp:449
@ lb_ft3
Definition: ugw.hpp:28
static Dtk_LeaderPtr Create()
Calls default constructor to allocate a new object.
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
Dtk_Double64 & CharHeight()
Retrieves the char height - get/set -.
#define NX_RETRIEVE_ASSEMBLYDATA
Definition: testlibugwrite.cpp:548
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Dtk_ErrorStatus WriteMesh(const Dtk_MeshPtr &inMesh)
Add a mesh inside the file.
void addTranslate(const Dtk_dir &V)
Translate the Dtk_transfo.
Dtk_BodyPtr CreateCube()
Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex,...
Definition: testcreatecube.cpp:1325
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
Dtk_ErrorStatus AddMetaData(const Dtk_MetaDataPtr &inMeta)
Add a MetaData in the current component.
#define DTK_UGW_VERSION_NX1980
Definition: ugw.hpp:8
Dtk_ErrorStatus InitFile(const Dtk_string &inFilename, int inVersiontowrite=45, const DefaultParameters &inDef=DefaultParameters())
Initialize UG Writer.
Dtk_ErrorStatus OpenInstance(const Dtk_string &inInstanceName, const Dtk_string &inProtoFileName, Dtk_bool &outWasAlreadyInstancied, const Dtk_transfo &inTrans, const Dtk_RGB &inRgb)
deprecated
#define DTK_RB
Definition: dtk_string.hpp:35
double angle_tolerance
Definition: ugw.hpp:24
LeaderTerminatorTypeEnum
Internal leader terminator type.
Definition: util_draw_dtk.hpp:1852
Dtk_Double64 width
Definition: ugw.hpp:42
Dtk_BodyPtr CreateCurves()
Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct co...
Definition: testcreatecube.cpp:1368
Dtk_ErrorStatus UgwExternParasolid(const Dtk_string &inOutputFileName, const Dtk_string &inParasolidFilePath, int inVersion)
Sample 1.6: embeds an existing Parasolid binary stream into an NX file as an external reference.
Definition: testlibugwrite.cpp:213
@ dtkNoError
Definition: error_dtk.hpp:151
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
static Dtk_ShellPtr Create(const Dtk_BodyPtr &inParentBody)
Create a shell in a body.
Dtk_BodyPtr MakeRefPoint()
Definition: testlibugwrite.cpp:171
void AddText(Dtk_Text inText)
Adds a Dtk_Text to the Dtk_CompositeText.
Definition: dtk_rgb.hpp:8
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
This is the base bounding box class. It's used into a lot of 2D Entities This class represents the ba...
Definition: util_draw_dtk.hpp:450
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
#define DTK_UGW_VERSION_NX2212
Definition: ugw.hpp:9
@ TerminatorTypeFillArrow
Definition: util_draw_dtk.hpp:1860
Dtk_ErrorStatus EndFile()
Close the UG file.
Dtk_ErrorStatus UgwAnnot(const Dtk_string &inOutputFileName, int inVersion)
Sample 4.1: writes a cube body and a PMI annotation (symbol with leader) into an NX file.
Definition: testlibugwrite.cpp:654
#define DTK_PI
Definition: str_def.h:8