Jump to content

Distance between two points on a cylinder (3D)


dude

Recommended Posts

I am trying to develop a spreadsheet to calculate the distance between two holes on a cylinder. 

 

48"Ø right cylinder.

12"Ø hole at 0 degrees

12"Ø hole at 30 degrees, with the center up 12" above the above 12"Ø hole

 

Lengths I am looking for are:

  • Distance between the center of each hole
  • Shortest distance between each hole (going from center to center)

 

Can someone help me with this? You can search my past posts here to see I pop in from time to time to ask these type questions. I don't want anyone thinking I am trying to cheat on a certificate/exam.

 

Thank you in advance for reading this and any help you can offer.

Link to comment
Share on other sites

5 hours ago, dude said:

I am trying to develop a spreadsheet to calculate the distance between two holes on a cylinder. 

 

48"Ø right cylinder.

12"Ø hole at 0 degrees

12"Ø hole at 30 degrees, with the center up 12" above the above 12"Ø hole

 

Lengths I am looking for are:

  • Distance between the center of each hole
  • Shortest distance between each hole (going from center to center)

 

 

  1.  Are both holes perpendicular and pass through the axis of the cylinder?
  2. By "center of hole" do you mean the point on the surface of the cyclinder where the hole was "drilled" and not the center of the hole at the point where it intersects the centerline of the cylinder?
  3. Do you just want the equations to place on a spreadsheet to calculate the required distances?

If I understand your terminology then the distance along the surface of the cylinder is:

(  (1/12 * pi  * 48)^2 + 12^2 )^0.5  = 17.37...

 

Shortest distance between each hole (going from center to center) is:  12

 

The diameter of the holes (within reason) has no effect on the answers.

 

Link to comment
Share on other sites

I think we are on the same page. Let me do a better job communicating this.

 

The holes are perpendicular to the wall where they are on the cylinder wall.

 

Center of hole to center of hole is 30 degrees.

 

The center of the holes can be the same elevation or drastically different. The degree separation (center to center) can be close together (here has 30 degrees) or further apart. The 48" diameter cylinder can change as well to much larger sizes.

 

The diameter of the holes does not matter yet, but this will be a consideration further into the larger problem we are solving. This is step one in a long exploration. We are also calculating the intersection points along the holes (ellipses) projected on a 2D plane (5.3768, 3.104)

 

Do you have a link to the formula you used to arrive at 17.37"? Does that number check out in AutoCad?

 

 

Link to comment
Share on other sites

Here's the cylinder as modeled in AutoCAD. Green denotes the centerline of the upper hole and red the lower hole.

image.thumb.png.f7fc2089322ae1d397875fa29d39061b.png

image.thumb.png.601f4d1083a4b1c553be2bd39027645b.png

 

The horizontal distance (the distance measured along the circumference, white line) between the two points is:  pi * d * 30/360 or pi * 48 * 1/12.

The vertical distance is 12.  The total distance is the square root of the sum of the square of the horizontal and vertical distance.

 

The distance is measure along an ellipse that lies on the plane that is defined by the red, green surface points and a point midway between the centers of the two holes (this point lies on the cylinder's centerline).  It is show below.  It agrees with the distance I posted earlier.

image.png.f0c68b000ea3a913e8e31555e14fe888.png

 

 Note that the intersection of two cylinders is NOT an ellipse but a bicylindrical curve and it does not lie on a plane as does an ellipse.

 

 

 

Link to comment
Share on other sites

Thank you for this information and work. If you don't mind, don't delete that file just yet. If it is not too much trouble, I would like to know the distance along the cylinder face between the holes. Note, not between the centers, but between the holes.

 

Yes, it is a bicylindrical curve, but if you unroll the cylinder (think hollow cylinder with razor thin thickness) it is an ellipse in 2D. 

Link to comment
Share on other sites

Attached is the file with a solid model of the cylinder with 2 holes. 

 

I've also attached a copy of the file "cylinder with holes.02.dwg" where I used the parametric features of AutoCAD to create a parametrically driven 2D sketch of the cylinder wall unrolled.

 

image.thumb.png.5537938a46417ef3d65c84d070a77abf.png

 

You specify the diameter of the cylinder by editing the value of diaCyl, the hole diameters diaHole1, and diaHole2.  Ang1 is the angle offset. dV is the vertical distance, dH, the horizontal distance is a function of diaCyl.  Edit any dimension except dH and the center point distance of the holes will update. 

Ellipses are controlled well by the parametric features.  The ellipse shaped holes when laid flat have a minor diameter value diaHole and a major diameter value of:

diaCyl * asin(diaHole/diaCyl) 

where the result of asin is in radians.  I added these ellipses in red.  Their size and shape will not change when the dimensions are edited.  You can draw a line between the two hole circles and trim it to the ellipses to get the distance between hole walls.   

 

image.png

cylinder with holes.02.dwg cylinder with holes.dwg

Link to comment
Share on other sites

Thank you for the help! The 02 drawing really helped me out. I have AutoCad but I only draw in 2D. I want to draw in 3D but have not found the right course/book/class to attend yet. Would love any suggestions.

 

This is a project my son and I are working on and you have helped us a great deal. The goal of this step in the project is to calculate the d4 distance. We are working out how many different ways we can solve this problem and are creating more questions than answers but are having a good time. 

 

I will report back after we have thoroughly went through this data. Thank you again!

Link to comment
Share on other sites

@dude  I'm glad you found the drawing  helpful.

 

I thought I have some fun with this problem so I wrote an AutoLISP program that draws the two ellipses given the cylinder diameter, hole diameter, angle and vertical offset.  It creates a dim line for the center to center distance and displays the value in an alert box.  Just use appload and load "cylinder holes.01.lsp" then give the holes command in AutoCAD.

 

The distance between the closest points on the two ellipses is more complicated.  You can draw a line from the center of one ellipse to the center of the other ellipse then use trim.  The length of the trimmed line is the dimension I think you are looking for.  To have the program calculate the intersection points of the line  and the ellipses is a bit more work as noted here. If you are interested I could add that feature.  If you have any question about how I determined the ellipse dimensions let me know.

(defun c:holes (/ dCyl dHole ang dV dH p1 p2 d p3 eMajor ellipse1Pt1
		ellipse1Pt2 ellipse2Pt1 ellipse2Pt1  msg)
; calculates hole placement on cylinder  
(setq dCyl	  (getreal "\nEnter cylinder diameter. ")
      dHole	  (getreal "\nEnter hole diameter. ")
      ang	  (getreal "\nEnter offset angle between holes (degrees). ")
      dV	  (getreal "\nEnter vertical offset for second hole. ")
      dH	  (/ (* (/ dCyl 2.) ang pi) 180.)
      p1	  '(0 0)  ; center ellipse 1
      p2	  (list dh dv) ; center ellipse 2
      d		  (distance p1 p2) ; distance between centers
      p3	  (mapcar '+ p1 (list 0 d)) ; point for placing dim line
      eMajor	  (* dCyl (asin (/ dHole dCyl))) ;ellipse major diameter
      ellipse1Pt1 (mapcar '+ p1 (list (/ eMajor 2) 0.0))
      ellipse1Pt2 (mapcar '+ p1 (list 0.0 (/ dHole 2)))
      ellipse2Pt1 (mapcar '+ p2 (list (/ eMajor 2) 0.0))
      ellipse2Pt2 (mapcar '+ p2 (list 0.0 (/ dHole 2)))
)
  ;(command "_circle" p1 "d" dHole)
  ;(command "_circle" p2 "d" dHole)
(command "_ellipse" "c" p1 ellipse1Pt1 ellipse1Pt2)
(command "_ellipse" "c" p2 ellipse2Pt1 ellipse2Pt2)
(command "_dimaligned" p1 p2 p3 "")
(setq msg (strcat "Center to center distance = " (rtos d 2 4)))
(alert msg) 
(princ)
)

;; ArcSine  -  Lee Mac
;; Args: -1 <= x <= 1

(defun asin ( x )
    (if (<= -1.0 x 1.0)
        (atan x (sqrt (- 1.0 (* x x))))
    )
)

As for tips on 3D modeling modeling the cylinder with the two holes is a good start exercise. Start by creating a cylinder of dia 48 and height 100. Place its bottom at 0,0,0. 

Create another cylinder for the holes and make its dia. 12 and height 100 then use rotate3d to rotate it about the x axis by 90°. Use move 0,0,12 to position it.  Before subtracting it from the big cylinder use osnap cen to create a centerline for the hole cylinder.  It's easier to do this before you do the Boolean subtract.    Use another cylinder to make the other hole.

If you have any questions, post them here.

 

Good luck!

cylinder holes.01.lsp

  • Like 1
Link to comment
Share on other sites

@Irm, we have a question about how AutoCad arrived at a radius of 6.2831" for the arc length of the 12" hole. 

 

If we plug 6.2831" into our ellipse equations, I can indeed get matching coordinates and dimensions that match your drawings for intersection points, etc.. However, 6.2831" does not agree with the arc length we are calculating for the ellipse. See attached PDF. Our calculated arc length is 12.1287" or a radius at the widest point of 6.06".

 

Link to non-important site of equation we are using.

20230429.pdf

Edited by dude
Link to comment
Share on other sites

AutoCAD confirms you 12.1287.

image.thumb.png.b8dc2e592b9cfff0b63eb5bfe27834df.png

 

My "hole" program yields the same result as well for the ellipse major axis.  

 

Refresh my memory, where does the 6.2831" come from?

Lee

  • Like 1
Link to comment
Share on other sites

Open up the “Cylinder with Holes 02.dwg” you posted above. We’ve been using this file to check our numbers. 

 

I have added a screenshot.

Screenshot 2023-04-29 at 11.35.54 AM.png

Edited by dude
Link to comment
Share on other sites

The ellipses in "cylinder with holes.02" have the wrong major axis dimensions. I forget the values I used to draw the ellipse.  The "...03" version is correct.  But, as noted, the ellipses were not created using the parametric features of AutoCAD.  I calculated the ellipse dimensions manually for that file.  If you edit the parametric dimensions the hole location will update correctly but the ellipses will not change.

 

I've modified the parametric drawing to create parametrically driven ellipse dimensions by referencing a rectangle that is constrained and has the major and minor dimensions of the computed ellipse.  There is the risk that the ellipse may rotate within the rectangle as dimensions are changed but some testing showed good results.  Try iit out!

image.thumb.png.3c9f7cc88c233975c8dd95d5eb25fd85.png

Of course, you can use the Autolisp program.  I've done some testing with various cylinder and hole dimensions and it seems to yield accurate results but you should test it yourself.   

cylinder with holes.03.dwg

  • Like 1
Link to comment
Share on other sites

Thank you for al of your help! Everything checks out on our end now and we were able to accomplish this two separate ways. A very cool project for us. 

 

Did AutoCad fill in the formulas in the above screen shot or did you do that?

Link to comment
Share on other sites

All interesting stuff and excellent analysis. 

I look into the files and tried some additional stuff and found a point of clarification.  The ‘Unrolled’ bicylindrical curve is not an ellipse.  At small relative sized cylinder pairs it does appear quite ellipse like.  Use of an ellipse as a proxy may be well within tolerance. 

 

At larger relative radius sizes, though, the difference may become more important.

LargerRelativeSize.dwg

  • Like 1
Link to comment
Share on other sites

@SEANT  Good catch!

I tested your shape by determining the coordinates of a point with a y value of 1/2 the radius of the hole.  The x coordinates would be:

= (1/2)*radCyl* 2*asin(sqrt(radHole^2 - (radHole/2)^2)/radCyl)

 

For the example in your file,  radius cylinder = 100, radius hole = 75

x = 70.69517,  y = 37.5

 

Here's the point added to your drawing. It's right on! 

Red = circle, magenta = ellipse,  what is the equation of your white curve?

image.thumb.png.881e40ac237446ab66a30abc8d8d94ac.png 

 

  • Like 1
Link to comment
Share on other sites

I had an 'Unroll Developable Surface' routine in the works for numerous years now.  To this day, unfortunately, it is still a bit buggy.  I'll look it over again, see if something new catches my eye on where the bugs may lie.  At some point I may post it as Alpha Release software here

 

The 

Quote

. . . .what is the equation of your white curve?

@lrm That geometry was derived by mapping UV coordinates of the Solid Cylinder's face to an unrolled surface with equivalent UV parameters.  I think the process could be setup in EXCEL using cylindrical coordinates.  How geeky would I sound by saying that would be a fun rainy weekend  project.🙂

  • Like 1
Link to comment
Share on other sites

It's raining here so I created the attached Excel worksheet.

image.thumb.png.49b88d6fcf8e2a7d9735d9db83c1c58f.png

 

The user enters the radius of the cylinder, the holes, the vertical spacing and the angle between the holes.

Cell A7 provides the center to center distance.

To get the shortest distance from hole edge to hole edge we need to find a point on the edge that is located at the same slope as the line between the two slopes.  The variable "a" specifies the y coordinate of a point on the hole edge.  Its x and y values are in cells A17:B17.  To find the point on the slope line we need to make the value of cell A25 = 0.  Goal seek can be used to determine "a" and therefor the shortest distance.  The image above has the results when a = .5 and there's an error in slope of 3.289...

 

 

Here's the input to Goal Seek.

image.thumb.png.be64830382a4da6656d2ef2870a3b1e7.png

Below is the results of goal seek.

image.thumb.png.e7405c3a9c964de2567fdb4321cf4279.png

 

 The result are consistent with @SEANT's ddistance between 2 holes.01.xlsxrawing.

 

 

 

 

image.png

image.png

Edited by lrm
  • Like 1
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...