How to compare 3D solid CAD files?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Post Reply
rj771972
Posts: 13
Joined: Tue Jun 21, 2016 2:57 pm

How to compare 3D solid CAD files?

Post by rj771972 »

Hello,

I have two HFSS project files that are supposed to give the same analysis results.
I would like to compare the CAD solid objects of the two files to see if they are identical
Is there a way to do this in FreeCAD? The structures are quite complicated and I would like to have a script that does that.

Thank you
Last edited by Kunda1 on Thu Jun 30, 2022 2:02 pm, edited 1 time in total.
Reason: Removed shouting-case
NewJoker
Veteran
Posts: 1162
Joined: Sun Oct 11, 2020 7:49 pm

Re: HOW TO COMPARE 3D SOLID CAD FLES

Post by NewJoker »

If you can ensure their identical placement (position and rotation), you can try using boolean operations on them or comparing the center of mass and moments of inertia. Another way would be to check the area/volume.
adrianinsaval
Veteran
Posts: 3093
Joined: Thu Apr 05, 2018 5:15 pm

Re: HOW TO COMPARE 3D SOLID CAD FLES

Post by adrianinsaval »

boolean operations can be rather computationally expensive and might be prone to failure given the multiple coplanar/coincident surfaces expected. I remember some CAD training exercises that gave you the resulting volume to validate your result but the objects were single parts so it might not be a good solution for complex stuff, moments of inertia and center of mass sound like good ideas too. Those are all available through python I think so it should be possible to make a macro.
rj771972
Posts: 13
Joined: Tue Jun 21, 2016 2:57 pm

Re: How to compare 3D solid CAD files?

Post by rj771972 »

I was thinking to simply subtract the corresponding objects, however when I did that I got errors which might be expected (since if the objects are the same I get a void object, or if some surfaces are identical I get a null surface), but I couldn't find another solution.

What I think might work is do the subtraction in a script and if the result is a void issue a message.
do that in a loop over all the objects.
Unfortunately scripting is not my forte.
adrianinsaval
Veteran
Posts: 3093
Joined: Thu Apr 05, 2018 5:15 pm

Re: How to compare 3D solid CAD files?

Post by adrianinsaval »

so volume + center of mass + moment of inertia is not valid for you? like I said boolean ops are a bad idea.
rj771972
Posts: 13
Joined: Tue Jun 21, 2016 2:57 pm

Re: How to compare 3D solid CAD files?

Post by rj771972 »

I guess that could work
openBrain
Veteran
Posts: 7988
Joined: Fri Nov 09, 2018 5:38 pm

Re: How to compare 3D solid CAD files?

Post by openBrain »

Post Reply