r/OpenPythonSCAD • u/rebuyer10110 • Oct 15 '24
Is an inverse() function supported to invert a handle?
I typically follow the pattern of translating + rotating a component during assembly to do touch up work, and perform inverse movement to put the component back to its original position to prep for printing on the base plate.
I have been utilizing handles for this a lot.
The pain point I ran into: I really could use numpy's np.linalg.inv() to calculate the inverse eigen vector to restore a component back to its original position.
Questions:
- Is there a way to import libraries I install from pip into pythonscad's run time? I see a File > Show Library Folder. Is that where I can place dependencies? It is still clunky for numpy since it has a chain of py files I would need to copy over.
- Is there a built-in matrix inverse operator I can use right now?
3
Upvotes
View all comments
Show parent comment
1
u/rebuyer10110 Oct 19 '24 edited Oct 19 '24
Is there logging that shows which Python PythonSCAD is using?
I did Help > Library Info and it does not show the Python path.
I presume it's just $PATH (or whatever the Windows equivalent is).
For now, I am getting by with printing the object handle, throw the 4x4 matrix into Python running in Linux (windows subsystem linux) with numpy installed with pip and run numpy to get the inverse, haha.
I am running issues where I am able to have a valid inverse 4x4 matrix, but calling align() does not restore the shape to origin.
Here's some sample code to show what I am seeing: