4
$\begingroup$

I have an irregular curved funnel-like 3D space and I need to "lay" a "tube" in it so it is goes through the "middle" of the funnel.

The sketch below shows a 2D section of a possible scene (the "tube" is shown in red, black represents "walls" of the space, blue is just a place where the "tube" is attached.): routing sketch

Is there a way to get Blender "route" the tube through the space (semi)automatically?
By semi-automatically I mean manually selecting possible additional constraints (objects/points/...) or entering some parameter values and then letting the automated process do the rest.

I know I can use Curves to draw a path and manually adjust it so it fits, however, I would like to automate it as much as possible because the process will have to be done many times in different spaces (but generally similar in shape).
(I also know how to make a "tube" by adding a bevel to the curve as well as how to use hooks to modify it.)

Could this be done by first creating a curve (with high enough resolution) and then making it "snap" to the "average" of the enclosing space ...?

I'm new to Blender and 3D modelling but I'm quick in acquiring new skills.

$\endgroup$
  • $\begingroup$ I have updated the question to emphasize the point that I'd like to make the process of routing as automated as possible. Thank you Mentalist and PaulGonet for trying to hep, I appreciate it, I learned something from each of you. $\endgroup$ – spacer Feb 8 '16 at 17:10
  • 2
    $\begingroup$ What you are looking for is somewhat mathematically complex but of course possible through scripting. Here and here are some approaches. Laplacian smooth and Decimate are implemented in blender as modifiers and could be used as a starting point. $\endgroup$ – user2859 Feb 8 '16 at 17:33
  • $\begingroup$ If you know the mathemathic function which describes that curve it should be possible to use Add Mesh: Extra Objects addon with that function entered in value field, like in this question. It won't be possible to edit that created mesh afterwards in this way as this is only possible to change using Last Operator menu though. $\endgroup$ – Mr Zak Feb 8 '16 at 18:32
  • $\begingroup$ Thanks @user2859, that is interesting material, I'll look if there is a way to use it. $\endgroup$ – spacer Feb 8 '16 at 18:47
  • $\begingroup$ @MrZak, thanks, but unfortunately the funnel in this case cannot be described with a mathemathic function so cannot the resulting curve. Besides, if I had that, I would not need to route it. That is, unless i misunderstood your comment ... $\endgroup$ – spacer Feb 8 '16 at 18:53
4
$\begingroup$

After giving this some thought, I have come up with another approach that might be a solution for you. It does require that the mesh of your space has quad topology, so that edge rings which flow along the tunnel can be selected and scaled in.

Of course, if you don't have control over the initial topology you will have to retopo first. I believe the RetopoFlow add-on would be the fastest way, if you need to do this.

Select and Scale your Edge Rings

So you have your mesh object of your space:

Tube space mesh object

Press ShiftD to make a duplicate of it, and move (M) it to a different layer.

In Edit Mode, with Edge Selection enabled, select only the edge rings. This can be done from the menu: Select > Edge Rings, or with the shortcut ShiftCtrlAltRClick. Do this until every edge ring is selected.

Set your Pivot Point to Individual Origins. This causes each selected edge loop to shrink toward its individual center when you scale them down, creating a path that passes through the center of the mesh.

Set Pivot Center to Individual Origins

Scale your edge rings down to zero. (S,0,Enter)

Scale edge rings to zero

Press W > Remove Doubles to get rid of extra overlapping geometry.

Smooth it Out

In Object Mode, add a SubSurf Modifier to your object to smooth it, if you want it to be smooth. Adjust the subdivision levels as desired.

Add a Subdivision Surface Modifier

Apply the SubSurf Modifier.

Convert your Mesh object to a Curve object. (AltC)

Convert mesh to curve

Adjust your Curve Settings as Desired

Adjust your curve settings

Above: A wireframe display of the original Mesh object, and the new Curve object, with both layers made visible together.

That's it!

$\endgroup$
  • $\begingroup$ Alternative to RetopoFlow would be shrink wrapping your quad geometry to the tunnel. $\endgroup$ – Jaroslav Jerryno Novotny Feb 11 '16 at 11:03
  • $\begingroup$ @Mentalist, this does looks like a solution although I'll need to look into the retopo thing as the funnel shape I have is rather "organic". I can't do it today though, not sure about tomorrow. Will report on results as soon as I try it out. $\endgroup$ – spacer Feb 11 '16 at 21:43
  • $\begingroup$ @spacer Cool, please let us know how it works out for you. I am a fan of the Shrinkwrap method that Jerryno mentioned as well. $\endgroup$ – Mentalist Feb 12 '16 at 2:57
  • $\begingroup$ @Mentalist, Jerryno, I have finally found some time to test this and it looks very promising. However, I'm having two problems: A) shrink wrapping nicely around the curving funnel (I get "artifacts" spanning empty space outside the funnel) and B) selecting all edge loops automatically (without having to pick them out by hand one by one). Can you, please, give me some hints toward solving that? $\endgroup$ – spacer Feb 19 '16 at 0:54
  • $\begingroup$ @spacer Tip#1: Model your retopo mesh while the Shrinkwrap Modifier is on it and set it so you can see the effects in Edit Mode. By extruding one step at a time, and checking your modifier results along the way, you won't run into surprises later. Tip#2: Set the Shrinkwrap Modifier's Mode to Project, and the Direction to both Positive and Negative. $\endgroup$ – Mentalist Feb 19 '16 at 12:51
1
$\begingroup$

Your diagram gave me a chuckle. :-)

Beveling Curves

There is a handy Bevel feature you can enable with Curve objects to get the effect you are describing.

In Object Mode press ShiftA to Add > Curve > Bezier

Press Tab to switch into Edit Mode for the Curve.

Then in the Curve Context, increase the Bevel Depth. Set the Fill mode to Full to make it round like a tube. Increase the Resolution so it will become rounded. Raise the Resolution of Preview U if you want to smooth out the length of the curve.

A Beveled Curve, and its settings

If you then need to convert this into a Mesh object you can do this from Object Mode by pressing AltC and "Convert to Mesh".

Converting a Curve to a Mesh

Taking it further

If you need something more complex than a simple wire or pipe you can experiment with Taper and Bevel objects to further shape your Curve. Or you can even model a custom Mesh object and use the Curve Modifier to stretch it along a Curve.

$\endgroup$
  • $\begingroup$ thank you, but I know about the Bevel feature (I will edit the question to clarify that). What I need is to - automatically or with some manual "help" - "route" the tube to nicely follow the funnel. Maybe something along the idea of snapping the curve to "average" of the enclosing shape? $\endgroup$ – spacer Feb 8 '16 at 15:05
  • $\begingroup$ Oh, and yeah, maybe I should have added another bend so the diagram would look more like elephants front appendage rather than the middle one ;) lol $\endgroup$ – spacer Feb 8 '16 at 15:07
1
$\begingroup$

You may easily control the tube using Hooks. enter image description here

Select the Curve and bevel it using Bezier Circle. enter image description here enter image description here

Now select the curve handle's center and press Ctrl+H-->Hook to New Object. Repeat the process with other handles. Now transforming, rotating and scaling the hooks you have a full controll over your tube. enter image description here enter image description here

$\endgroup$
  • $\begingroup$ Thank you @PaulGonet, I'm aware of hooks too. I realize now that I should have mentioned that in the question too, sorry. The post is useful though, I'm learning :) What I actually need is to automatically fit the tube within the funnel, then tweak it if necessary. $\endgroup$ – spacer Feb 8 '16 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.