Creating a 3D Cylinder with Center Line

General discussions about Inkscape.
dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Mon Nov 26, 2012 1:51 pm

I would like to create an image of a cylinder that includes its center line (its axis).
I need the axis of the cylinder to be shown on the image because I hope to include some dimensions on the image that are relative to this axis.
Basically, I want to fix the origin of an x-y-z coordinate system to a point on this center line and illustrate a few dimensions in this coordinate system (not real numbers; just qualitative characteristics such as the radius, r).

How can this be done?

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Tue Nov 27, 2012 2:48 am

Okay, I have started work on a cylindrical image, a cross section, showing how an angled cutting plane through a cylinder appears from the side. See attached.
C indicates the center line of the cylinder (the axis), r indicates the radius of the cylinder, α indicates the angle relative to the horizontal at which a cutting plane went through the cylinder.

I did this freehand, so it looks pretty bad. It would be nice to be able to control exact start points and endpoints, either by entering specific dimensions, or an angle and an offset. For example, after specifying a point at, say, coordinates (0,0), draw a vertical line to (0, 50), then a line down at angle -30 degrees of length 25. Or some way to more exactly control lines.

And to reflect a line around another line. That way, I could ensure both vertical edges of the cylinder sides are symmetrical around the center line (axis).

Also, does Inkscape offer any pre-made arrows? I dimensioned my rough drawing by freehand drawing the arrows so the dimensions for radius, r, and cutting angle, α, could be indicated. Also drew the leader lines coming off the edges (for the dimensions) freehand. Obviously, it still needs a lot of work. Any tips?
Attachments
Cyl_Sec1.PNG
Cyl_Sec1.PNG (3.49 KiB) Viewed 18997 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby brynn » Tue Nov 27, 2012 3:57 am

Yes, that can absolutely be done! You've only begun to scratch the surface :D

After you draw the lines with Pen or Pencil, switch to the Node tool and you can drag nodes around, or adjust the Bezier handles for curves. You can place the nodes precisely using the control bar with the Node tool engaged. Look for X and Y fields. You'll see width and height too. Or you can make all manner of custom grids, and by enabling snapping (Snap control bar, maybe hidden, check View menu) have nodes snapped precisely to grid interesections. Snapping to grids is my favorite technique when precision is needed! With the right snap settings, you can even place nodes at grid intersections as you draw with Pen tool. I'm in a bit of a hurry at the moment, or I would write them out. But meanwhile, check Help menu > Inkscape manual.

To have a precise angle, check out the Ellipse tool in "Segment" mode. After setting the angle, you can either delete the rest of the ellipse or do Object to Guide and use it as a guide to draw the real angle.

There aren't any pre-made arrows, but there are pre-made arrow heads. Fill and Stroke dialog > Stroke Style tab > Start Markers and end Markers.

I'm not sure what you mean by "reflect a line around another line". It almost sounds like you need a simulated 3D situation to do it. But maybe you just need parallel lines? Grid would be great for that too!

If no one else has, by the time I get back, and you still haven't figured out everything, I'll write some steps for you. Sorry I can't do it now :(

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Tue Nov 27, 2012 7:06 am

brynn wrote: . . .
I'm not sure what you mean by "reflect a line around another line". It almost sounds like you need a simulated 3D situation to do it. But maybe you just need parallel lines? Grid would be great for that too!
. . .


Yes, I need parallel lines.

I am thinking I am going to start this drawing over from scratch.
My planned steps follow:
i) draw the vertical center line (axis of the cylinder).
ii) create another vertical line (call it Line 2) to one side of the center line.
iv) reflect Line 2 over the center line to the other side to create Line 3. That way, Lines 2 and 3 are parallel AND symmetric on either side of the center line. These are the sides of the cylinder.
v) use the erase tool to shorten the right line the desired amount.
vi) draw a line from the top of the left vertical line to the top of the right vertical line. This will create the sloped top. (Is there a way to ensure this sloping line connects the tops of the vertical lines instead of eyeballing it?)
etc.

Or is there a better/cleaner way to do this?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby brynn » Wed Nov 28, 2012 4:44 am

Ok, I have a little more time now. You can draw the whole cylinder with 5 clicks:

Use the Pen tool. :tool_pen: Click once to start the line, and click once each time you want to place a new node. When you come back around to the 1st node, be sure to click inside the tiny square. That will automatically close the path and end the line. The line will look green until you end it. Now it's all one connected closed path, rather than several disconnected segments. By using a grid, and snapping to the grid, as I have, you can draw the lines parallel and spaced properly, all at the same time. (View menu > Grid, set up a custom grid in Document Properties > Grid) (Note that if you accidentally click and drag at the same time, you'll make a curve instead of a sharp corner.) http://tavmjong.free.fr/INKSCAPE/MANUAL ... pping.html, http://tavmjong.free.fr/INKSCAPE/MANUAL ... pping-Grid, http://tavmjong.free.fr/INKSCAPE/MANUAL ... ths-Bezier

