DATAKIT SDK  V2026.4
testlibugwrite.cpp File Reference

Macros

#define NX_RETRIEVE_ASSEMBLYDATA   NULL
 

Functions

Dtk_AxisSystemPtr MakeAxisSystem ()
 
Dtk_BodyPtr MakeFixedRefPlane ()
 
Dtk_InfoPtr MakeInstanceData (const Dtk_string &inInstanceName, const Dtk_RGB &inColor, bool inVisible, int inLayer)
 
Dtk_MetaDataPtr MakeMetaData (const Dtk_string &inPropertyName, const Dtk_string &inValue, const Dtk_string &inCategory="")
 
Dtk_BodyPtr MakeRefAxis ()
 
Dtk_BodyPtr MakeRefPlane ()
 
Dtk_BodyPtr MakeRefPoint ()
 
Dtk_FdtPtr UGW_Sample_MakePMI ()
 
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. More...
 
Dtk_ErrorStatus UgwAsm (const Dtk_string &inOutputFileName, int inVersion)
 Sample 3.1: writes a multi-level NX assembly with named instances, colors, layers, re-instancing and wireframe. More...
 
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. More...
 
Dtk_ErrorStatus UgwExternAsm (const Dtk_string &inOutputFileName, int inVersion)
 Sample 3.2: writes an NX assembly referencing previously written external .prt files. More...
 
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. More...
 
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. More...
 
Dtk_ErrorStatus UgwGroups (const Dtk_string &inOutputFileName, int inVersion)
 Sample 2.2: writes bodies and a mesh grouped under named entity groups. More...
 
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. More...
 
Dtk_ErrorStatus UgwMesh (const Dtk_string &inOutputFileName, int inVersion)
 Sample 1.3: writes a cylinder mesh into an NX file. More...
 
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. More...
 
Dtk_ErrorStatus UgwReferences (const Dtk_string &inOutputFileName, int inVersion)
 
Dtk_ErrorStatus UgwRefSets (const Dtk_string &inOutputFileName, int inVersion)
 Sample 2.3: writes bodies assigned to NX reference sets via the NXREFERENCESET attribute. More...
 
DtkErrorStatus UgWriteSample (const Dtk_string &inResultDirectory)
 
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. More...
 
Dtk_ErrorStatus UgwSimpleBody (const Dtk_string &inOutputFileName, int inVersion)
 Sample 1.1: writes a single BRep cube body into an NX file. More...
 
Dtk_ErrorStatus UgwTwoBodies (const Dtk_string &inOutputFileName, int inVersion)
 Sample 1.2: writes two named cubes (translated apart) into an NX file. More...
 
Dtk_ErrorStatus UgwWire (const Dtk_string &inOutputFileName, int inVersion)
 Sample 1.4: writes a wireframe body (curves) into an NX file. More...
 

Macro Definition Documentation

◆ NX_RETRIEVE_ASSEMBLYDATA

#define NX_RETRIEVE_ASSEMBLYDATA   NULL

Function Documentation

◆ MakeAxisSystem()

Dtk_AxisSystemPtr MakeAxisSystem ( )
110 {
111  Dtk_transfo axisTransform;
112  axisTransform.addTranslate(Dtk_dir(-100, 50, 200));
114  axis->SetName("MyAxisSystem");
115  axis->info()->AddAttribute("NXNAME", Dtk_Val("ANOTHERAXISSYSTEM"));
116  axis->info()->SetColor(255, 255, 0);
117  axis->SetMatrix(axisTransform);
118  return axis;
119 }

◆ MakeFixedRefPlane()

Dtk_BodyPtr MakeFixedRefPlane ( )
138 {
139  Dtk_BodyPtr body = Dtk_Body::Create();
140  body->info() = Dtk_Info::Create();
141  body->info()->SetName("MyFixedRefPlane");
142  body->info()->AddAttribute("NXNAME", Dtk_Val("ANOTHERFIXEDPLANENAME"));
143  body->info()->SetColor(0, 0, 255);
144  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
145  body->AddOpenShell(shell);
146  Dtk_FacePtr face = Dtk_Face::Create(body);
147  Dtk_PlaneSurfacePtr plane = Dtk_PlaneSurface::Create(Dtk_pnt(250, 250, 0), Dtk_dir(0, 0, 1), Dtk_dir(1, 0, 0));
148  double trim[] = { -10,10,-10,10 };
149  plane->SetTrimUVBox(trim);
151  shell->AddFace(face, DTK_TRUE);
152  return body;
153 }

◆ MakeInstanceData()

Dtk_InfoPtr MakeInstanceData ( const Dtk_string &  inInstanceName,
const Dtk_RGB &  inColor,
bool  inVisible,
int  inLayer 
)
475 {
476  Dtk_InfoPtr infos = Dtk_Info::Create();
477  infos->SetName(inInstanceName);
478  infos->SetColor(inColor);
479  if (!inVisible)
480  infos->SetBlankedStatus(1);
481  if (inLayer != -1)
482  infos->SetLayer(inLayer);
483  return infos;
484 }

◆ MakeMetaData()

Dtk_MetaDataPtr MakeMetaData ( const Dtk_string &  inPropertyName,
const Dtk_string &  inValue,
const Dtk_string &  inCategory = "" 
)
407 {
409  meta->SetCategory(inCategory);
410  return meta;
411 }

◆ MakeRefAxis()

Dtk_BodyPtr MakeRefAxis ( )
156 {
157  Dtk_BodyPtr body = Dtk_Body::Create();
158  body->info() = Dtk_Info::Create();
159  body->info()->SetName("MyRefAxis");
160  body->info()->AddAttribute("NXNAME", Dtk_Val("ANOTHERAXISNAME"));
161  body->info()->SetColor(0, 255, 0);
162  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
163  body->AddOpenShell(shell);
165  Dtk_LinePtr line = Dtk_Line::Create(Dtk_pnt(160, 100, 10), Dtk_pnt(260, 200, 30));
167  shell->AddWire(tab);
168  return body;
169 }

