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/gadget3D Oct 22 '24
Np, its hard to get that into the head initially, but once you realize, it makes much more sense
IMHO there might not be a need to really understand the internals, just 1st handle is the handle on the object, which is settled already, 2nd handle is the object being attached. this might help.
Sorry, there is very little documentation on align yet, generally I am very bad in documenting and realizing the key facts which others need to comprehend. WillAdams is working on a WIKI FYI
If you pass only one argument to align, second argument is 1, which translates to unity matrix, and this is the untransformed origin of the being-attached object
if you want to do use like obj.align(A=1,B), you need to provide an unity matrix in 1sr argument,
which is
obj.align(baseplate.origin, B) # from previous post
or more simply:
obj.divmatrix(B) # from previous post
Hope that helps