@@ -40,8 +40,6 @@ bool Creo2Urdf::processAsmItems(pfcModelItems_ptr asmListItems, pfcModel_ptr mod
40
40
continue ;
41
41
}
42
42
43
- // printToMessageWindow("Processing " + string(component_handle->GetFullName()) + " Owner " + string(model_owner->GetFullName()));
44
-
45
43
xintsequence_ptr seq = xintsequence::create ();
46
44
seq->append (asmItemAsFeat->GetId ());
47
45
@@ -126,10 +124,10 @@ bool Creo2Urdf::processAsmItems(pfcModelItems_ptr asmListItems, pfcModel_ptr mod
126
124
127
125
LinkInfo l_info{ urdf_link_name, component_handle, parentAsm_H_linkFrame, csysAsm_H_linkFrame, link_frame_name };
128
126
link_info_map.insert (std::make_pair (link_name, l_info));
129
- populateExportedFrameInfoMap (component_handle );
127
+ populateExportedFrameInfoMap (l_info );
130
128
131
129
idyn_model.addLink (urdf_link_name, link);
132
- if (!addMeshAndExport (component_handle, link_frame_name )) {
130
+ if (!addMeshAndExport (l_info )) {
133
131
printToMessageWindow (" Failed to export mesh for " + link_name, c2uLogLevel::WARN);
134
132
if (warningsAreFatal) {
135
133
return false ;
@@ -544,12 +542,12 @@ iDynTree::SpatialInertia Creo2Urdf::computeSpatialInertiafromCreo(pfcMassPropert
544
542
return sp_inertia;
545
543
}
546
544
547
- void Creo2Urdf::populateExportedFrameInfoMap (pfcModel_ptr modelhdl ) {
545
+ void Creo2Urdf::populateExportedFrameInfoMap (LinkInfo& link_info ) {
548
546
549
547
// The revolute joints are defined by aligning along the
550
548
// rotational axis
551
- auto link_name = string (modelhdl-> GetFullName ()) ;
552
- auto csys_list = modelhdl->ListItems (pfcModelItemType::pfcITEM_COORD_SYS);
549
+ auto link_name = link_info. name ;
550
+ auto csys_list = link_info. modelhdl ->ListItems (pfcModelItemType::pfcITEM_COORD_SYS);
553
551
554
552
if (csys_list->getarraysize () == 0 ) {
555
553
printToMessageWindow (" There is no CSYS in the part " + link_name, c2uLogLevel::WARN);
@@ -572,14 +570,13 @@ void Creo2Urdf::populateExportedFrameInfoMap(pfcModel_ptr modelhdl) {
572
570
573
571
if (exported_frame_info_map.find (csys_name) != exported_frame_info_map.end ()) {
574
572
auto & exported_frame_info = exported_frame_info_map.at (csys_name);
575
- auto & link_info = link_info_map.at (link_name);
576
573
bool ret{ false };
577
574
iDynTree::Transform csys_H_additionalFrame {iDynTree::Transform::Identity ()};
578
575
iDynTree::Transform csys_H_linkFrame {iDynTree::Transform::Identity ()};
579
576
iDynTree::Transform linkFrame_H_additionalFrame {iDynTree::Transform::Identity ()};
580
577
581
- std::tie (ret, csys_H_additionalFrame) = getTransformFromPart (modelhdl, csys_name, scale);
582
- std::tie (ret, csys_H_linkFrame) = getTransformFromPart (modelhdl, link_info.link_frame_name , scale);
578
+ std::tie (ret, csys_H_additionalFrame) = getTransformFromPart (link_info. modelhdl , csys_name, scale);
579
+ std::tie (ret, csys_H_linkFrame) = getTransformFromPart (link_info. modelhdl , link_info.link_frame_name , scale);
583
580
584
581
linkFrame_H_additionalFrame = csys_H_linkFrame.inverse () * csys_H_additionalFrame;
585
582
exported_frame_info.linkFrame_H_additionalFrame = linkFrame_H_additionalFrame;
@@ -649,12 +646,12 @@ void Creo2Urdf::readExportedFramesFromConfig() {
649
646
}
650
647
}
651
648
652
- bool Creo2Urdf::addMeshAndExport (pfcModel_ptr component_handle, const std::string& mesh_transform )
649
+ bool Creo2Urdf::addMeshAndExport (const LinkInfo& link_info )
653
650
{
654
651
bool export_mesh = true ;
655
652
std::string file_extension = " .stl" ;
656
653
std::string meshFormat = " stl_binary" ;
657
- std::string link_name = component_handle ->GetFullName ();
654
+ std::string link_name = link_info. modelhdl ->GetFullName ();
658
655
std::string renamed_link_name = link_name;
659
656
660
657
if (config[" rename" ][link_name].IsDefined ())
@@ -717,13 +714,13 @@ bool Creo2Urdf::addMeshAndExport(pfcModel_ptr component_handle, const std::strin
717
714
718
715
try {
719
716
if (meshFormat == " stl_binary" ) {
720
- component_handle ->Export (mesh_file_name.c_str (), pfcExportInstructions::cast (pfcSTLBinaryExportInstructions ().Create (mesh_transform .c_str ())));
717
+ link_info. modelhdl ->Export (mesh_file_name.c_str (), pfcExportInstructions::cast (pfcSTLBinaryExportInstructions ().Create (link_info. link_frame_name .c_str ())));
721
718
}
722
719
else if (meshFormat ==" stl_ascii" ) {
723
- component_handle ->Export (mesh_file_name.c_str (), pfcExportInstructions::cast (pfcSTLASCIIExportInstructions ().Create (mesh_transform .c_str ())));
720
+ link_info. modelhdl ->Export (mesh_file_name.c_str (), pfcExportInstructions::cast (pfcSTLASCIIExportInstructions ().Create (link_info. link_frame_name .c_str ())));
724
721
}
725
722
else if (meshFormat == " step" ) {
726
- component_handle ->ExportIntf3D (mesh_file_name.c_str (), pfcExportType::pfcEXPORT_STEP);
723
+ link_info. modelhdl ->ExportIntf3D (mesh_file_name.c_str (), pfcExportType::pfcEXPORT_STEP);
727
724
}
728
725
else {
729
726
return false ;
0 commit comments