◆ MakeRefPlane()

Dtk_BodyPtr MakeRefPlane ( )
122 {
123  Dtk_BodyPtr body = Dtk_Body::Create();
124  body->info() = Dtk_Info::Create();
125  body->info()->SetName("MyReferencePlane");
126  body->info()->AddAttribute("NXNAME", Dtk_Val("MYPLANE"));
127  body->info()->SetColor(0, 255, 255);
128  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
129  body->AddOpenShell(shell);
130  Dtk_FacePtr face = Dtk_Face::Create(body);
131  Dtk_PlaneSurfacePtr plane = Dtk_PlaneSurface::Create(Dtk_pnt(150, 150, 0), Dtk_dir(0, 0, 1), Dtk_dir(1, 0, 0));
133  shell->AddFace(face, DTK_TRUE);
134  return body;
135 }

◆ MakeRefPoint()

Dtk_BodyPtr MakeRefPoint ( )
172 {
173  Dtk_BodyPtr body = Dtk_Body::Create();
174  body->info() = Dtk_Info::Create();
175  body->info()->SetName("MyRefPoint");
176  body->info()->SetColor(255, 100, 0);
177  Dtk_ShellPtr shell = Dtk_Shell::Create(body);
178  body->AddOpenShell(shell);
180  Dtk_PointPtr point = Dtk_Point::Create(Dtk_pnt(0, 310, 10));
181  tab.push_back(point);
182  shell->AddWire(tab);
183  return body;
184 }

◆ UGW_Sample_MakePMI()

Dtk_FdtPtr UGW_Sample_MakePMI ( )
588 {
590  // text informations
591  Dtk_TextStyle textstyle;
592  Dtk_InfoPtr textinfos = Dtk_Info::Create();
593  // All datas below match NX menu Note Settings/ lettering
594  textinfos->AddAttribute("NX_AlignmentPosition", 4); // optional (1=TL,2=TC,3=TR,4=ML(def),5=MC,6=MR,7=BL,8=BC,9=BR)
595  textstyle.Justification() = Dtk_TextStyle::JustificationLeft; // Text Justification
596  textinfos->SetCurveThickNessInMM(0.1); // optional, assume <0.5 = thin, >1.0 = thick else normal
597  textstyle.CharHeight() = 11; // mandatory height
598  textinfos->AddAttribute("NX_FontGapFactor", 0.0); // optional (def 0.0)
599  textstyle.Ratio() = 1.0; // optional Text Aspect Ratio
600  textinfos->AddAttribute("NX_LineGapFactor", 1.0);// optional (def 1.0)
601  textinfos->AddAttribute("NX_LetteringAngle", 0.0);// optional (def 0.0)
602  textinfos->AddAttribute("NX_HeightFactor", 2.0); // optional (def 2.0)
603  textinfos->SetColor(Dtk_RGB(255, 0, 0)); // optional, a red text
604  //textstyle.Font().Name() = "Arial"; // optional, defaut blockfont (strokefont).
605  // NX5 supports only "blockfont", "Arial" and "NX ANSI Symbols"
606  // NX1980, append font name in table
607 
608  Dtk_pnt textorigin2D = Dtk_pnt(100, 20, 0); // all location are defined a 2D Coordinate system where Z = 0.
609  Dtk_Oriented2dBBox textbbox(textorigin2D, -1, -1); // -1 for width if unknown, height is given by textstyle.CharHeight()
610 
611  Dtk_Text text("SampleText\nsub1\nsub2", textbbox, textbbox, DTK_PI / 2.0, 0, dtk_text_type_value, textinfos, textstyle);
612  Dtk_CompositeText compotext;
613  compotext.AddText(text);
614  symb->Texts() = compotext;
615 
616  // arrow, see menu in NX : Note Settings / ArrowHead
617  Dtk_pnt arrowlocation = Dtk_pnt(50, 0, 0); // all location are defined a 2D Coordinate system where Z = 0.
618  double arrowlength = 5.5; // length of arrow througt line
620  Dtk_LeaderPtr leader = Dtk_Leader::Create(arrowlength, 0.0, arrowlocation, arrowtype, Dtk_tab<Dtk_pnt>());
621  // Note Settings / ArrowLine
622  leader->GetInfo()->SetColor(Dtk_RGB(0, 0, 255)); // optional, a blue leader
623  leader->GetInfo()->SetCurveThickNessInMM(0.7); // optional, assume <0.5 = thin, >1.0 = thick else normal
624  leader->GetInfo()->SetCurveLineType(DTK_PHANTOM); // optional, see enum enum Dtk_FontLineType
625  leader->GetInfo()->AddAttribute("NX_TextToLineGap", 10.0);// optional (def = 10.0)
626  leader->GetInfo()->AddAttribute("NX_TextOverStubFactor", 0.1);// optional (def = 0.1)
627 // Note Settings
628  leader->GetInfo()->AddAttribute("NX_StubLength", 20.0); // optional (def = 20.0)
629  leader->GetInfo()->AddAttribute("NX_StubSide", 1); // optional 1 for left (default), 0 for right
630  leader->GetInfo()->AddAttribute("NX_TextAlignment", 1); // optional 1 for top (default), 2 for middle, 3 for bottom
631 // Note Settings / ArrowHead
632  leader->GetArrowHead().GetInfo()->AddAttribute("NX_ArrowAngle", 30.0); // optional length given above (def = 30)
633  leader->GetArrowHead().GetInfo()->AddAttribute("NX_DotDiameter", 1.5); // optional (def = 1.5)
634  leader->GetArrowHead().GetInfo()->SetColor(Dtk_RGB(255, 0, 255)); // optional, a purple arrow
635  leader->GetArrowHead().GetInfo()->SetCurveThickNessInMM(2.0); // optional, assume <0.5 = thin, >1.0 = thick else normal
636  leader->GetArrowHead().GetInfo()->SetCurveLineType(DTK_SOLIDLINE); // optional, see enum enum Dtk_FontLineType
637 
638  symb->AddLeader(leader);
639 
640  // Final Placement :
641  Dtk_dir X(0, 0, 1);
642  Dtk_dir Y(-1, 0, 0);
643  Dtk_pnt O(0, 0, 0);
644 
645  Dtk_transfo trans = Dtk_transfo(X, Y, X^Y, O);
646 
648  pmi->info() = Dtk_Info::Create();
649  pmi->info()->SetName("MyAnnot");
650  return pmi;
651 }

