Hi Tim,
As I read your question, it seems you want to create a 4x4 transformation matrix from an object. Presumably from a block.
If so, you probably already have my ObjMatrix functions, which are designed to do exactly that, going either way.
Hey Joe,
Yea I have yours, and I used yours as a guide. I wanted to understand it better, so I wrote my own, and when I got stuck I would look at yours. That is how I saw to use the function 'vlax-tmatrix' because I saw you use it. I was just trying to get a better understand of why you used it. Thanks again for your code.
Hi Tim,
I'm sorry, I sorta forgot about this topic.
Just to be clear, the vlax-tmatrix function is not called within my ObjMatrix v2.lsp set of routines. It's used with the *returned* values of those functions in conjunction with the TransformBy method.
For instance, (ObjMatrix <block reference>) returns exactly the same 4x4 matrix as nentselp assuming a nested object was selected which is only nested one level deep. That matrix allows transformations from OCS to WCS. And when that's passed to vlax-tmatrix it does a conversion which allows the TransformBy method to use it.
The same is true for InverseObjMatrix. But it returns the inverse matrix, which is the hard part, transformations from WCS to OCS. There is no equivalent of this anywhere in out-of-the-box lisp or vlisp that I know of.
But of course, I could be wrong about that. If so, I don't why others smarter than me have looked for a solution to the same problem.
Also note, last time I checked, the TransformBy method cannot deal with matricies derived from non uniformaly scaled blocks. It will error in that case. That's not a limitation of my functions as it is not a limitation of nentselp. Both return the correct transformation matrix with NUS blocks.
You simply have to check for that where appropriate.
Joe