# Is it possible to determine the nest level for rectangle?

Hi,

I would like to accomplish a drawing as below

Is it possible?

I tried the script below and it doesn't appear like I wanted it,

@startuml
rectangle "Lvl1Block" #orange {
rectangle "Lvl2Block1" #yellow
rectangle "Lvl2Block2" #green {
rectangle "Lvl3Block1" as RootDF #black {
rectangle "Lvl4Block1" #lightblue{
rectangle "Lvl5Block1"
rectangle "Lvl5Block2"
}
rectangle "Lvl4Block2" #lightblue
rectangle "Lvl4Block3" #lightblue
}
}
}
@enduml

answered May 12, 2016 by (182,960 points)

Well, you can have

@startuml
rectangle Box1 #lightblue

rectangle Box2 #lightblue {
rectangle "<color:white>Child1" as Child1 #black
rectangle "<color:white>Child2" as Child2 #black {
rectangle N1 #red [
#1
]
rectangle N2 #red [
#2
]
}
}
@enduml

Is this close enough to what you are expecting ?

commented May 12, 2016 by (120 points)
Thanks for the response.

However, is it possible to have

a) Box1 and Box2 to be of the same height
b) Child1 and Child2 to be of the same height
c) Box1 and Child1 to be bold
d) Reorder "#2 and #1" to "#1 and #2" in Child2.

commented May 12, 2016 by (182,960 points)
a) and b) is not possible. We could think about adding some "min_width" and "min_height" option, but that would only be possible on final Rectangle (meaning Rectangle that does NOT contains other Rectangle). This would not been perfect through, because you would have to manually compute the value for those "min_width" and "min_height".

About c), you can use the <b> syntax

About d), the best option is to change order declaration of boxes (which is a bad solution)

The result is here:

http://www.plantuml.com/plantuml/uml/TOqn3i8m34Ltdy9gJv2C27M0dGiW1ZS9JLIJeAHLaL3lJaeHf0FRbz__pwbt_awHRfWiwJ0vt-6LE1c8HWtaEpPOxTlc41wYGagu1ApPTNPeUJG0HJ4pMJ1y0fOM5JZ4tMJTO9giF5h7UfMk4UkMIVN_H--Q_2taPx5zTChdQ3IUePPmsH3n9M8XCyml
commented May 12, 2016 by (120 points)
edited May 12, 2016
I tried using "\n" as workaround but it resulted in unaligned boxes.