◆ UgwAnnot()

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.

655 {
656  // Cube Sample
658  // First we initialize writing with name of output file (see macro CHECK_OK above)
659  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
660 
661  // Then we write the 2 bodies constructed
662  CHECK_OK(Ugw::WriteBody(cube));
663 
665  CHECK_OK(Ugw::WritePMI(pmi));
666 
667  // Write final file and release the writer.
669  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
670 
671  return dtkNoError;
672 }

◆ UgwAsm()

Dtk_ErrorStatus UgwAsm ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 3.1: writes a multi-level NX assembly with named instances, colors, layers, re-instancing and wireframe.

488 {
489  Dtk_BodyPtr CubeBody = sampleWriter::CreateCube(); // get a brepcube (common sample)
490  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCylinder(8); // get a meshcube (common sample)
491  Dtk_BodyPtr WireBody = sampleWriter::CreateCurves(); // get wire curve into a body.
492  CubeMesh->Transform(Dtk_transfo(Dtk_dir(30, 0, 0), Dtk_dir(0, 30, 0), Dtk_dir(0, 0, 30), Dtk_pnt())); // rescale mesh too small
493  Dtk_transfo cubetransfo; // identity
494 
495  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion)); // create root prt file
496 
497  CHECK_OK(Ugw::OpenInstance("sub1", cubetransfo, MakeInstanceData("SubAssembly", Dtk_RGB(), true, -1))); // sub1 subassembly
498 
499  CHECK_OK(Ugw::WriteBody(CubeBody)); // put a cube on the subassembly
500 
501  cubetransfo.addTranslate(Dtk_dir(350, 0, 0)); // shift matrix.
502  CHECK_OK(Ugw::OpenInstance("leaf1", cubetransfo, MakeInstanceData("RedCube_SpecificLayer12", Dtk_RGB(255, 0, 0), true, 12)));
503  CHECK_OK(Ugw::WriteBody(CubeBody));
505 
506  cubetransfo.addTranslate(Dtk_dir(150, 0, 0)); // shift matrix.
507  CHECK_OK(Ugw::OpenInstance("leaf2", cubetransfo, MakeInstanceData("GreenCube_Transparent", Dtk_RGB(0, 255, 0, 128), true, -1)));
508  CHECK_OK(Ugw::WriteBody(CubeBody));
510 
511  // create a second instance of "leaf2.prt", reusing "leaf2.prt" automatic retrieve instance
512  cubetransfo.addTranslate(Dtk_dir(150, 0, 0)); // shift matrix.
513  CHECK_OK(Ugw::OpenInstance("leaf2", cubetransfo, MakeInstanceData("ReinstanciedBlueCube", Dtk_RGB(0, 0, 255), true, -1)));
514  CHECK_OK(Ugw::CloseLastInstance()); // for reinstance, close immediatly
515 
516  cubetransfo.addTranslate(Dtk_dir(150, 0, 0)); // shift matrix again
517  CHECK_OK(Ugw::OpenInstance("leaf3", cubetransfo, MakeInstanceData("TealCube_Invisible", Dtk_RGB(0, 255, 255), false, -1)));
518  CHECK_OK(Ugw::WriteBody(CubeBody));
519  CHECK_OK(Ugw::CloseLastInstance()); // for reinstance, close immediatly
520 
521  cubetransfo.addTranslate(Dtk_dir(150, 0, 0)); // shift matrix.
522  CHECK_OK(Ugw::OpenInstance("leaf4", cubetransfo, MakeInstanceData("MeshCyl", Dtk_RGB(), true, -1)));
523  CHECK_OK(Ugw::WriteMesh(CubeMesh));
525 
526  cubetransfo.addTranslate(Dtk_dir(150, 0, 0)); // shift matrix.
527  CHECK_OK(Ugw::OpenInstance("leaf5", cubetransfo, MakeInstanceData("Wire", Dtk_RGB(), true, -1)));
528  CHECK_OK(Ugw::WriteBody(WireBody));
530 
532 
533  CHECK_OK(Ugw::EndFile()); // close root prt file
534  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
535  return dtkNoError;
536 }

◆ UgwColors()

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.

450 {
452  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
453 
454  for (int colorIdx = 0; colorIdx < 217; colorIdx++)
455  {
456  Dtk_string name = "Datakit_";
457  name.add_int(colorIdx);
458  Dtk_RGB rgb = Dtk_RGB(colorIdx + 30, 0, 0);
459  CHECK_OK(Ugw::SetColorInTable(colorIdx, rgb, name));
460  }
461 
462  CHECK_OK(Ugw::WriteBody(CubeBody));
464  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
465 
466  return dtkNoError;
467 }

◆ UgwExternAsm()

Dtk_ErrorStatus UgwExternAsm ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 3.2: writes an NX assembly referencing previously written external .prt files.

