Author Topic: Help with 3D points  (Read 4510 times)

0 Members and 1 Guest are viewing this topic.

velasquez

  • Newt
  • Posts: 195
Help with 3D points
« on: December 02, 2015, 07:53:20 AM »
Hello Lee Mack
The LM function: Translate By its 2D Matrix Matrix Transformation.lsp code can be used with 3D points?

I need to work with a 3D block which was built with nested blocks.
I need to know the insertion points of each block with respect to the parent block.

Thanks
« Last Edit: December 02, 2015, 08:05:40 AM by velasquez »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Help with 3D points
« Reply #1 on: December 02, 2015, 11:04:55 AM »
The translation transformation is relatively trivial and only included for completeness; for a translation, you may find it easier to use mapcar, for example, the following expression will translate a given point by the vector '(1.0 2.0 3.0):
Code: [Select]
(mapcar '+ <Your-3D-Point> '(1.0 2.0 3.0))
To determine the insertion point of a nested block relative to that of the parent block reference, you will need to construct a transformation matrix which accounts for the position, scale, rotation & orientation of the parent block reference, and then apply this matrix to the vector between the origin of the parent block definition (which is usually 0,0) and the insertion point of the nested block within the parent block definition - you will find gile's refgeom function useful in this respect.
« Last Edit: December 02, 2015, 11:08:59 AM by Lee Mac »

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #2 on: December 02, 2015, 12:18:52 PM »
To determine the insertion point of a nested block relative to that of the parent block reference, you will need to construct a transformation matrix which accounts for the position, scale, rotation & orientation of the parent block reference.
Thank you Lee
With the hostage function (gile) I got the matrix of the parent block and nested block. I have no experience with matrix operations you can indicate me a way to learn?
« Last Edit: December 02, 2015, 01:34:56 PM by velasquez »

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #3 on: December 15, 2015, 02:30:56 PM »
When I select a nested block with NEXTEL I have the matrix below:
(caddr (nentsel)) -> ((-0.707107 -0.707107 -1.22465e-016) (-0.707107 0.707107 0.0) (8.65956e-017 8.65956e-017 -1.0) (580.528 1612.43 0.0))
Working with RefGeom (gile) I select the parent block and with the matrix below:
((-1.0 0.0 1.22465e-016) (0.0 1.0 0.0) (-1.22465e-016 0.0 -1.0) (475.0 0.0 0.0))
It also has the insertion point in the parent block - (580 528 1612.43 0.0)
I need to let the matrix obtained with Refem function (gile) just like matrix that I could with nentsel. It seems that this is possible but I'm not getting.

My experience with matrix is none.


Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Help with 3D points
« Reply #4 on: December 15, 2015, 02:39:54 PM »
I need to know the insertion points of each block with respect to the parent block.

For an existing example, you could refer to the code for my Extract Nested Block program - lines 60-92 of this program are calculating the transformation matrix required to transform a nested block (nested to any depth) to match its position relative to the primary parent block. To obtain the coordinates of the insertion point of the nested block relative to the primary parent block, you would merely require the translation vector which accompanies this matrix.

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #5 on: December 16, 2015, 11:43:06 AM »
I need to know the insertion points of each block with respect to the parent block.

For an existing example, you could refer to the code for my Extract Nested Block program - lines 60-92 of this program are calculating the transformation matrix required to transform a nested block (nested to any depth) to match its position relative to the primary parent block. To obtain the coordinates of the insertion point of the nested block relative to the primary parent block, you would merely require the translation vector which accompanies this matrix.

Thank you Lee
Your code is excellent. But the matrix I can with it is not the same as matrix (Caddr (nentsel)). I'll keep studying your code.
I'm working with the code of another person who uses a matrix obtained from nentsel the nested block. I need the same matrix but can not use nentsel on the nested block.
I posted a drawing of the test block.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Help with 3D points
« Reply #6 on: December 16, 2015, 02:18:54 PM »
Thank you Lee
Your code is excellent.

Thank you  :-)

But the matrix I can with it is not the same as matrix (caddr (nentsel)).

Please note that the transformation matrix constructed by my program maps the position of the nested block reference within its parent block definitions to its visual location in modelspace/paperspace relative to the parent block; whereas, the matrix returned by nentsel/nentselp maps the position of the innermost component of the block.

Therefore, if you require the transformation matrix for the selected block component, you will need to multiply the existing matrix by a transformation matrix which maps the block component to its parent block reference - i.e. in my code, add the nested block reference to the list of parent references: (cdr (reverse (cons (car sel) lst)))

Also a transposition may be required, due to the difference between the nentsel & nentselp matrices.
« Last Edit: December 16, 2015, 02:37:18 PM by Lee Mac »

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #7 on: December 16, 2015, 04:58:24 PM »
Quote
Please note that the transformation matrix constructed by my program maps the position of the nested block reference within its parent block definitions to its visual location in modelspace/paperspace relative to the parent block; whereas, the matrix returned by nentsel/nentselp maps the position of the innermost component of the block.

I thank you again Lee.
But my knowledge of matrix does not allow me to continue now with this theme.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Help with 3D points
« Reply #8 on: December 17, 2015, 06:24:19 AM »
Quote
Please note that the transformation matrix constructed by my program maps the position of the nested block reference within its parent block definitions to its visual location in modelspace/paperspace relative to the parent block; whereas, the matrix returned by nentsel/nentselp maps the position of the innermost component of the block.

I thank you again Lee.
But my knowledge of matrix does not allow me to continue now with this theme.

That's a shame, as I've already given you the solution in my above post to yield the matrix you require  :|

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #9 on: December 17, 2015, 11:02:24 AM »
Quote
Please note that the transformation matrix constructed by my program maps the position of the nested block reference within its parent block definitions to its visual location in modelspace/paperspace relative to the parent block; whereas, the matrix returned by nentsel/nentselp maps the position of the innermost component of the block.

I thank you again Lee.
But my knowledge of matrix does not allow me to continue now with this theme.

That's a shame, as I've already given you the solution in my above post to yield the matrix you require  :|

I'm sorry Lee, but I do not know why I should be ashamed for not having the same knowledge that you and even speak your language as well.
Novamanete I appreciate all your help. :|


Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Help with 3D points
« Reply #10 on: December 17, 2015, 12:37:52 PM »
Quote
Please note that the transformation matrix constructed by my program maps the position of the nested block reference within its parent block definitions to its visual location in modelspace/paperspace relative to the parent block; whereas, the matrix returned by nentsel/nentselp maps the position of the innermost component of the block.

I thank you again Lee.
But my knowledge of matrix does not allow me to continue now with this theme.

That's a shame, as I've already given you the solution in my above post to yield the matrix you require  :|

I'm sorry Lee, but I do not know why I should be ashamed for not having the same knowledge that you and even speak your language as well.
Novamanete I appreciate all your help. :|

Sorry - I think you may have misunderstood my last post - when I said "That's a shame", I did not mean that you should be ashamed of yourself (I would never be so rude!), but rather that it was unfortunate/disappointing to hear that you would not be pursuing this project, as I had already supplied the full solution above.

velasquez

  • Newt
  • Posts: 195
Re: Help with 3D points
« Reply #11 on: December 17, 2015, 01:33:52 PM »
Quote
Sorry - I think you may have misunderstood my last post - when I said "That's a shame", I did not mean that you should be ashamed of yourself (I would never be so rude!), but rather that it was unfortunate/disappointing to hear that you would not be pursuing this project, as I had already supplied the full solution above.

Hi Lee
I did not want to seem rude.
The reason not to pursue the project is that my little knowledge of the subject and its language makes it difficult to implement your solution.