2

I want to draw an edge like this:

enter image description here

From the edge labeled "Si" to the node "Especificar tareas TD/CD/FF" but I don't know how to continue it.

enter image description here

This is my code. Thanks

\documentclass{article}
\usepackage{tikz}
\usepackage[spanish]{babel} 
\usepackage[utf8]{inputenc}
\usepackage{csquotes}

\usetikzlibrary{calc}

\tikzset{
    every node/.style={
        rounded corners=1mm,
        align=center,
        font=\sffamily
    },
    main/.style={
        draw,
        text width=5cm
    }
}

\begin{document}
\centering
\begin{tikzpicture}

% Nodes
\node[main, label=180:(1)] (origen) {¿Se conoce la relacion confiabilidad/edad para esta falla?}; 

\node[main,anchor=east, label=180:(2)] (dos) at ($(origen.south)+(0,-1.5)$) {¿Es posible aplicar tareas TD?};
\node[main] (tareasTD) at ($(origen.south)+(-4,-3)$) {Especifique  tareas TD}; 

\node[main, label=180:(3)] (tres) at ($(origen.south)+(0,-4.5)$) {¿Es posible aplicar tareas CD?}; 
\node[main] (tareasCD) at ($(origen.south)+(-3,-6)$) {Especifique  tareas CD}; 

\node[main, text width=6cm,  label=180:(4)] (cuatro) at ($(origen.south)+(0,-7.5)$) {¿Es un modo de falla categoria D?}; 

\node[main, label=180:(5)] (cinco) at ($(origen.south)+(-3,-9)$) {¿Es posible aplicar tareas FF?}; 
\node[main] (tareasFF) at ($(origen.south)+(-4.5,-10.5)$) {Especifique  tareas FF}; 

\node[main, text width=6cm,  label=180:(6)] (efectivas) at ($(origen.south)+(0,-12)$) {¿Las tareas son efectivas?}; 

\node[main, text width=6cm,  label=180:(7)] (ultimapregunta) at ($(origen.south)+(3,-14)$) {¿Puede una modificacion de diseño eliminar el modo de falla o su efecto?}; 

\node[main, text width=4cm] (especificar) at ($(origen.south)+(-5,-16.5)$) {Especificar tareas TD/CD/FF}; 
\node[main, text width=4cm]  at ($(especificar.west)+(7,0)$) {Aceptar los riesgos de propios de la falla}; 
\node[main, text width=4cm]  at ($(especificar.west)+(12,0)$) {Modificacion de diseño}; 




\node[main, text width=3.5cm, circle, anchor=west] (circ) at ($(origen.south east)+(0,-1.5)$) {Si esta relacion Puede ser determinada con analisis adicionales entonces asigne ... etc. };

% Edges
\draw (origen.220) -- (origen.220|-dos.north) node[midway, right] {Parcial};
\draw (origen.195) -- (origen.195|-dos.north) node[midway, left] {Sí};
\draw (dos.300) -- (dos.300|-tareasTD.north) node[midway, left] {Sí};
\draw (tareasTD.350) -- (tareasTD.350|-tres.north);
\draw (origen.340) -- (origen.340|-tres.north) node[pos=.2, right] {No};
\draw (dos.350) -- (dos.350|-tres.north) node[midway, right] {No};
\draw (tres.187) -- (tres.187|-tareasCD.north) node[midway, left] {Sí};
\draw (tres.340) -- (tres.340|-cuatro.north) node[midway, right] {No};
\draw (tareasCD.340) -- (tareasCD.340|-cuatro.north);
\draw (cuatro.187) -- (cuatro.187|-cinco.north) node[midway, left] {Sí};
\draw (cinco.195) -- (cinco.195|-tareasFF.north) node[midway, left] {Sí};
\draw (cinco.350) -- (cinco.350|-efectivas.north) node[midway, right] {No};
\draw (cuatro.330) -- (cuatro.330|-efectivas.north) node[midway, right] {No};
\draw (efectivas.330) -- (efectivas.330|-ultimapregunta.north) node[midway, right] {No};

%This is the "half edge" labeled "Si" that I want to extend until "Especificar tareas TD/CD/FF"
\draw (efectivas.186) -- (efectivas.186|-ultimapregunta.north) node[midway, right] {Si};

\draw[dashed] (circ.west) -- (circ.west-|origen.340);
\end{tikzpicture}
\end{document}
2
  • 4
    -| (name of node.north) to continue the edge horizontally and then vertically.
    – cfr
    Jun 24, 2015 at 2:53
  • Maybe I don't know how to apply your advice, but your solution doesn't seems to work for me
    – Juan David
    Jun 24, 2015 at 3:17

1 Answer 1

4

You already used |- syntax as intersection point:

\draw[dashed] (circ.west) -- (circ.west-|origen.340);

In this case means the intersection point between an horizontal line throgh circ.west and a vertical line through origen.340. A side comment: you can say (circ)--(circ-|origen.340) because path stops at node border and circ which is equivalent to circ.center is on same horizontal line than circ.west.

This syntax can also be used as a path definition, instead of --, -| means a an horizontal path from origin followed with a vertical path to destination which starts where both paths crosses.

As an example, you can draw what you want with

\draw (efectivas) -| (especificar) node[pos=0.75, right] {Si};

which means draw an horizontal line from efectivas.center to efectivas.center-|especificar.center and a vertical path from this point to especificar.center. Although lines are defined between nodes centers, they stop at nodes borders. You don't need to say efectivas.west or especificar.north.

When you use -| or |- as path declaration, midway reference is the corner, and pos=0.25 center of first segment and pos=0.75 center of second center. In previous command, label Si will be written at right position of center point for the vertical path.

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .