@@ -172,22 +172,21 @@ std::pair<bool, iDynTree::Transform> getTransformFromPart(pfcModel_ptr modelhdl,
172
172
return { false , H_child };
173
173
}
174
174
175
- std::tuple<bool , iDynTree::Direction, iDynTree::Position > getAxisFromPart (pfcModel_ptr modelhdl, const std::string& axis_name, const string& link_frame_name, const array<double , 3 >& scale) {
175
+ std::tuple<bool , iDynTree::Direction, iDynTree::Transform > getAxisFromPart (pfcModel_ptr modelhdl, const std::string& axis_name, const string& link_frame_name, const array<double , 3 >& scale) {
176
176
177
177
iDynTree::Direction axis_unit_vector;
178
- iDynTree::Position axis_offset;
179
- axis_offset.zero ();
178
+ iDynTree::Transform oldChild_H_newChild = iDynTree::Transform::Identity ();
180
179
axis_unit_vector.zero ();
181
180
182
181
auto axes_list = modelhdl->ListItems (pfcModelItemType::pfcITEM_AXIS);
183
182
if (axes_list->getarraysize () == 0 ) {
184
183
printToMessageWindow (" There is no Axis in the part " + string (modelhdl->GetFullName ()), c2uLogLevel::WARN);
185
184
186
- return { false , axis_unit_vector, axis_offset };
185
+ return { false , axis_unit_vector, oldChild_H_newChild };
187
186
}
188
187
189
188
if (axis_name.empty ())
190
- return { false , axis_unit_vector, axis_offset };
189
+ return { false , axis_unit_vector, oldChild_H_newChild };
191
190
192
191
pfcAxis* axis = nullptr ;
193
192
@@ -208,11 +207,11 @@ std::tuple<bool, iDynTree::Direction, iDynTree::Position> getAxisFromPart(pfcMod
208
207
// We use the medium point of the axis as offset
209
208
pfcPoint3D_ptr pstart = axis_line->GetEnd1 ();
210
209
pfcPoint3D_ptr pend = axis_line->GetEnd2 ();
211
- axis_offset[0 ] = ((pend->get (0 ) + pstart->get (0 )) / 2.0 ) * scale[0 ];
212
- axis_offset[1 ] = ((pend->get (1 ) + pstart->get (1 )) / 2.0 ) * scale[1 ];
213
- axis_offset[2 ] = ((pend->get (2 ) + pstart->get (2 )) / 2.0 ) * scale[2 ];
210
+ auto x = ((pend->get (0 ) + pstart->get (0 )) / 2.0 ) * scale[0 ];
211
+ auto y = ((pend->get (1 ) + pstart->get (1 )) / 2.0 ) * scale[1 ];
212
+ auto z = ((pend->get (2 ) + pstart->get (2 )) / 2.0 ) * scale[2 ];
213
+ oldChild_H_newChild.setPosition ({ x, y, z });
214
214
215
- printToMessageWindow (" Axis offset: " + axis_offset.toString ());
216
215
}
217
216
218
217
// There are just two points in the array
@@ -227,12 +226,11 @@ std::tuple<bool, iDynTree::Direction, iDynTree::Position> getAxisFromPart(pfcMod
227
226
228
227
229
228
auto & csys_H_child = getTransformFromPart (modelhdl, link_frame_name, scale).second ;
230
- printToMessageWindow (" csys_H_child: " + csys_H_child.toString ());
231
229
232
230
axis_unit_vector = csys_H_child.inverse () * axis_unit_vector; // We might benefit from performing this operation directly in Creo
233
231
axis_unit_vector.Normalize ();
234
232
235
- return { true , axis_unit_vector, axis_offset };
233
+ return { true , axis_unit_vector, oldChild_H_newChild };
236
234
}
237
235
238
236
std::string extractFolderPath (const std::string& filePath) {
0 commit comments