554 {
555  // This example create an assembly from extern prt files
556  // First we initialize writing with name of output file (see macro CHECK_OK above)
557  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
558 
559  // We add extern twobodies (.prt) written by this sample previously
560  // The last parameter is a pointer on a function from datakit NXreader to retrieve subassembly datas : (instance names, colors, layer, visbility).
561  // This is optional, if NULL is given, the current file doesn't know these datas from subassemblies.
563 
564  Dtk_transfo trans;
565  trans.addTranslate(Dtk_dir(0, 0, 200));
566  // We add extern asm (.prt) written by this sample previously
567  // We transmit function nxreader_GetData from NXReader, to retrieve cube colors set in subassembly sub1.prt
568  CHECK_OK(Ugw::AddExternInstance("asm", trans, MakeInstanceData("FirstInstance", Dtk_RGB(), true, 5), NX_RETRIEVE_ASSEMBLYDATA));
569 
570  trans.addTranslate(Dtk_dir(0, 200, 0));
571  // We add a second time extern asm (.prt) written by this sample previously
572  CHECK_OK(Ugw::AddExternInstance("asm", trans, MakeInstanceData("SecondInstance", Dtk_RGB(), true, 15), NX_RETRIEVE_ASSEMBLYDATA));
573 
574  // Write final file and release the writer.
576  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
577 
578  return dtkNoError;
579 }

◆ UgwExternJTMesh()

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.

249 {
250  FILE* jtFile = inJtFilePath.OpenFile(DTK_RB);
251  if (!jtFile)
252  {
253  std::cout << "error : " << inJtFilePath.c_str() << " does not exist" << std::endl;
254  return dtkErrorFileNotExist;
255  }
256  Dtk_tab<char> flux;
257  fseek(jtFile, 0, SEEK_END);
258  flux.resize(ftell(jtFile));
259  fseek(jtFile, 0, SEEK_SET);
260  if (flux.size() > 0)
261  fread(&flux[0], 1, flux.size(), jtFile);
262  fclose(jtFile);
263 
265  inf->SetName("MyFeatureName");
266  inf->AddAttribute("NXNAME", Dtk_string("SolidName"));
267  //inf->SetBlankedStatus(1); // set as invisible
268  //inf->SetColor(Dtk_RGB(255, 0, 0)); // set a body color (appear on non colored faces)
269 
270  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
271  CHECK_OK(Ugw::WriteExternJtMesh(&flux[0], flux.size(), inf));
273  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
274  return dtkNoError;
275 }

◆ UgwExternParasolid()

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.

214 {
215  FILE* parasolidFile = inParasolidFilePath.OpenFile(DTK_RB);
216  if (!parasolidFile)
217  {
218  std::cout << "error : " << inParasolidFilePath.c_str() << " does not exist" << std::endl;
219  return dtkErrorFileNotExist;
220  }
221  Dtk_tab<char> flux;
222  fseek(parasolidFile, 0, SEEK_END);
223  flux.resize(ftell(parasolidFile));
224  fseek(parasolidFile, 0, SEEK_SET);
225  if (flux.size() > 0)
226  fread(&flux[0], 1, flux.size(), parasolidFile);
227  fclose(parasolidFile);
228 
230  inf->SetName("MyFeatureName");
231  inf->AddAttribute("NXNAME", Dtk_string("SolidName"));
232  //inf->SetBlankedStatus(1); // set as invisible
233  //inf->SetColor(Dtk_RGB(255, 0, 0)); // set a body color (appear on non colored faces)
234 
235  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
236 
237  CHECK_OK(Ugw::WriteExternParasolidBody(&flux[0], flux.size(), inf));
239  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
240  return dtkNoError;
241 }

◆ UgwGroups()

Dtk_ErrorStatus UgwGroups ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 2.2: writes bodies and a mesh grouped under named entity groups.

315 {
317  cube1->info()->SetName("FirstCube");
319  cube2->info()->SetName("SecondCube");
320  Dtk_transfo translate(Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0), Dtk_dir(0, 0, 1), Dtk_pnt(200, 0, 0));
321  cube2->Transform(translate);
322  Dtk_MeshPtr CylMesh = sampleWriter::CreateMeshCylinder(8); // get a meshcyl (common sample)
323  CylMesh->info()->SetName("OneMesh");
324  Dtk_transfo translatescale(Dtk_dir(10, 0, 0), Dtk_dir(0, 10, 0), Dtk_dir(0, 0, 10), Dtk_pnt(-100, 0, 0));
325  CylMesh->Transform(translatescale);
327  WireBody->Transform(translatescale);
328 
329  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
330 
331  // put cube1 in group GroupRoot/Sub1
332  cube1->info()->AddAttribute("NXGROUPS", Dtk_Val("GroupRoot\\Sub1\\"));
333 
334  // put cube1 in group GroupRoot/Sub1 and also GroupRoot/Sub2
335  cube2->info()->AddAttribute("NXGROUPS", Dtk_Val("GroupRoot\\Sub1\\\\GroupRoot\\Sub2\\"));
336 
337  // put Mesh in group GroupRoot/Sub2
338  CylMesh->info()->AddAttribute("NXGROUPS", Dtk_Val("GroupRoot\\Sub2\\"));
339 
340  // put Wire in group GroupRoot/Sub2
341  WireBody->info()->AddAttribute("NXGROUPS", Dtk_Val("GroupRoot\\Sub2\\"));
342 
343 
344  // set property to group Sub2
345  Dtk_InfoPtr infsub2 = Dtk_Info::Create();
346  infsub2->SetBlankedStatus(1);
347  infsub2->SetLayer(23);
348  CHECK_OK(Ugw::SetGroupDatas("Sub2", infsub2)); // Sub2 become invisible, and on layer 23
349 
350  // make an empty group
351  Dtk_InfoPtr infsub3 = Dtk_Info::Create();
352  infsub3->AddAttribute("NXGROUPS", Dtk_Val("GroupRoot\\Sub3\\"));
353  infsub3->SetLayer(19);
354  CHECK_OK(Ugw::SetGroupDatas("Sub3", infsub3)); // Sub3 become an empty group on layer 19
355 
356  // Then we write the 2 bodies constructed
357  CHECK_OK(Ugw::WriteBody(cube1));
358  CHECK_OK(Ugw::WriteBody(cube2));
359  CHECK_OK(Ugw::WriteBody(WireBody));
360  CHECK_OK(Ugw::WriteMesh(CylMesh));
361 
362  // Write final file and release the writer.
364  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
365  return dtkNoError;
366 }

