Points in Dynamo and Revit API are misaligned

Hello everyone, I am working on a tool for creating opening holes based on an idea by Gavin Crump in this video: Create Wall Penetrations using Dynamo! - YouTube

The idea of rotating geometry to get the dimensions of the opening hole is really interesting. I have successfully implemented it in Dynamo. Now, I am trying to create a pyRevit button. The issue I am facing is that the dimensions of the opening hole in Dynamo and Revit API are slightly different (as shown in image 1).


I tried using DirectShape to create the union solid block after rotating and noticed it was misaligned compared to the union solid block in Dynamo (image 2).

Upon further investigation, I discovered that it might be due to the solid centroid between Dynamo and Revit API not aligning (image 3), which could cause the solid block to shift after rotation.

Is there any way for me to achieve the same result as in Dynamo? Because I find the result in Dynamo to be more accurate. The Google Drive link below contains all my code, the Revit file, and the Dynamo file. I hope you can take a look and help me out.
(Wall Opening.7z - Google Drive)

@Luffy11

looks like a conversation issue

yes, I have thought about it too. So I have made 2 functions to convert feet to millimeters and viscera, but I still can’t get the result like in Dynamo. You can find those functions in the Core.py in the Lib folder that I uploaded in GG drive.