System Information
- SolidWorks 2025 SP3.0
- Exporter built from the current master branch, which supported exporting 3Dxml mesh. 25da24a
- Used the newest Visual Studio 2026 and downloaded .NET framework 4.5.2 through GUI selection.
Describe the bug
When choosing to export 3DXML mesh, the inertial coordinate and origin will be wrong. And the mesh visual & collision origin will be moved to a non-zero position. However, it did not occur when exporting STL mesh.
Attach an example of a corrected URDF (if applicable)
For example:
Correct link description:
<link
name="link1">
<inertial>
<origin
xyz="-4.25276711366115E-05 -0.0521083506437214 3.30922419012653E-05"
rpy="0 0 0" />
<mass
value="1.10516612558593" />
<inertia
ixx="0.0011467220817532"
ixy="4.56341749738292E-06"
ixz="4.04230212122036E-08"
iyy="0.00076956530171518"
iyz="2.55991718742978E-08"
izz="0.000726190082275875" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://robot/meshes/link1.STL" />
</geometry>
<material
name="">
<color
rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://robot/meshes/link1.STL" />
</geometry>
</collision>
</link>
Exported with 3dxml mesh:
<link
name="link1">
<inertial>
<origin
xyz="-4.25276711366065E-05 0.0103916493562786 3.30922419012695E-05"
rpy="0 0 0" />
<mass
value="1.10516612558593" />
<inertia
ixx="0.0011467220817532"
ixy="-4.56341749738292E-06"
ixz="-4.04230212122051E-08"
iyy="0.00076956530171518"
iyz="-2.55991718742988E-08"
izz="0.000726190082275875" />
</inertial>
<visual>
<origin
xyz="4.73542936439196E-18 0.0625 -1.977613391583E-19"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://robot/meshes/link1.3dxml" />
</geometry>
<material
name="">
<color
rgba="0.752941176470588 0.752941176470588 0.752941176470588 1" />
</material>
</visual>
<collision>
<origin
xyz="4.73542936439196E-18 0.0625 -1.977613391583E-19"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://robot/meshes/link1.3dxml" />
</geometry>
</collision>
</link>
Known Reason
Comment out this line like:
diff --git a/SW2URDF/URDFExport/ExportHelper.cs b/SW2URDF/URDFExport/ExportHelper.cs
--- a/SW2URDF/URDFExport/ExportHelper.cs
+++ b/SW2URDF/URDFExport/ExportHelper.cs
@@ -1978,7 +1978,11 @@ namespace SW2URDF.URDFExport
private void Save3dxml(Link link, string path)
{
- LocalizeLink(link, GlobalTransform);
+ // Do not localize assembly links here.
+ // LocalizeLink() mutates link-level inertial / visual / collision
+ // origins and inertia tensors, which then leak into the URDF
+ // written later in the export pipeline.
+ // LocalizeLink(link, GlobalTransform);
int errors = 0;
int warnings = 0;
int saveOptions = (int)swSaveAsOptions_e.swSaveAsOptions_Silent;
But I am not sure if this line is working for some other features.
Then inertial will be correct, but the mesh's origin will be wrong.
At last, I ased CodeX for help and found that setting origins of 3dxml meshes to 0s was still difficult. But Inertial finally returned to the correct pos.
System Information
Describe the bug
When choosing to export 3DXML mesh, the inertial coordinate and origin will be wrong. And the mesh visual & collision origin will be moved to a non-zero position. However, it did not occur when exporting STL mesh.
Attach an example of a corrected URDF (if applicable)
For example:
Correct link description:
Exported with 3dxml mesh:
Known Reason
Comment out this line like:
But I am not sure if this line is working for some other features.Then inertial will be correct, but the mesh's origin will be wrong.
At last, I ased CodeX for help and found that setting origins of 3dxml meshes to 0s was still difficult. But Inertial finally returned to the correct pos.