DATAKIT API  V2025.1
Dtk_Jtw_Interface Class Reference

This is Jt Interface class used to write Jt files. More...

Public Types

enum  breptype { nobrep = 0, xtbrep = 1 }
 
enum  colorstrategy { keepsubcolor = 0, overwritecolor = 1 }
 
enum  unit {
  millimeters = 0, centimeters = 1, meters = 2, inches = 3,
  feet = 4, yards = 5, micrometers = 6, decimeters = 7,
  kilometers = 8, mils = 9, miles = 10
}
 
enum  writeversion {
  version80 = 80, version90 = 90, version91 = 91, version92 = 92,
  version93 = 93, version94 = 94, version95 = 95, version100 = 100,
  version101 = 101, version102 = 102, version103 = 103, version104 = 104,
  version105 = 105, version106 = 106, version107 = 107
}
 

Public Member Functions

Dtk_ErrorStatus AddAxisSystem (const Dtk_AxisSystemPtr &inAxisSystem, Dtk_Int64 inIdaxis=-1)
 Add an axis system into the current node. More...
 
Dtk_ErrorStatus AddBody (const Dtk_BodyPtr &inToWrite, const Dtk_tab< Dtk_Float32 > &makelods=Dtk_tab< Dtk_Float32 >(), Dtk_Float32 inLossytol=0)
 Add a body into the current node. More...
 
Dtk_ErrorStatus AddLayerInfosSet (const Dtk_LayerInfosSetPtr &inToWrite)
 Add a Layer informations. More...
 
Dtk_ErrorStatus AddMesh (const Dtk_MeshPtr &inToWrite, Dtk_Float32 inLossytol=0)
 Add a mesh into the current node. More...
 
Dtk_ErrorStatus AddMetaData (const Dtk_MetaDataPtr &inToWrite)
 Add a Metdata into the current node. More...
 
Dtk_ErrorStatus AddModelView (const Dtk_ModelDisplayPtr &inModelview, Dtk_Int64 inIdmodelview=-1)
 Add a modelView into the current node. More...
 
Dtk_ErrorStatus AddOverrideColor (const Dtk_LightMapPtr &inLightmap, const Dtk_tab< Dtk_Int64 > &inRoute, Dtk_ID inBodyID=0)
 Set a Lightmap for a specific instance. More...
 
Dtk_ErrorStatus AddOverrideColor (const Dtk_RGB &inRgb, const Dtk_tab< Dtk_Int64 > &inRoute, Dtk_ID inBodyID=0)
 Set an override color for a specific instance. More...
 
Dtk_ErrorStatus AddPMI (const Dtk_FdtPtr &inPMI, Dtk_Int64 inIdpmi=-1)
 Add a fdt into the current node. More...
 
Dtk_ErrorStatus AddReferenceGeometry (const Dtk_BodyPtr &inRefgeom, Dtk_Int64 inIdrefgeom=-1)
 Add a reference geometry into the current node. More...
 
Dtk_ErrorStatus CloseLastInstance ()
 Close the last opened node. More...
 
Dtk_ErrorStatus ConnectModelView_Instance (Dtk_Int64 inIdmodelview, const Dtk_tab< Dtk_Int64 > &inRoute, int inHide=0, Dtk_ID inBodyID=0, const Dtk_transfo &inExplode=Dtk_transfo())
 Connect a ModelView on an Instance, for part representation restriction in a modelview. More...
 
Dtk_ErrorStatus ConnectPMI_Geom (Dtk_Int64 inIdfdt, Dtk_Int64 inGeomid, type_detk inTypegeom, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >(), Dtk_ID inBodyID=0)
 Connect a PMI on a body face/edge/vertex. More...
 
Dtk_ErrorStatus ConnectPMI_ModelView (Dtk_Int64 inIdpmi, Dtk_Int64 inIdModelView, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >())
 Connect a PMI on a ModelView. More...
 
