CompareGeometry API

Hi,
I'm trying to use the CompareGeometry API, but it doesn't seem to be working. Even when using the gtResultShowUI option I don't see any differences on screen.
More to the point, I'm interested in the SaveCompareVolumeResults, which is marked as obsolete. I tried it anyways and it gives an error. This is strange, since it's possible to do this through the UI.
Has this functionality been moved elsewhere?

Thanks!

Answers 4
NP
NP 2025-05-22

Have you turned on SolidWorks Utilities addin in Tools --> Addin? You need to turn on this addin for ICompareGeometry API to work. Use ICompareGeometry::CompareGeometry3 method to compare the volume and save results. Here is an example for your reference: 

 

JS
JS 2025-05-22

Yes, I have the addin turned on. The function call returns ok, with no error. But visually I don't see any results.
I used CompareGeometry3 but that only saves a report. I would like to save the bodies that are created by the comparison.

JS
JS 2025-05-22

There is a function called SaveCompareVolumeResults but it's marked as "Obsolete. Do not use". I tried using and it gave a general error, without saving any result.


This is at least possible through the UI, where you can keep the bodies on close. I tried this with the same parts that I tried through the API, and they worked when using the UI. So in theory it should be possible.

 

comment imagecomment image
NP
NP 2025-05-22

If it is marked "Do not use", then it is there for reason. Not sure about your situration but you might want to have a look at ICompareDocument::SaveCompareVolumeResults. If this doesn't work then only option is to cotnact API support team.