Use CloudCompare as Git diff tool to check model difference

Feel free to ask any question here
Post Reply
jindili
Posts: 6
Joined: Fri Jan 01, 2021 8:26 am

Use CloudCompare as Git diff tool to check model difference

Post by jindili »

I want to configure CloudCompare as 3d model diff tool to check places been modifed between two git versions,

Now I just pass two .stl file path to CloudCompare, It launches the GUI and load these two stl models successfully,
But I need something further, can I pass some more options to CloudCompare to make it automatically Compute Cloud/Mesh Distance after these two stl files been loaded in the GUI.

I tried add optioin -C2M_DIST, but that make it run in command line mode, but I do need to launch the GUI.

Got no lucky to find any option I can use in the command line options list page:
https://www.cloudcompare.org/doc/wiki/i ... _line_mode
daniel
Site Admin
Posts: 7374
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Use CloudCompare as Git diff tool to check model difference

Post by daniel »

Well, you could first use the command line tool to compute the distances, and then launch CloudCompare to open the resulting file?
Daniel, CloudCompare admin
jindili
Posts: 6
Joined: Fri Jan 01, 2021 8:26 am

Re: Use CloudCompare as Git diff tool to check model difference

Post by jindili »

I'll go that way if it's the only way close to my needs.
But I think it would be much better if it's possible to load these two files in the GUI then compute the Cloud/Mesh distance since that way I could tweak those options interactively to get a better result which is not viable from the command line.
jindili
Posts: 6
Joined: Fri Jan 01, 2021 8:26 am

Re: Use CloudCompare as Git diff tool to check model difference

Post by jindili »

I manage to automate this task using Autohotkey Script,
It take me quite some time, so I post those staffs used in my workflow here,
It might help some if you need to do something similar.

Workflow in CloudCompare GUI:
  • select those two meshes imported in the DB Tree
  • Clik the Compute Cloud/Mesh Distance button
  • Clik OK on the Choose Role dialog
  • Move the Distance computation dialog to a left position not overlapping the 3d view
  • Uncheck the signed distance option on the Distance computation dialog
  • Send Enter to Compute and update the result in 3d view
and bind a hotkey to the Workflow, in my case Ctrl + x

Autohotkey script I used:

Code: Select all

#IfWinActive ahk_exe CloudCompare.exe
^x::
Click, 150, 150
Send ^{Click, 150, 190}  ; Control+Click
WinGet, hWnd, ID, A
oAcc := Acc_Get("Object", "4.6.17", "ahk_id " hWnd)
oAcc.accDoDefaultAction(0)

WinWait, Choose role ahk_class Qt5QWindowToolSaveBits, , 2
if ErrorLevel
{
    MsgBox, WinWait timed out.
    return
}

WinActivate, Choose role ahk_class Qt5QWindowToolSaveBits
WinWaitActive, Choose role ahk_class Qt5QWindowToolSaveBits
Send {Enter}


WinWait, Distance computation ahk_class Qt5QWindowToolSaveBits, , 2
if ErrorLevel
{
    MsgBox, WinWait timed out.
    return
}

WinActivate, Distance computation ahk_class Qt5QWindowToolSaveBits
WinWaitActive, Distance computation ahk_class Qt5QWindowToolSaveBits
WinMove, 52, 515
WinGet, hWnd3, ID, A
oAcc := Acc_Get("Object", "4.5.1.1.5", "ahk_id " hWnd3)
oAcc.accDoDefaultAction(0)
Send {Enter}

return

^z::
Click, 150, 150
Send ^{Click, 150, 190}  ; Control+Click
return

#IfWinActive
Software and Lib Scripts Used for the script above to work properly:
AutoHotkey
https://www.autohotkey.com/

Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://www.autohotkey.com/boards/viewt ... =6&t=26201

The acc path is kind a confuse, use tool linked below to get the right acc path
https://gist.github.com/tmplinshi/0fcb8 ... 8d0d974915
Post Reply