Dtk_ErrorStatus ConnectPMI_PMI (Dtk_Int64 inIdpmifrom, Dtk_Int64 inIdpmito, const Dtk_tab< Dtk_Int64 > &inRoute=Dtk_tab< Dtk_Int64 >())
 Connect a PMI on another PMI. More...
 
 Dtk_Jtw_Interface (const Dtk_string &inFileWritten, Dtk_ErrorStatus &outErr, breptype inBrep=nobrep, writeversion inVersion=version95, unit inUnit=millimeters)
 Constructor, initialize the Jt Writer
More...
 
Dtk_bool ExistIdPart (Dtk_Int64 inIdpart) const
 Ask the writer if a part already exist. More...
 
Dtk_ErrorStatus LastInstance_SetInstanceColor (const Dtk_LightMapPtr &inLightmap, colorstrategy inColorstrategy=keepsubcolor)
 Set a Lightmap to previously opened instance. A lightmap is more complete that Dtk_RGB, this fonction override same fonction with Dtk_RGB. More...
 
Dtk_ErrorStatus LastInstance_SetInstanceColor (const Dtk_RGB &inRgb, colorstrategy inColorstrategy=keepsubcolor)
 Set a Color to previously opened instance. More...
 
Dtk_ErrorStatus LastInstance_SetInstanceID (Dtk_Int64 inInstanceID)
 Set an instance ID to previously opened instance. More...
 
Dtk_ErrorStatus LastInstance_SetInvisible ()
 Set previously opened instance as invisible. More...
 
Dtk_ErrorStatus OpenInstance (const Dtk_string &inName, const Dtk_transfo &inTrans=Dtk_transfo(), const Dtk_string &inExternfile=Dtk_string())
 Open a new Instance for the assembly writing. More...
 
Dtk_ErrorStatus OpenInstance (const Dtk_string &inName, Dtk_Int64 inIdpart, const Dtk_transfo &inTrans=Dtk_transfo(), const Dtk_string &inExternfile=Dtk_string())
 Open a new Instance for the assembly writing. More...
 
 ~Dtk_Jtw_Interface ()
 Destructor, finalise the process. More...
 

Detailed Description

This is Jt Interface class used to write Jt files.

Member Enumeration Documentation

◆ breptype

Enumerator
nobrep 
xtbrep 
11  {
12  nobrep = 0,
13  xtbrep = 1,
14  };

◆ colorstrategy

Enumerator
keepsubcolor 
overwritecolor 
16  {
17  keepsubcolor = 0,
18  overwritecolor = 1
19  };

◆ unit

Enumerator
millimeters 
centimeters 
meters 
inches 
feet 
yards 
micrometers 
decimeters 
kilometers 
mils 
miles 
39  {
40  millimeters = 0,
41  centimeters = 1,
42  meters = 2,
43  inches = 3,
44  feet = 4,
45  yards = 5,
46  micrometers = 6,
47  decimeters = 7,
48  kilometers = 8,
49  mils = 9,
50  miles = 10
51  };

◆ writeversion

Enumerator
version80 
version90 
version91 
version92 
version93 
version94 
version95 
version100 
version101 
version102 
version103 
version104 
version105 
version106 
version107 
21  {
22  version80 = 80,
23  version90 = 90,
24  version91 = 91,
25  version92 = 92,
26  version93 = 93,
27  version94 = 94,
28  version95 = 95,
29  version100 = 100,
30  version101 = 101,
31  version102 = 102,
32  version103 = 103,
33  version104 = 104,
34  version105 = 105,
35  version106 = 106,
36  version107 = 107
37  };

Constructor & Destructor Documentation

◆ Dtk_Jtw_Interface()

Dtk_Jtw_Interface::Dtk_Jtw_Interface ( const Dtk_string inFileWritten,
Dtk_ErrorStatus outErr,
breptype  inBrep = nobrep,
writeversion  inVersion = version95,
unit  inUnit = millimeters 
)

Constructor, initialize the Jt Writer

Parameters
[in]inFileWritten: File to write
[out]outErr: Error returned. dtkNoError on success.
[in]inBrep: Which brep should be integrated : see breptype enum. nobrep for no brep (only mesh, packed file (default)), or xtbrep : contain Parasolid Brep, need Parasolid Writer.
[in]inVersion: Version to write : see writeversion enum, default is version95
[in]inUnit: Unit of file, see unit enum. Default is millimeters

◆ ~Dtk_Jtw_Interface()

Dtk_Jtw_Interface::~Dtk_Jtw_Interface ( )

Destructor, finalise the process.

Member Function Documentation

◆ AddAxisSystem()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddAxisSystem ( const Dtk_AxisSystemPtr inAxisSystem,
Dtk_Int64  inIdaxis = -1 
)

Add an axis system into the current node.

Parameters
[in]inAxisSystem: axis system to Write.
[in]inIdaxis: You may give an ID for axis system, to connect on. -1 for automatic ID.
Returns
dtkNoError if ok.

◆ AddBody()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddBody ( const Dtk_BodyPtr inToWrite,
const Dtk_tab< Dtk_Float32 > &  makelods = Dtk_tabDtk_Float32 >(),
Dtk_Float32  inLossytol = 0 
)

Add a body into the current node.

Remarks
Tesselate it to store into JT File, and add the body as brep depending inBrep parameter in constructor
You may give a body ID (for ConnectPMI_Geom) using inBody->info()->SetId(id)
Parameters
[in]inBody: Body to Write.
[in]inLodDatas: couples of linear_tolerance/angular_tolerances (radian) for each LOD : so nblod = InLodDatas.size()/2. -1 value mean disabled. Empty tab = 1 LOD with (-1,-1)
[in]inLossytol: Set lossycompression tolerance for mesh : ie move vertices with maximum tolerance value for better compression. Keep 0 for lossless comrpession
Returns
dtkNoError if ok.

◆ AddLayerInfosSet()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddLayerInfosSet ( const Dtk_LayerInfosSetPtr inToWrite)

Add a Layer informations.

Returns
dtkNoError if ok.
Parameters
[in]inToWrite: Dtk_LayerInfosSetPtr to Write.

◆ AddMesh()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddMesh ( const Dtk_MeshPtr inToWrite,
Dtk_Float32  inLossytol = 0 
)

Add a mesh into the current node.

Parameters
[in]inMesh: Mesh to Write.
[in]inLossytol: Set lossycompression tolerance for mesh : ie move vertices with maximum tolerance value for better compression. Keep 0 for lossless comrpession
Returns
dtkNoError if ok.

◆ AddMetaData()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddMetaData ( const Dtk_MetaDataPtr inToWrite)

Add a Metdata into the current node.

Parameters
[in]inToWrite: MetDatas to Write.
Returns
dtkNoError if ok.

◆ AddModelView()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddModelView ( const Dtk_ModelDisplayPtr inModelview,
Dtk_Int64  inIdmodelview = -1 
)

Add a modelView into the current node.

Parameters
[in]inModelview: modelView to Write.
[in]inIdmodelview: You may give an ID for modelview, to connect on. -1 for automatic ID.
Returns
dtkNoError if ok.