◆ UgwLayers()

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.

284 {
285  Dtk_BodyPtr CubeBody = sampleWriter::CreateCube(); // get a brepcube (common sample)
286  Dtk_MeshPtr CylMesh = sampleWriter::CreateMeshCylinder(8); // get a meshcyl (common sample)
287  Dtk_transfo translatescale(Dtk_dir(20, 0, 0), Dtk_dir(0, 20, 0), Dtk_dir(0, 0, 20), Dtk_pnt(150, 0, 0));
288  CylMesh->Transform(translatescale);
289 
290  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
291 
293 
294  CubeBody->info()->SetLayer(5);
295  CylMesh->info()->SetLayer(6);
296 
297  CHECK_OK( Ugw::SetLayerData( layerinfoset ) );
298 
299  // Then we write the 2 bodies constructed
300  CHECK_OK(Ugw::WriteBody(CubeBody));
301  CHECK_OK(Ugw::WriteMesh(CylMesh));
302 
303  // Write final file and release the writer.
305  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
306  return dtkNoError;
307 }

◆ UgwMesh()

Dtk_ErrorStatus UgwMesh ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 1.3: writes a cylinder mesh into an NX file.

78 {
79  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCylinder(8); // get a meshcylinder (common sample)
80  CubeMesh->info()->SetName("MyMesh");
81  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
82  CHECK_OK(Ugw::WriteMesh(CubeMesh));
84  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
85  return dtkNoError;
86 }

◆ UgwMeta()

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.

415 {
417 
419  def.unit = Ugw::DefaultParameters::Unit::inch;
422  def.modelingpreferences.density = 6500;
424 
425  def.background_color_top = Dtk_RGB( 255, 0, 0 );
426  def.background_color_bottom = Dtk_RGB( 0, 255, 0 );
427 
428  def.objectpreferences.def.width = 0.70;
430 
431  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion, def));
432 
433  // custom metadata
434  CHECK_OK(Ugw::AddMetaData(MakeMetaData("MyPropTitle", "MyPropValue", "CategoryNX1980")));
435  CHECK_OK(Ugw::AddMetaData(MakeMetaData("MyPropTitle2", "MyPropValue2", "CategoryNX1980")));
436 
437  CHECK_OK(Ugw::WriteBody(CubeBody));
439  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
440  return dtkNoError;
441 }

◆ UgwReferences()

Dtk_ErrorStatus UgwReferences ( const Dtk_string &  inOutputFileName,
int  inVersion 
)
187 {
189  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
190 
191  cube->info()->SetName("MyCube");
192  cube->info()->AddAttribute("NXNAME", Dtk_Val("SOLIDBODYNAME"));
193  CHECK_OK(Ugw::WriteBody(cube));
194 
200 
202  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
203 
204  return dtkNoError;
205 }

◆ UgwRefSets()

Dtk_ErrorStatus UgwRefSets ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 2.3: writes bodies assigned to NX reference sets via the NXREFERENCESET attribute.

375 {
377  cube1->info()->SetName("FirstCube");
379  cube2->info()->SetName("SecondCube");
380  Dtk_transfo translate(Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0), Dtk_dir(0, 0, 1), Dtk_pnt(200, 0, 0));
381  cube2->Transform(translate);
382 
383  // reference set
384  // Cube1 into reference set "MyRef1","MyRef2","MyRef3"
385  cube1->info()->AddAttribute("NXREFERENCESET", Dtk_Val("MyRef1\\MyRef2\\MyRef3\\"));
386  // Cube2 into reference set "MyRef1","MyRef3"
387  cube2->info()->AddAttribute("NXREFERENCESET", Dtk_Val("MyRef1\\MyRef3\\"));
388 
389  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
390 
391  // Then we write the 2 bodies constructed
392  CHECK_OK(Ugw::WriteBody(cube1));
393  CHECK_OK(Ugw::WriteBody(cube2));
394 
395  // Write final file and release the writer.
397  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
398  return dtkNoError;
399 }

◆ UgWriteSample()

DtkErrorStatus UgWriteSample ( const Dtk_string &  inResultDirectory)
752 {
753  Dtk_string inOutputDirectory, nxDirectory;
754  Dtk_ErrorStatus errorStatus;
755 
756  std::cout << std::endl << "----------------------------------------------" << std::endl;
757  std::cout << "Ug Write start" << std::endl;
758 
759  nxDirectory = inResultDirectory + L"NX-Unigraphics/";
760  nxDirectory.FixPathSeparator();
761  nxDirectory.mkdir();
762 
763  // Choosing output for inVersion NX5
764  inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx5/";
765  inOutputDirectory.FixPathSeparator();
766  inOutputDirectory.mkdir();
767  errorStatus = UgWriteSampleVersion(inOutputDirectory, DTK_UGW_VERSION_NX5);
768 
769  // Choosing output for inVersion NX1980
770  inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx1980/";
771  inOutputDirectory.FixPathSeparator();
772  inOutputDirectory.mkdir();
773  errorStatus = UgWriteSampleVersion(inOutputDirectory, DTK_UGW_VERSION_NX1980);
774 
775  // Choosing output for inVersion NX2212
776  inOutputDirectory = inResultDirectory + L"NX-Unigraphics/nx2212/";
777  inOutputDirectory.FixPathSeparator();
778  inOutputDirectory.mkdir();
779  errorStatus = UgWriteSampleVersion(inOutputDirectory, DTK_UGW_VERSION_NX2212);
780 
781  std::cout << "Ug Write end" << std::endl;
782 
783  return errorStatus;
784 }

◆ UgWriteSampleVersion()

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.

