Jump to content

Align 3 objects creating a corner in 3d space?


vanowm

Recommended Posts

screen.thumb.png.a0922d509a3b2c41f2bb0b9969cef802.pngYou can solve this graphically without knowing any angle, using align command. The only requirement is that distances A-D and A-E are equal (attached drawing).

 

Determine the point in space where points D and E will meet:

Draw a line D-F from point D, perpendicular to line A-B.
Draw a line E-G from poine E, perpendicular to line A-C.
Lines D-F and E-G intersect at point H
Draw a line H-K from point H, then type in:  @0,0,30 + Enter.

 

Set UCS to 3 points - H, D and K.

 

Draw a circle - center = point F, radius at point D.
Just drawn circle intersects line H-K at point M.

 

Start "align" command and select green figure.
First source point = A, first destination point = A
Second source point = B, second destination point = B
Third source point = D, third destination point = M

Align the red figure - A to A - C to C - E to M

3dcorner.dwg

 

Edited by paulmcz
  • Thanks 1
Link to comment
Share on other sites

@paulmcz

Thank you very much! I've tried this approach before posting, but failed because I draw H-K line to the size of A-D side and aligned the sides to its end. Apparently the intersection of the circle with that line is the key.

And a little note, the number 30 in the tutorial is an arbitrary number, preferably it should be not smaller than length of the A-D/A-E side, otherwise circle won't intersect it and an additional step would be needed to extend it.

Would you mind add a screenshot to your post, so it would be easier to following without opening the drawing.

 

For A-D/A-E with different lengths, a possible solution is to add "virtual" corner on the longest side (A-D or A-E) by drawing a circle from point A to E (or D whichever is the shortest, white circle in the screenshot) and where it intersects on longest side become D (or E) point:

image.png.e5889cc5781ce8646116f46f7b8115f6.png

Edited by vanowm
Link to comment
Share on other sites

I made line H-K 30 just to make sure it is long enough to intersect the circle and as you mentioned, to avoid the extra step of extending it. It could actually be any length as long as we are able to find where it intersect with the circle.

 

I added a screen shot to my previous post but somehow, compared to yours,  the quality is not good. How do you do it? Yours is perfect.

Link to comment
Share on other sites

@paulmcz  Yes, once the common point (your point M) is determined the align command can be used directly from the given and geometrically (or mathematically) determined points. It's nice to know the bend angles for fabrication purposes.

 

@vanowmHere's a diagram that shows the points I used in my program.

image.thumb.png.415d1cda67301b09b878555848ccd5b1.png

 

pA3 is the projection of pA2 onto the line define by pAB and pA1

 

Using vector algebra:

pA3 = pA1 + (dot product of vector (pA2 - pA1) with unit vector (pAB-pA1))

 

pB2 is redefined to be the same distance from pAB as pA2 is from pAB.

 

pB3 is the projection of pB2 onto the line definde by pAB and pB1

 

pInters is at the intersection of pA2 to pA3 and pB2 to pB3

 

The Z coordinate of pA4 (Az) can be determined from the right triangle  defined by points pInters, pA3, pA4 since we know the length of two sides of the triangle; pInters to pA3, and pA3 to pA4 which equals the distance from pA2 to pA3. A dot product of unit vectors of these two sides of the triangle yield the cosine of THETA A. 

 

The calculations for B are done in a similar manner.

 

My code has some leftover artifacts from the development process.  E.g., rB and Bz can be removed since the relocation of pB2 makes rB = rA and Bz = Az. 

 

 

 

 

 

Link to comment
Share on other sites

7 minutes ago, lrm said:

My code has some leftover artifacts from the development process.  E.g., rB and Bz can be removed since the relocation of pB2 makes rB = rA and Bz = Az. 

What confused me in your code is that global function rotatepoly is using local variables created inside c:fold

How?

Link to comment
Share on other sites

Creating the function rotatepoly was a kludge I used to solve the problem of wanting to have a prompt I specifed (that you can do with entsel) so I didn't want to use entget which is limited to a "Select Object" prompt.   I discovered that if I did not put the entsel in a separate function the user would not be prompted to select poly B.  I am not epxereinced with the LISP user interface idiosyncrasies.  I'm sure that there's a more elegant way to handle this. Yeah, it's probably not best practice to access a local variable like I did but I was getting tired and knew how the function would have only the one time use. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...