# Easy way to do several line styles on one path using TikZ?

I'm drawing a lot of 3D pictures for school using 3D-plot for TikZ. I like it when the lines that are inside or behind an object, eg. the ones that shouldn't be visible to be thinner than the lines that are.

For instance: A cube should look like this:

where the dashed lines could just be thinner than the rest..

To get this type of 3D I would normally draw the entire cube (all the lines) with the very thin option. Then I'd copy the lines that should be very thin (the ones that aren't dashed in the figure) and let TikZ redraw them using the thinoption (it's obsolete I know) or the thick option.

Since this isn't a clean way to work, what are your suggestions?

I'd like to see something like:

\draw[tdplot_main_coords,thick] (0,0,0)--(0,1,0){ [very thin] --}(0,0,1)-- ... ;


Where I can just select part of a path and give it the right options (overriding the general options).

-

While there is the scopes TikZ library which allows you to use in-path scopes, many of the drawing options are global to the drawing path. Things like color, thickness and drawing pattern (e.g. solid vs. dashes) can only be applied to the whole path. The reason for this comes from the underlying graphic system (PS or PDF) and PGF/TikZ can't do much about it.
If you want to draw lines with different settings you will have to do so with two or more drawing commands. Note that TikZ has the ability to draw material into the background, i.e. behind previous drawn material. Enclose such commands between \begin{pgfonlayer}{background} ... \end{pgfonlayer}.
Theoretically, one could use edge commands (which always start a new path), but then one would have to write all the coordinates twice, as edges don't move one to the endpoint. – Caramdir Feb 28 '11 at 23:16
Also you might consider to add something like [preaction={white,very thick,draw}] to the lines in the front to overpaint the background lines with some white around the crossings first. – Caramdir Feb 28 '11 at 23:17
@Caramdir: I used once double with inverted colors to create a similar effect. – Martin Scharrer Feb 28 '11 at 23:21