Jump to content

How do I accomplish this rotation?


Recommended Posts

Hey guys, another quick one here.

 

I'm trying to rotate objects around an ellipse. Here's a quick look at what I'm trying to do:

 

attachment.php?attachmentid=60641&cid=1&stc=1

 

I want to rotate that second box on the right so that it faces the center of the ellipse, yet remains connected to the first box at the front corner.

 

Here's a close up:

 

attachment.php?attachmentid=60642&cid=1&stc=1

 

Basically I want to rotate around the point indicated by the blue circle, and end up where the red line is lined up with the ellipse's center.

 

For the life of me, I can't get this to work. I start the ROTATE command, and select that point. Then I hit R for reference, then select two points on the red line, then select the center of the ellipse, but for some reason it only rotates enough as if the blue point were the reference point.

 

In other words, this is what I get:

 

attachment.php?attachmentid=60643&cid=1&stc=1

 

Am I just totally borking the ROTATE command? Or is this even possible to do?

 

Thanks for the help.

ellipse1.jpg

ellipse2.jpg

ellipse3.jpg

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • oftenly

    8

  • ReMark

    6

  • BIGAL

    3

  • lrm

    3

Top Posters In This Topic

Posted Images

Stop giving yourself a headache and download Lee Mac's custom lisp routine called Align Objects to Curve. The demo he provides will give you some idea of how it works. First, however, read the program description.

 

http://lee-mac.com/objectalign.html

 

Holy smokes, very cool! I'll definitely check this out... I have a bunch of different shapes to align to this damn ellipse. This thread was good for something! Thanks!

Link to comment
Share on other sites

Sorry, I mean aligning that red centerline with the center of the ellipse isn't what I wanted; the rotation is too extreme, which makes sense for an ellipse.

Link to comment
Share on other sites

So if you were to rotate the box with the red line in it, and get it (the red line) passing through the center of the ellipse, a portion of the bottom of the box will be inside the ellipse. And that's an acceptable result?

Link to comment
Share on other sites

This is my attempt.

 

First image is the "before" rotate. Second image is "after" rotate. Is the second image the result you are looking for?

 

EllipseRotate1.JPG

 

EllipseRotate2.JPG

Link to comment
Share on other sites

Yep, that's perfect, although after I made the thread I realized that's not exactly what I wanted to begin with. What I really want is to align the "front" face of the green box with the ellipse, which is just a matter of drawing a circle and rotating the box so that the other "front" corner intersects the ellipse. So you end up with an circular segment's worth of the green box that's inside the ellipse, but that's OK.

 

But, this is more easily done with that LISP you posted earlier.

Link to comment
Share on other sites

Yes, but I'm dealing with a much more sinister one right now.

 

Let me clue you in, for funsies:

 

attachment.php?attachmentid=60650&cid=1&stc=1

 

Basically, this is me trying to arrange some casework (white rectangles) underneath an elliptical countertop. I'm trying to get 7 more-or-less equal-width boxes in this area, with a consistent maximum setback of 1-1/2"... and I think I'm about to cry.

 

My geometry skills are half-decent (I can fumble my way around a trig function), but this seems like a whole different level. Do you have any ideas about how this might be done easily? Right now I'm rotating and resizing the top three boxes by hand, which is totally not ideal.

 

The red lines are from me running the DIVIDE command, although those arc lengths are not equal. Ignore that other horizontal white line off to the right, I don't know what it's doing there.

devil.jpg

Link to comment
Share on other sites

You might have better luck obtaining help with a solution if you attach a copy of the drawing (basically what you have shown above) to your next post. That way we'll have exactly what you are describing to work with.

Link to comment
Share on other sites

I don't think you want the red line to pass through the center of the ellipse. The tangent line at any point on an ellipse is perpendicular to the angle bisector of the two lines going from the ellipse point to the two foci of the ellipse. There may be a way to use the parametric constraint features of AutoCAD to help with this. A point on the ellipse is defined by a constant that is the sum of the distances from a focus to the ellipse curve and back to the other focus. You can make one of these parametric dimensions a fixed value and the other the difference between it and the constant. The tangent is easy to define via the angle bisector.

 

This is all better explained with a picture or two. I need to work on something else right now but will explore this further if you are interested.

 

~Lee

Link to comment
Share on other sites

The tangent line at any point on an ellipse is perpendicular to the angle bisector of the two lines going from the ellipse point to the two foci of the ellipse

 

I didn't know this! Although, unfortunately, when you run the ELLIPSE command it only asks for the lengths of the two axes, not the locations of the foci. Maybe there's a way to change this, or find out where the foci are... apologies, I've been pretty busy with some other stuff this afternoon. And, truthfully, my ultimate aim with this is to organize rectangles within an elliptical space, as stated above, so I'm not really trying to break down the philosophy of an ellipse per se. But, as they say, knowledge is power. Thanks for the info so far!

Link to comment
Share on other sites

I would work from the outer edge of the counter, figuring how far back the cabinet at 9 o'clock can actually be from the edge of the front of the counter. Offset the ellipse that distance and move the other cabinets two edges to be an equal set back distance from the front. This assumes the aesthetics of the front are more important than the back. Having each cabinet corner set back the same distance from the front will give you a better visual appearance, imo. You have them placed by eye about where they can go, just move the forward and rotate to touch the front offset ellipse.

Link to comment
Share on other sites

Here is a solution for rotating an object in this case a block, aligning to two pts on the object, its based on two points in the block being a fixed distance apart. For any one else interested its for checking vehicles bottoming out.

 

(Defun draw_vehicle ( )
(SETQ ANGBASEE (GETVAR "ANGBASE"))
(SETQ ANGDIRR (GETVAR "ANGDIR"))
(SETQ LUNITSS (GETVAR "LUNITS"))
(SETQ LUPRECC (GETVAR "LUPREC"))
(SETQ AUNITSS (GETVAR "AUNITS"))
(SETQ AUPRECC (GETVAR "AUPREC"))
(setq oldsnap (getvar "osmode"))
(SETVAR "LUNITS" 2)
(SETVAR "ANGBASE" 0.0)
(SETVAR "ANGDIR" 0)
(SETVAR "LUPREC" 0)
(SETVAR "AUNITS" 3)
(SETVAR "AUPREC" 0)
(setvar "osmode" 0)
(if (tblsearch "Block" "Holden")
(princ "Holden")
(progn
(command "Insert" "p:\\Autodesk\\vba\\holdencar.dwg" "0,0" 1 1 0)
(command "erase" "last" "")
) ; progn
)
(setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline"))))
(setq interval ( getreal "\nEnter spacing m:"))
(setq cRad 3.05)
(setq startang (* pi 1.5))
(setq endang (/ pi 2.0))
(setq dist 0.0)
(setq len (vla-get-length obj))
(setq stpt (vlax-curve-getpointatdist obj interval))
(setq num (+ 1 (fix ( / len interval))))
(repeat num
(command "arc" "C" stpt (polar stpt endang crad)(polar stpt startang crad))
(setq objarc (vlax-ename->vla-object (entlast)))
(if (= (setq intpt (vlax-invoke obj 'intersectWith objarc acExtendnone)) nil)
(setq intpt (vlax-invoke obj 'intersectWith objarc acExtendThisEntity)) ; needed at start
)
(vla-delete objarc)
(setq ang (angle intpt stpt))

(command "Insert" "Holden" stpt 1 1 ang) ; need ang in radians
(setq stpt (vlax-curve-getpointatdist obj (setq dist (+ dist interval))))
) ; repeat
(SETVAR "LUNITS" lunitss)
(SETVAR "ANGBASE" angbasee)
(SETVAR "ANGDIR" angdirr)
(SETVAR "LUPREC" luprecc)
(SETVAR "AUNITS" aunitss)
(SETVAR "AUPREC" auprecc)
(princ)

) ; defun

(draw_vehicle)

Link to comment
Share on other sites

Here's a process that will let you rotate the rectangles so that they are exactly tangent to the ellipse.

 

1. Create a preliminary 4 vertex closed polyline that roughly approximates the rectangle with your first guess of dimensions. The "rectangle" sohuld not be orthogonal to the WCS

 

2. Apply dimensional and geometric parametric constraints to force it to be a rectangle. For example:

e1.JPG

 

3. Make 3 or 4 copies of the rectangle and place them off to the side.

 

4. Apply a vertical constraint to one of the long sides of one of the rectangles and then move it so its midpoint snaps to the end of the ellipse.

e2.JPG

 

5. Move one of the rectangle copies so that its corner snaps to the corner of the vertical rectangle as shown then add a line from the corner and use osnap tan to make it tangent to the ellipse (yellow line).

e3.JPG

 

6. Add a lock constraint to the tangent line. We do not want it move move, we want the rectangle to rotate.

 

7. Add an angular dimension constraint from the tangent line to the rectangle base as shown (the 4.41° dim).

e4.JPG

 

8. Change the angle dimension to 0.0. The rectangle should rotate to be tangent to the ellipse.

e5.JPG

 

9. Repeat step 5 through 8 for additional rectangles.

 

After you go through this process once you can try new values for the next iteration. Since the rectangles are parametrically driven you can just edit the dimension values. YOu could get more sophisticated with this approach but it is difficult to explain.

 

Lee

 

P.S. The location of the foci of an ellipse is easy to find if you know its semimajor, and semiminor dimensions. a^2 + b^2 = c^2

ee.png

Link to comment
Share on other sites

LRM have a look at what I posted its very similar it is multiple sit back and watch it generate, You are right about starting at a quadrant point. The repeat algorithm I use would need to be changed so the new circle intersect point is half distance of rectang then make start pt the co-ords of the other end and keep repeating.

 

I have something sort of works with ellipse but needs the Len variable set to a reasonable length so it stops once done. Code change I want to leave original as is. It also stops at quadrants. A quick and dirty if possible is to make a lot of little short straight segments then it should work

 

;(setq len (vla-get-length obj))
 (setq len 20)

ScreenShot078.jpg

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...