680 {
681  Dtk_string currentOutputFile;
682  Dtk_ErrorStatus errorStatus;
683 
684  // sample 1.1 : one body
685  currentOutputFile = inOutputDirectory + L"simplebody.prt";
686  errorStatus = UgwSimpleBody(currentOutputFile, inVersion);
687 
688  // sample 1.2 : just write 2 bodies
689  currentOutputFile = inOutputDirectory + L"twobodies.prt";
690  errorStatus = UgwTwoBodies(currentOutputFile, inVersion);
691 
692  // sample 1.3 : mesh
693  currentOutputFile = inOutputDirectory + L"mesh.prt";
694  errorStatus = UgwMesh(currentOutputFile, inVersion);
695 
696  // sample 1.4 : wire
697  currentOutputFile = inOutputDirectory + L"wire.prt";
698  errorStatus = UgwWire(currentOutputFile, inVersion);
699 
700  // sample 1.5 : References
701  currentOutputFile = inOutputDirectory + L"refs.prt";
702  errorStatus = UgwReferences(currentOutputFile, inVersion);
703 
704  // sample 1.6 : Extern Parasolid
705  currentOutputFile = inOutputDirectory + L"extparasolid.prt";
706  errorStatus = UgwExternParasolid(currentOutputFile, "../InputFiles/Models/Parasolid/extparasolid.x_b", inVersion);
707 
708  // sample 1.7 : Extern JT
709  currentOutputFile = inOutputDirectory + L"extjt.prt";
710  errorStatus = UgwExternJTMesh(currentOutputFile, "../InputFiles/Models/JT/externjt.jt", inVersion);
711 
712  // sample 2.1 : Layer filters
713  currentOutputFile = inOutputDirectory + L"layers.prt";
714  errorStatus = UgwLayers(currentOutputFile, inVersion);
715 
716  // sample 2.2 : Groups
717  currentOutputFile = inOutputDirectory + L"groups.prt";
718  errorStatus = UgwGroups(currentOutputFile, inVersion);
719 
720  // sample 2.3 : Reference Sets
721  currentOutputFile = inOutputDirectory + L"refsets.prt";
722  errorStatus = UgwRefSets(currentOutputFile, inVersion);
723 
724  // sample 2.4 : MetaDatas, units, modeling preferences
725  currentOutputFile = inOutputDirectory + L"meta.prt";
726  errorStatus = UgwMeta(currentOutputFile, inVersion);
727 
728  // sample 2.5 : Colors
729  currentOutputFile = inOutputDirectory + L"colors.prt";
730  errorStatus = UgwColors(currentOutputFile, inVersion);
731 
732  // sample 3.1 : Simple Assembly
733  currentOutputFile = inOutputDirectory + L"asm.prt";
734  errorStatus = UgwAsm(currentOutputFile, inVersion);
735 
736  // sample 3.2 : Extern Assembly
737  currentOutputFile = inOutputDirectory + L"externasm.prt";
738  errorStatus = UgwExternAsm(currentOutputFile, inVersion);
739 
740  // sample 4.1 : Annotation
741  currentOutputFile = inOutputDirectory + L"annot.prt";
742  errorStatus = UgwAnnot(currentOutputFile, inVersion);
743 
744  return errorStatus;
745 }

◆ UgwSimpleBody()

Dtk_ErrorStatus UgwSimpleBody ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 1.1: writes a single BRep cube body into an NX file.

19 {
20  // Cube Sample
22 
23  //CubeBody->info()->AddAttribute("MATERIALNAME", Dtk_string("Ash Gloss"));
24  // First we initialize writer with name of output file (see macro CHECK_OK above)
25 
26  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
27 
28 
29  // Then we write the body constructed
30  CHECK_OK(Ugw::WriteBody(CubeBody));
31 
32  // Write final file and release the writer.
34  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
35 
36  return dtkNoError;
37 }

◆ UgwTwoBodies()

Dtk_ErrorStatus UgwTwoBodies ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 1.2: writes two named cubes (translated apart) into an NX file.

45 {
46  // Cube Sample
48 
49  // We construct 2 cubes, translating the second
51  cube1->info()->SetName("FirstCube");
53  cube2->info()->SetName("SecondCube");
54 
55  Dtk_transfo translate(Dtk_dir(1, 0, 0), Dtk_dir(0, 1, 0), Dtk_dir(0, 0, 1), Dtk_pnt(200, 0, 0));
56  cube2->Transform(translate);
57 
58  // First we initialize writing with name of output file (see macro CHECK_OK above)
59  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
60 
61  // Then we write the 2 bodies constructed
62  CHECK_OK(Ugw::WriteBody(cube1));
63  CHECK_OK(Ugw::WriteBody(cube2));
64 
65  // Write final file and release the writer.
67  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
68 
69  return dtkNoError;
70 }

◆ UgwWire()

Dtk_ErrorStatus UgwWire ( const Dtk_string &  inOutputFileName,
int  inVersion 
)

Sample 1.4: writes a wireframe body (curves) into an NX file.

