Author Topic: about transform matrix  (Read 2833 times)

0 Members and 1 Guest are viewing this topic.

FengK

  • Guest
about transform matrix
« on: March 19, 2008, 04:00:47 AM »
i spent some time the other day trying to gain a bit more knowledge about transform matrix. i didn't came to any solid conclusion before i had to work on something else. here is my question: within the current drawing, if you nentsel an entity from xref or nested xref (the entity itself might be nested in a block too), you can get a matrix. if you use objectdbx to open the xref and copy that entity into the current drawing. can you use that matrix to transform the copied entity so that it will be identical (same position, same size, same rotation, etc.) to the original nested entity?

i'll continue my digging on this subject, but figured someone here probably has done homework on this. thanks for your input.

gile

  • Gator
  • Posts: 2520
  • Marseille, France
Re: about transform matrix
« Reply #1 on: March 19, 2008, 04:25:31 AM »
Speaking English as a French Frog

Joe Burke

  • Guest
Re: about transform matrix
« Reply #2 on: March 19, 2008, 09:05:48 AM »
i spent some time the other day trying to gain a bit more knowledge about transform matrix. i didn't came to any solid conclusion before i had to work on something else. here is my question: within the current drawing, if you nentsel an entity from xref or nested xref (the entity itself might be nested in a block too), you can get a matrix. if you use objectdbx to open the xref and copy that entity into the current drawing. can you use that matrix to transform the copied entity so that it will be identical (same position, same size, same rotation, etc.) to the original nested entity?

i'll continue my digging on this subject, but figured someone here probably has done homework on this. thanks for your input.

Hi Kelie,

What your said is essentially correct in terms of copying an object from an xref into the active file. One minor issue, you would use the 4x4 matrix returned by nentselp rather than the nentsel 4x3 matrix because the TransformBy method requires a 4x4 matrix.

Digging deeper... let's assume you might want to copy a block from an xref into the active file. The nentselp matrix is of no use in that case because it applies to the deepest nested object. At that point you need a set of functions which can calculate the transformation matrix given only the block object as an argument. That's what the ObjMatrix functions do which were mentioned in the thread gile pointed to.

I will post them here if you are interested.

FengK

  • Guest
Re: about transform matrix
« Reply #3 on: March 19, 2008, 12:34:26 PM »
Hi,

You can see this thread:
http://www.theswamp.org/index.php?topic=14771.0

gile, thanks for the link. that's a lot of info.

FengK

  • Guest
Re: about transform matrix
« Reply #4 on: March 19, 2008, 12:55:06 PM »
What your said is essentially correct in terms of copying an object from an xref into the active file. One minor issue, you would use the 4x4 matrix returned by nentselp rather than the nentsel 4x3 matrix because the TransformBy method requires a 4x4 matrix.

Joe, Thanks for the clarification. Came across this function while searching matrix related info.

(defun 4x3->4x4   (matrix)
  (append (apply 'mapcar (cons 'list matrix))
     '((0.0 0.0 0.0 1.0))
  )
)

From my very limited testing, it can be used to convert the 4x3 matrix from nentsel to a 4x4 one that can be used for TransformBy method.

Digging deeper... let's assume you might want to copy a block from an xref into the active file. The nentselp matrix is of no use in that case because it applies to the deepest nested object. At that point you need a set of functions which can calculate the transformation matrix given only the block object as an argument. That's what the ObjMatrix functions do which were mentioned in the thread gile pointed to.

I'm aware of your ObjMatrix function and have used it a few times. Thanks.





Joe Burke

  • Guest
Re: about transform matrix
« Reply #5 on: March 20, 2008, 12:09:46 PM »
Kelie,

I think I recognize that function as one by John Uhden which was part of a discussion among John, Doug Broad and Larry Leuallen some years ago.

While it still may be valid, I think we've moved beyond what that discussion taught us. Which were very valuable lessons in terms of the guts of the issues in question.

If you've seen Larry's excellent code, you know it's very involved. Many functions spanning many hundreds of lines of code.

What I and others (James Allen for one) have tried to do is expand on what Larry, Doug and John taught us, while also trying to make the code more accessible to casual LISP programmers.

FengK

  • Guest
Re: about transform matrix
« Reply #6 on: March 20, 2008, 12:46:05 PM »
If you've seen Larry's excellent code, you know it's very involved. Many functions spanning many hundreds of lines of code.

yeah, i agree. yesterday i followed the link gile gave and there were more links in those discussions. there is a lot of info about vector, matrix, transform, etc., i ended up printing dozens of pages. (i'm attending a training for a couple of days, and was hoping i can find some time to do some reading in the breaks.)