◆ AddOverrideColor() [1/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::AddOverrideColor ( const Dtk_LightMapPtr inLightmap,
const Dtk_tab< Dtk_Int64 > &  inRoute,
Dtk_ID  inBodyID = 0 
)

Set a Lightmap for a specific instance.

Parameters
[in]inLightmap: Color to apply to instance.
[in]inRoute: Route to instance (see remarks of ConnectPMI_ModelView) but this time, final ID should be inInstanceID given with LastInstance_SetInstanceID
[in]inBodyID: Restrict a target for a body into an instance.
Remarks
functionnality supported only from version 10.0
Returns
dtkNoError if ok.

◆ AddOverrideColor() [2/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::AddOverrideColor ( const Dtk_RGB inRgb,
const Dtk_tab< Dtk_Int64 > &  inRoute,
Dtk_ID  inBodyID = 0 
)

Set an override color for a specific instance.

Parameters
[in]inRgb: Color to apply to instance.
[in]inRoute: Route to instance (see remarks of ConnectPMI_ModelView) but this time, final ID should be inInstanceID given with LastInstance_SetInstanceID
[in]inBodyID: Restrict a target for a body into an instance.
Remarks
functionnality supported only from version 10.0
Returns
dtkNoError if ok.

◆ AddPMI()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddPMI ( const Dtk_FdtPtr inPMI,
Dtk_Int64  inIdpmi = -1 
)

Add a fdt into the current node.

Parameters
[in]inPMI: PMI to Write.
[in]inIdpmi: You may give an ID for FDT, to connect on. -1 for automatic ID.
Returns
dtkNoError if ok.

◆ AddReferenceGeometry()

Dtk_ErrorStatus Dtk_Jtw_Interface::AddReferenceGeometry ( const Dtk_BodyPtr inRefgeom,
Dtk_Int64  inIdrefgeom = -1 
)

Add a reference geometry into the current node.

Remarks
Stored is a body as one face with plane for reference plane, wire segment for reference axis, wire point for reference point
Parameters
[in]inRefgeom: reference geometry to Write.
[in]inIdrefgeom: You may give an ID for reference geometry, to connect on. -1 for automatic ID.
Returns
dtkNoError if ok.

◆ CloseLastInstance()

Dtk_ErrorStatus Dtk_Jtw_Interface::CloseLastInstance ( )

Close the last opened node.

Remarks
Tree Contole method
Returns
dtkNoError if ok.

◆ ConnectModelView_Instance()

Dtk_ErrorStatus Dtk_Jtw_Interface::ConnectModelView_Instance ( Dtk_Int64  inIdmodelview,
const Dtk_tab< Dtk_Int64 > &  inRoute,
int  inHide = 0,
Dtk_ID  inBodyID = 0,
const Dtk_transfo inExplode = Dtk_transfo() 
)

Connect a ModelView on an Instance, for part representation restriction in a modelview.

Parameters
[in]inIdModelView: ModelView to Connect (ID given by AddModelView)
[in]inRoute: Route to instance (see remarks of ConnectPMI_ModelView) but this time, final ID should be inInstanceID given with LastInstance_SetInstanceID
[in]inHide: If instance is hidden (default add instance as visible)
[in]inBodyID: Restrict a target for a body into an instance.
[in]inExplode: Shift a particular instance to create exploded view. (not yet supported)
Returns
dtkNoError if ok.

◆ ConnectPMI_Geom()

Dtk_ErrorStatus Dtk_Jtw_Interface::ConnectPMI_Geom ( Dtk_Int64  inIdfdt,
Dtk_Int64  inGeomid,
type_detk  inTypegeom,
const Dtk_tab< Dtk_Int64 > &  inRoute = Dtk_tabDtk_Int64 >(),
Dtk_ID  inBodyID = 0 
)

Connect a PMI on a body face/edge/vertex.

Parameters
[in]inIdfdt: PMI to connect on (ID given with AddPMI)
[in]inGeomid: Geometry to link : DtkFacePtr::info()->GetId() / DtkEdgePtr::info()->GetId() / DtkVertexPtr::info()->GetId()
[in]inTypegeom: Type of connection : DTK_TYPE_FACE or DTK_TYPE_EDGE or DTK_TYPE_VERTEX
[in]inRoute: Route to body (see remarks of ConnectPMI_ModelView)
[in]inBodyID: For a case of multiple bodies added into same node, give the inBody->info()->GetId() filled with function AddBody
Returns
dtkNoError if ok.

◆ ConnectPMI_ModelView()

Dtk_ErrorStatus Dtk_Jtw_Interface::ConnectPMI_ModelView ( Dtk_Int64  inIdpmi,
Dtk_Int64  inIdModelView,
const Dtk_tab< Dtk_Int64 > &  inRoute = Dtk_tabDtk_Int64 >() 
)

Connect a PMI on a ModelView.

Parameters
[in]inIdpmi: PMI to connect. (ID given with AddPMI)
[in]inIdModelView: ModelView to Connect. (ID given with AddModelView)
[in]inRoute: if PMI is not in the same assembly node, indicate the route to reach it.
Remarks
: route should contain at least the final target node, the ID given as inIdpart in OpenInstance.
: for a full route, start with current assembly node ID, it can also contain some inInstanceID, but it should finish with a inIdpart
: if route is empty, API try to find automaticly.
Returns
dtkNoError if ok.

◆ ConnectPMI_PMI()

Dtk_ErrorStatus Dtk_Jtw_Interface::ConnectPMI_PMI ( Dtk_Int64  inIdpmifrom,
Dtk_Int64  inIdpmito,
const Dtk_tab< Dtk_Int64 > &  inRoute = Dtk_tabDtk_Int64 >() 
)

Connect a PMI on another PMI.

Parameters
[in]inIdpmifrom: PMI to link from (ID given with AddPMI)
[in]inIdpmito: PMI to link to (ID given with AddPMI)
[in]inRoute: Route to inIDfdt2 (see remarks of ConnectPMI_ModelView)
Returns
dtkNoError if ok.

◆ ExistIdPart()

Dtk_bool Dtk_Jtw_Interface::ExistIdPart ( Dtk_Int64  inIdpart) const

Ask the writer if a part already exist.

Remarks
Tree Contole method
Parameters
[in]inIdpart: ID of a part.
Returns
dtkNoError if ok.

◆ LastInstance_SetInstanceColor() [1/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::LastInstance_SetInstanceColor ( const Dtk_LightMapPtr inLightmap,
colorstrategy  inColorstrategy = keepsubcolor 
)

Set a Lightmap to previously opened instance. A lightmap is more complete that Dtk_RGB, this fonction override same fonction with Dtk_RGB.

Remarks
Tree Contole method
Parameters
[in]inLightmap: Color to apply to instance.
[in]inColorstrategy: see colorstrategy enum, with keepsubcolor color will affect only uncolored objects, overwritecolor will re-color all objects
Returns
dtkNoError if ok.

◆ LastInstance_SetInstanceColor() [2/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::LastInstance_SetInstanceColor ( const Dtk_RGB inRgb,
colorstrategy  inColorstrategy = keepsubcolor 
)

Set a Color to previously opened instance.

Remarks
Tree Contole method
Parameters
[in]inRgb: Color to apply to instance.
[in]inColorstrategy: see colorstrategy enum, with keepsubcolor color will affect only uncolored objects, overwritecolor will re-color all objects
Returns
dtkNoError if ok.

◆ LastInstance_SetInstanceID()

Dtk_ErrorStatus Dtk_Jtw_Interface::LastInstance_SetInstanceID ( Dtk_Int64  inInstanceID)

Set an instance ID to previously opened instance.

Remarks
Tree Contole method
Parameters
[in]inInstanceID: Giving an ID to this instance if a connector needs to target a specific instance
Returns
dtkNoError if ok.

◆ LastInstance_SetInvisible()

Dtk_ErrorStatus Dtk_Jtw_Interface::LastInstance_SetInvisible ( )

Set previously opened instance as invisible.

Remarks
Tree Contole method
Returns
dtkNoError if ok.

◆ OpenInstance() [1/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::OpenInstance ( const Dtk_string inName,
const Dtk_transfo inTrans = Dtk_transfo(),
const Dtk_string inExternfile = Dtk_string() 
)

Open a new Instance for the assembly writing.

Remarks
Tree Contole method

Note that at least a node must be opened before writing a mesh.

Returns
dtkNoError if ok.
Parameters
[in]inName: Name of the node (written in Jt2Go assembly tree)
[in]inTrans: Local matrix of the node. Default is an identity matrix.
[in]inExternfile: if string lengths>0, open a new file from this child, allowing multiple Jt files (shattered, perpart, percomponent, or customized)

◆ OpenInstance() [2/2]

Dtk_ErrorStatus Dtk_Jtw_Interface::OpenInstance ( const Dtk_string inName,
Dtk_Int64  inIdpart,
const Dtk_transfo inTrans = Dtk_transfo(),
const Dtk_string inExternfile = Dtk_string() 
)

Open a new Instance for the assembly writing.

Remarks
Note that at least a node must be opened before writing a mesh.
Tree Contole method
Returns
dtkNoError if ok.
Parameters
[in]inName: Name of the node (written in Jt2Go assembly tree)
[in]inIdpart: ID to reinstance a part : if you give 2 times the same ID, the part is reinstancied.
[in]inTrans: Local matrix of the node. Default is an identity matrix.
[in]inExternfile: if string lengths>0, open a new file from this child, allowing multiple Jt files (shattered, perpart, percomponent, or customized)
Returns
dtkNoError if ok.
Dtk_Jtw_Interface::version104
@ version104
Definition: jtw.h:33
Dtk_Jtw_Interface::version102
@ version102
Definition: jtw.h:31
Dtk_Jtw_Interface::version94
@ version94
Definition: jtw.h:27
Dtk_Jtw_Interface::version105
@ version105
Definition: jtw.h:34
Dtk_Jtw_Interface::version100
@ version100
Definition: jtw.h:29
Dtk_Jtw_Interface::feet
@ feet
Definition: jtw.h:44
Dtk_Jtw_Interface::keepsubcolor
@ keepsubcolor
Definition: jtw.h:17
Dtk_Jtw_Interface::meters
@ meters
Definition: jtw.h:42
Dtk_Jtw_Interface::kilometers
@ kilometers
Definition: jtw.h:48
Dtk_Jtw_Interface::version90
@ version90
Definition: jtw.h:23
Dtk_Jtw_Interface::xtbrep
@ xtbrep
Definition: jtw.h:13
Dtk_Jtw_Interface::centimeters
@ centimeters
Definition: jtw.h:41
Dtk_Jtw_Interface::version95
@ version95
Definition: jtw.h:28
Dtk_Jtw_Interface::nobrep
@ nobrep
Definition: jtw.h:12
Dtk_Jtw_Interface::version106
@ version106
Definition: jtw.h:35
Dtk_Jtw_Interface::version107
@ version107
Definition: jtw.h:36
Dtk_Jtw_Interface::decimeters
@ decimeters
Definition: jtw.h:47
Dtk_Jtw_Interface::inches
@ inches
Definition: jtw.h:43
Dtk_Jtw_Interface::version91
@ version91
Definition: jtw.h:24
Dtk_Jtw_Interface::version80
@ version80
Definition: jtw.h:22
Dtk_Jtw_Interface::version92
@ version92
Definition: jtw.h:25
Dtk_Jtw_Interface::yards
@ yards
Definition: jtw.h:45
Dtk_Jtw_Interface::micrometers
@ micrometers
Definition: jtw.h:46
Dtk_Jtw_Interface::version93
@ version93
Definition: jtw.h:26
Dtk_Jtw_Interface::millimeters
@ millimeters
Definition: jtw.h:40
Dtk_Jtw_Interface::miles
@ miles
Definition: jtw.h:50
Dtk_Jtw_Interface::version101
@ version101
Definition: jtw.h:30
Dtk_Jtw_Interface::overwritecolor
@ overwritecolor
Definition: jtw.h:18
Dtk_Jtw_Interface::mils
@ mils
Definition: jtw.h:49
Dtk_Jtw_Interface::version103
@ version103
Definition: jtw.h:32