usepen.PNG
usepen.PNG (16.24 KiB) Viewed 18922 times


For drawing just one segment with the Pen tool, click once to start and double-click to end. Or if you use the Pencil tool, click once to start and once to end. The Pencil tool is more for freehand lines, which is why you can't click to place nodes, except when drawing a single, 2-node segment.

Just for future reference, you can use snapping to put the end nodes of 2 segments exactly on the same spot. You could either use snapping to a grid, or the X and Y fields on Node tool control bar, to place them precisely on the canvas. Then the nodes can be joined. Select both nodes by dragging a selection box around them, then click "Join selected nodes" button on Node tool control bar.

Is the line through the middle meant to be a dashed line? If so, there's a cleaner way to do that as well. Just draw a single straight segment (as explained above). Then Object menu > Fill and Stroke > Stroke Style tab > Dashes and choose the dash pattern that you want. If you need a different pattern than what are shown, you would have to draw it in separate segments. But at least using a grid, you can make the lengths of the segments precise.

Ok, that should cover everything you need. But if you run into problems, or decide to embellish, let us know, and we can tell you how. I hope it goes well :D

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Sun Dec 02, 2012 11:29 am

Thanks, Brynn.

This weekend, I am finding some time to work on the image (see attached screen capture).

I am coming across several more questions.

What is that rectangle in the middle? Is that considered the working space, inside of which my image must be confined?

Yes, the center line (marked with a 'C') is meant to be dashed. I would like it to take the standard drafting appearance: alternating long dashes and short dashes. However, I did not see that option offered. The dashes are all equal-sized. Am I overlooking something?

I think the lines representing the x-axis and z-axis are too long, so I was going to erase portions of them, and then re-add the arrow points to the shortened lines. However, the erase tool wants to erase the entire line segment or nothing at all. How can lines be shortened?

You mentioned an Ellipse tool in "Segment" mode. I don't see this. What is Segment mode?

How do I eliminate the fill in a circle, but keep its defining line? The yellow circle on the attached image is supposed to be a circle with a big 'X' through it, to represent the y-axis going into the page (standard notation in Math and Physics books). Do I draw the 'X' as text, and then create the circle around it? And how do I prevent the circle from being filled?
Attachments
Cylinder_X1.PNG
Cylinder_X1.PNG (10.26 KiB) Viewed 18835 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby brynn » Sun Dec 02, 2012 2:08 pm

The large rectangle is the page border, and yes, in some cases, your drawing will need to be entirely inside the border, to be visible. Not in all cases. The page border will never be visible in the finished image; it's just there as a guide. However, it can be hidden if you like. Document Properties > Page tab > Border > uncheck as necessary.

Also note that the default Inkscape document opens at 35% zoom, so that the entire page is shown on the screen. Personally, I doubt that many people actually want to draw on a 35% canvas, because when you decide to actually use the image (wherever that may be) it will be huge! If you're using the rulers, or paying attention to the object sizes on the control bar, those will be accurate. But if you're just "eyeballing it" it may turn out much larger than you want. The zoom percentage is shown in the extreme bottom, right corner of the window. You can adjust there, and there's also a Zoom tool, which has some handy buttons on the control bar. So you can check those out. http://tavmjong.free.fr/INKSCAPE/MANUAL ... pping-Grid) it will be easy to get then consisently the right length. For that short of a line, you may as well draw it. But if you had a lot of dashed lines to draw.... You know....I don't know if there's a way to make a custom dash pattern or not.... There should be! Let me investigate....

Ah-ha! I suppose you could make a custom pattern, but I think it would be better to make a custom marker. Use the grid like I mentioned, to make a one or 2 units of the dash pattern, then do Object menu > Object to Marker. Probably not worth the effort for such a small line, but you can do either way. This link goes to Dashes in the manual, but right below that is Markers and custom markers as well. http://tavmjong.free.fr/INKSCAPE/MANUAL ... oke-Dashes