94 {
96  CHECK_OK(Ugw::InitFile(inOutputFileName, inVersion));
97  CHECK_OK(Ugw::WriteBody(WireBody));
99  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
100  return dtkNoError;
101 }
Dtk_Info::Create
static Dtk_SmartPtr< Dtk_Info > Create()
Calls default constructor to allocate a new object.
Dtk_TextStyle::Ratio
Dtk_Double64 & Ratio()
Retrieves the text ratio - get/set -.
Dtk_InfoPtr
Dtk_SmartPtr< Dtk_Info > Dtk_InfoPtr
Handles a Dtk_Info object.
Definition: util_ptr_dtk.hpp:312
Ugw::DefaultParameters
Definition: ugw.hpp:14
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Ugw::DefaultParameters::ObjectPreferences::solid_body
General solid_body
Definition: ugw.hpp:45
Ugw::WriteAxisSystem
Dtk_ErrorStatus WriteAxisSystem(const Dtk_AxisSystemPtr &inAxisSystem)
Add an axis system into the current node.
MakeRefAxis
Dtk_BodyPtr MakeRefAxis()
Definition: testlibugwrite.cpp:155
Dtk_TextStyle::Justification
TextJustificationEnum & Justification()
Retrieves the text justification - get/set -.
Dtk_Info::AddAttribute
Dtk_ErrorStatus AddAttribute(Dtk_string name, Dtk_Val val)
Dtk_TextStyle::JustificationLeft
@ JustificationLeft
Definition: util_draw_dtk.hpp:281
Ugw::DefaultParameters::objectpreferences
ObjectPreferences objectpreferences
Definition: ugw.hpp:52
Dtk_PlaneSurface::Create
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_Info::SetName
Dtk_ErrorStatus SetName(Dtk_string inName)
Ugw::SetColorInTable
Dtk_ErrorStatus SetColorInTable(size_t inIth, const Dtk_RGB &inColor, const Dtk_string &inColorname)
Replace color value and color name on the palette.
Dtk_TextStyle
This is the text_style. This class gathers information about text style.
Definition: util_draw_dtk.hpp:242
dtkErrorFileNotExist
@ dtkErrorFileNotExist
Definition: error_dtk.hpp:103
MakeRefPlane
Dtk_BodyPtr MakeRefPlane()
Definition: testlibugwrite.cpp:121
Ugw::SetLayerData
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
Ugw::AddExternInstance
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...
UgwSimpleBody
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
UgwReferences
Dtk_ErrorStatus UgwReferences(const Dtk_string &inOutputFileName, int inVersion)
Definition: testlibugwrite.cpp:186
DTK_TRUE
#define DTK_TRUE
Definition: define.h:726
UgwRefSets
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
DTK_UGW_VERSION_NX5
#define DTK_UGW_VERSION_NX5
Definition: ugw.hpp:7
dtk_text_type_value
@ dtk_text_type_value
Definition: str_def.h:14
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
UgwTwoBodies
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
Ugw::WriteReferenceGeometry
Dtk_ErrorStatus WriteReferenceGeometry(const Dtk_BodyPtr &inRefgeom)
Add a reference geometry into the current node.
UgWriteSampleVersion
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
UgwExternJTMesh
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
Ugw::WriteExternJtMesh
Dtk_ErrorStatus WriteExternJtMesh(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a JT file as lightweight body inside the file.
Dtk_Text
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
UgwMesh
Dtk_ErrorStatus UgwMesh(const Dtk_string &inOutputFileName, int inVersion)
Sample 1.3: writes a cylinder mesh into an NX file.
Definition: testlibugwrite.cpp:77
Dtk_Body::Create
static Dtk_BodyPtr Create()
Create a body.
Ugw::WriteBody
Dtk_ErrorStatus WriteBody(const Dtk_BodyPtr &inBody)
Add a body inside the file.
UgwWire
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
Dtk_string::OpenFile
FILE * OpenFile(const Dtk_string &inRights) const
File Utility : Open a file with the given rights.
MakeFixedRefPlane
Dtk_BodyPtr MakeFixedRefPlane()
Definition: testlibugwrite.cpp:137
DTK_SOLIDLINE
@ DTK_SOLIDLINE
Definition: util_ent_dtk.hpp:49
Dtk_Symbol::Create
static Dtk_SymbolPtr Create()
Calls default constructor to allocate a new object.
Dtk_Info::SetBlankedStatus
Dtk_ErrorStatus SetBlankedStatus(const Dtk_Int32 &inBlankedStatus)
UgwGroups
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
Dtk_string::add_int
void add_int(const int integer, int force_unsigned_int=0)
concat an int to the Dtk_string (convert the int to Dtk_string)
Dtk_Val
Definition: dtk_val.hpp:67
Dtk_Face::Create
static Dtk_FacePtr Create(const Dtk_BodyPtr &inParentBody)
Create a face in a body.
UGW_Sample_MakePMI
Dtk_FdtPtr UGW_Sample_MakePMI()
Definition: testlibugwrite.cpp:587
MakeAxisSystem
Dtk_AxisSystemPtr MakeAxisSystem()
Definition: testlibugwrite.cpp:109
MakeInstanceData
Dtk_InfoPtr MakeInstanceData(const Dtk_string &inInstanceName, const Dtk_RGB &inColor, bool inVisible, int inLayer)
Definition: testlibugwrite.cpp:474
Ugw::DefaultParameters::ModelingPreferences::distance_tolerance
double distance_tolerance
Definition: ugw.hpp:23
Dtk_AxisSystem::Create
static Dtk_SmartPtr< Dtk_AxisSystem > Create()
Calls default constructor to allocate a new object.
Dtk_tab::resize
void resize(Dtk_Size_t n, const T &t)
Resizes the array.
Definition: util_stl_dtk.hpp:604
UgwLayers
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
Ugw::WritePMI
Dtk_ErrorStatus WritePMI(const Dtk_FdtPtr &inPmi)
Add a pmi inside the file.
Ugw::WriteExternParasolidBody
Dtk_ErrorStatus WriteExternParasolidBody(const char *inFlux, size_t inSize, const Dtk_InfoPtr &inInf)
Add a Parasolid file as body inside the file.
UgwExternAsm
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
UgwAsm
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_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:29
Ugw::CloseLastInstance
Dtk_ErrorStatus CloseLastInstance()
Close the last instance.
Ugw::DefaultParameters::background_color_top
Dtk_RGB background_color_top
Definition: ugw.hpp:36
DTK_PHANTOM
@ DTK_PHANTOM
Definition: util_ent_dtk.hpp:53
Ugw::SetGroupDatas
Dtk_ErrorStatus SetGroupDatas(const Dtk_string &inGroupName, Dtk_InfoPtr inInfos)
define Visibility for a specific group
Dtk_SmartPtr::DtkDynamicCast
static Dtk_SmartPtr< T > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_Info::SetCurveThickNessInMM
Dtk_ErrorStatus SetCurveThickNessInMM(const Dtk_Double64 inCurveThickNessInMM)
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Ugw::DefaultParameters::ObjectPreferences::def
General def
Definition: ugw.hpp:45
Dtk_Fdt::Create
static Dtk_FdtPtr Create()
Calls default constructor to allocate a new object.
Dtk_Face::SetGeom
void SetGeom(const Dtk_SurfacePtr &inSurface)
Set Geometry.
UgwMeta
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
sampleWriter::layer::CreateSetWithFlagsAndFilters
Dtk_LayerInfosSetPtr CreateSetWithFlagsAndFilters()
Creates a layer info set with 257 layers (indices 0-256), alternating visible/selectable flags,...
Definition: testcreatelayerinfoset.cpp:81
CHECK_OK
#define CHECK_OK(X)
Definition: testwriters.h:8
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
MakeMetaData
Dtk_MetaDataPtr MakeMetaData(const Dtk_string &inPropertyName, const Dtk_string &inValue, const Dtk_string &inCategory="")
Definition: testlibugwrite.cpp:406
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
Dtk_Point::Create
static Dtk_PointPtr Create(const Dtk_Point &in)
Calls copy constructor to allocate a new object.
sampleWriter::CreateMeshCylinder
Dtk_MeshPtr CreateMeshCylinder(int nbpoints)
Mesh Cylinder sample.
Definition: testcreatemesh.cpp:338
Ugw::DefaultParameters::background_color_bottom
Dtk_RGB background_color_bottom
Definition: ugw.hpp:36
Ugw::DefaultParameters::modelingpreferences
ModelingPreferences modelingpreferences
Definition: ugw.hpp:35
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
Dtk_Info::SetLayer
Dtk_ErrorStatus SetLayer(const Dtk_Int32 &inLayer)
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
Ugw::DefaultParameters::unit
Unit unit
Definition: ugw.hpp:19
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
Dtk_CompositeText
This is the composite text class. It's basically a Dtk_Text Container. This class represents a group ...
Definition: util_draw_dtk.hpp:1445
Ugw::DefaultParameters::ModelingPreferences::density
double density
Definition: ugw.hpp:25
Ugw::DefaultParameters::ModelingPreferences::density_unit
DensityUnit density_unit
Definition: ugw.hpp:30
UgwColors
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
Ugw::DefaultParameters::ModelingPreferences::lb_ft3
@ lb_ft3
Definition: ugw.hpp:28
Dtk_Leader::Create
static Dtk_LeaderPtr Create()
Calls default constructor to allocate a new object.
Dtk_Line::Create
static Dtk_LinePtr Create(const Dtk_Line &in)
Calls copy constructor to allocate a new object.
Dtk_TextStyle::CharHeight
Dtk_Double64 & CharHeight()
Retrieves the char height - get/set -.
NX_RETRIEVE_ASSEMBLYDATA
#define NX_RETRIEVE_ASSEMBLYDATA
Definition: testlibugwrite.cpp:548
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
Ugw::WriteMesh
Dtk_ErrorStatus WriteMesh(const Dtk_MeshPtr &inMesh)
Add a mesh inside the file.
Dtk_transfo::addTranslate
void addTranslate(const Dtk_dir &V)
Translate the Dtk_transfo.
sampleWriter::CreateCube
Dtk_BodyPtr CreateCube()
Creates a 100x100x100 mm closed BRep cube body. Builds the full BRep hierarchy (Vertex,...
Definition: testcreatecube.cpp:1325
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
Ugw::AddMetaData
Dtk_ErrorStatus AddMetaData(const Dtk_MetaDataPtr &inMeta)
Add a MetaData in the current component.
DTK_UGW_VERSION_NX1980
#define DTK_UGW_VERSION_NX1980
Definition: ugw.hpp:8
Ugw::InitFile
Dtk_ErrorStatus InitFile(const Dtk_string &inFilename, int inVersiontowrite=45, const DefaultParameters &inDef=DefaultParameters())
Initialize UG Writer.
Ugw::OpenInstance
Dtk_ErrorStatus OpenInstance(const Dtk_string &inInstanceName, const Dtk_string &inProtoFileName, Dtk_bool &outWasAlreadyInstancied, const Dtk_transfo &inTrans, const Dtk_RGB &inRgb)
deprecated
DTK_RB
#define DTK_RB
Definition: dtk_string.hpp:35
Ugw::DefaultParameters::ModelingPreferences::angle_tolerance
double angle_tolerance
Definition: ugw.hpp:24
Dtk_Leader::LeaderTerminatorTypeEnum
LeaderTerminatorTypeEnum
Internal leader terminator type.
Definition: util_draw_dtk.hpp:1852
Ugw::DefaultParameters::ObjectPreferences::General::width
Dtk_Double64 width
Definition: ugw.hpp:42
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct co...
Definition: testcreatecube.cpp:1368
UgwExternParasolid
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
@ dtkNoError
Definition: error_dtk.hpp:151
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_Shell::Create
static Dtk_ShellPtr Create(const Dtk_BodyPtr &inParentBody)
Create a shell in a body.
MakeRefPoint
Dtk_BodyPtr MakeRefPoint()
Definition: testlibugwrite.cpp:171
Dtk_CompositeText::AddText
void AddText(Dtk_Text inText)
Adds a Dtk_Text to the Dtk_CompositeText.
Dtk_RGB
Definition: dtk_rgb.hpp:8
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
Dtk_Oriented2dBBox
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
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
DTK_UGW_VERSION_NX2212
#define DTK_UGW_VERSION_NX2212
Definition: ugw.hpp:9
Dtk_Leader::TerminatorTypeFillArrow
@ TerminatorTypeFillArrow
Definition: util_draw_dtk.hpp:1860
Ugw::EndFile
Dtk_ErrorStatus EndFile()
Close the UG file.
UgwAnnot
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
Dtk_MetaData::CreateMetaData
static Dtk_MetaDataPtr CreateMetaData(const MetaDataTypeEnum &inEnumType, Dtk_string inTitle, Dtk_string inValue, Dtk_string inValueType=Dtk_string(L"STRING"))
Create a Dtk_MetaDataPtr .
DTK_PI
#define DTK_PI
Definition: str_def.h:8