As I've already mentioned, somewhere, after you draw the lines with whatever tool, you can switch to the Node tool :tool_node: to adjust the lines. Click once on the line (if it's not already selected) to reveal the nodes. Then you can grab a node with the mouse pointer and drag it to wherever you want. (http://tavmjong.free.fr/INKSCAPE/MANUAL ... iting.html)

Also note that the Eraser has a Delete mode, which it sounds like you were using. But look on the control bar, and you'll see a Cut Out mode. Also see the Width slider, which adjusts how wide of a swath will be made. http://tavmjong.free.fr/INKSCAPE/MANUAL ... raser.html But note that the Eraser tool is buggy. I've never gotten it to work consistently (with version 0.48.1, but perhaps it's been improved since).

The Ellipse tool button looks like this :tool_ellipse: . When you draw an ellipse, hold the Ctrl key, which will make a circle. You'll see 3 handles on the circle, 2 tiny squares and 1 tiny circle. If you drag the tiny circle, see what happens. Look on the control bar, and click "Switch to segment" button. (I think "segment" is a weird and confusing word for this, but I'm not familiar enough with geometry to know a better word.) (maybe wedge?) Also on the control bar, see the Start and End values? Those can be used if you want to set a particular angle. http://tavmjong.free.fr/INKSCAPE/MANUAL ... -Arcs.html Then you can either use snapping, and draw the lines of the desired angle over top of the circle (snapping will put the nodes precisely where you need them) and then delete the circle; or do Path menu > Object to Path, and then delete the part of the circle that you don't need, leaving only the angle. (See link for Node tool above, to remove part of the circle.) If you happen to already know the 3 points of the angle, you can just use the Pen tool and "connect the dots" so to speak, and not need to calculate the angle.

You can remove the fill of the circle in a couple of ways -- one using Object menu > Fill and Stroke > Fill paint tab > X ("No fill") button. Or just click the X button at the far left end of the color palette. But if it doesn't already have a stroke, you may want to add the stroke before you do that, to avoid confusion. Object menu > Fill and Stroke > Stroke paint tab > "Flat color" button (automatically puts a black stroke, unless you changed it first). Or hold Shift key while clicking the X button at the far left end of the color palette. OR for yet more options, hover mouse pointer over the short bar just to the right of "Fill:" or "Stroke:" in the bottom left corner of the window, and right-click for some convenient options. http://tavmjong.free.fr/INKSCAPE/MANUAL ... troke.html

Ok, I think that covers all your questions. But if I missed something, just ask again :D

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Creating a 3D Cylinder with Center Line

Postby druban » Sun Dec 02, 2012 4:40 pm

It's not often mentioned, but Inkscape has a rudimentary but functional 3D renderer built in that will draw wavefront .obj files.
(But the renderer is restricted to orthogonal views, i.e. no perspective so is of limited use. But it might be what you are looking for. Please note that this extension has not, i suspect, been updated in a long time, so after using it i advise saving your file, quitting Inkscape and then restarting. Just a tip.)
For it to render an obj file, the file must be saved into the folder (on Windows) program_files/inkscape/share/extensions/Poly3Dobjects.

Anyway here are two cylinders that you might like to try. naturally as 3D objects they are faceted so you will still have to draw by hand over them...
Note that the view tab can rotate and shade your cylinder once you import it, check the 'live preview' button to adjust its rotation and scaling.

g4097.png
g4097.png (42.97 KiB) Viewed 18808 times


Here are the files. The forum rules only allows certain filetypes and .obj is not one of them! SO NOTE THAT THESE ARE NOT SVG FILES. AFTER DOWNLOADING CHANGE THE EXTENSION TO .OBJ AND THEN PUT THEM IN THE POLY3DOBJECTS FOLDER.
Attachments
Cylinder.svg
NOTE THAT THIS IS NOT AN SVG FILE. AFTER DOWNLOADING CHANGE THE EXTENSION TO .OBJ
(1.82 KiB) Downloaded 380 times
Cylinder2.svg
NOTE THAT THIS IS NOT AN SVG FILE. AFTER DOWNLOADING CHANGE THE EXTENSION TO .OBJ
(10.46 KiB) Downloaded 393 times
Last edited by druban on Mon Dec 03, 2012 9:32 am, edited 3 times in total.
Your mind is what you think it is.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Creating a 3D Cylinder with Center Line

Postby ragstian » Sun Dec 02, 2012 5:15 pm

Hi.

Took me a while to figure this out - for reference:

Use Extensions - Render - 3D Polyhedron
In the requester use the Model file tab - Load from file

Good Luck
RGDS Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Creating a 3D Cylinder with Center Line

Postby druban » Mon Dec 03, 2012 10:50 am

ragstian wrote:Hi.

Took me a while to figure this out - for reference:

Use Extensions - Render - 3D Polyhedron
In the requester use the Model file tab - Load from file

Good Luck
RGDS Ragnar

Ooops! :oops: Don't know how I left that out! Thanks, Ragnar!

If you would prefer to have a cylinder in perspective, it's fairly easy to do using the 3D box tool. The only problem is making one face of the box square, for that see the first step in this tut
Then you can ungroup your 3D box and use the perspective extension to map a circle to each of the faces. It doesn't matter how the control quadrilateral is oriented since the circle has no up or down... The rest of the drawing should be elementary... Just think of it as a learning exercise!

drawing.png
drawing.png (59.9 KiB) Viewed 18734 times


The original 3D box can still be seen in outline.

The dot dash line is in the stroke style tab of the fill and stroke dialog, this should be 'textbook standard' enough, but if you really really want short and long dashes you might convert stroke to path and then stretch it in one dimension! ... You shouldn't have to make a custom marker (complicated, and not likely to give you what you want because markers are marked by nodes...)... a simple pattern on path method would be good enough, if you don't like the stroke options.
Your mind is what you think it is.

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Mon Dec 03, 2012 1:57 pm

Okay. I am almost there (see attached screen capture).

Brynn, you were correct. The eraser tool is very buggy. I never did get it to work as I wanted.

A couple more questions.

How do I draw a line and get it to not snap to a grid point? I tried to eyeball a line from a point on the circle to another point on the circle, but Inkscape kept drawing the line to a grid point either inside or outside the circle. I went to Document Properties and unchecked snap to grid, but never got it to work.

Also, I cannot affix a right-pointing arrow on the right side of the left dimension line underneath the image. I am trying to show the radius of the cylindrical cross-section, r.
I was able to get the left-pointing arrow on the left side of the right dimension line.
But every arrow I tried to put on the left dimension line, affixed to the left side of the line.
What am I doing wrong?
Attachments
Cylinder_X2.PNG
Cylinder_X2.PNG (17.53 KiB) Viewed 18719 times

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Creating a 3D Cylinder with Center Line

Postby druban » Mon Dec 03, 2012 3:21 pm

dcb6!8 wrote:But every arrow I tried to put on the left dimension line, affixed to the left side of the line.
What am I doing wrong?

Your arrowhead is being attached to the START or END of the line, as you have specified in the stroke style tab. But why don't you just flip the arrow horizontally, H key, or :tool_selector: tool control bar?
Your mind is what you think it is.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby brynn » Mon Dec 03, 2012 11:27 pm

You can have the markers attached to either the node at the beginning of the path, or the node at the end (or nodes in between). If it's on the wrong end, then deselect the marker for the wrong end (choose None), and select the marker for the correct end.

To have it stop snapping to the grid, yet still snap to other targets, use the Snap control bar. You can disengage the button for grids, and engage the button for whatever the other snap target. Or another way to do it would be View menu > Grid, which will hide the grid entlirely.

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Tue Dec 04, 2012 1:47 am

I got it now! Woo-hoo!

Actually, I ended up doing it in a round-about way.
I drew another line below the desired dimension line. Then I attached an arrowhead to it and the arrowhead affixed perfectly this time, the first time.
Then I deleted the original dimension line.
Then I moved the new dimension line into place.
Voila! Done!

The image is already posted on my blog. One more image to create and then I can move on to focus on the math and programming side.

Thanks for all the help.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby brynn » Tue Dec 04, 2012 9:29 am

Oh great news -- nice work!

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Creating a 3D Cylinder with Center Line

Postby ragstian » Wed Dec 05, 2012 12:27 pm

Hi.

dcb6!8 - Not trying to "better" your image - just want to show the difference between a 2d and 3d representation of the same data.

(Your perception might be different than mine!)

Here are the same data in "3d" - edited and rendered in POVRAY - (http://www.povray.org) - using the include files from http://www.f-lohmueller.de.

Image
Click the image for a bigger version.

RGDS Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

dcb6!8
Posts: 13
Joined: Sun Nov 25, 2012 6:50 am
Contact:

Re: Creating a 3D Cylinder with Center Line

Postby dcb6!8 » Thu Dec 06, 2012 12:36 pm

ragstian wrote:Hi.

dcb6!8 - Not trying to "better" your image - just want to show the difference between a 2d and 3d representation of the same data.

(Your perception might be different than mine!)

. . .



No, you got it right. That is exactly what I am trying to do. In fact, I worked with Sketchup to create two images similar to the one you posted. Yours is very nice!
(Although, I didn't figure out how to include the cylinder axis in the 3D images I made. Oh well, they still convey the concepts.)
But I also wanted to create a 2D side view as well, which I have done. Maybe if I get time in the future I will go back and make the images more pretty.


Return to “General Discussions”