Carriage return after a rectangle - plantuml

I have the following definition in which I need to have all two inner rectangles in vertical layout, instead of horizontal like in the below image;
#startuml
rectangle "AAAAAA" {
rectangle "CCCCCC" {
CDE --> (AAAAAAAAAAAAAAAAAA)
CDE --> (BBBBBBBBBBBBBBBBBB)
CDE ---> (CCCCCCCCCCCCCCCCC)
CDE ---> (DDDDDDDDDDDDDDDDD)
CDE ----> (EEEEEEEEEEEEEEEEE)
CDE ----> (FFFFFFFFFFFFFFFFF)
CDE ----> (GGGGGGGGGGGGGGGGGGGG)
}
rectangle "BBBBBB" {
ABC-down-> (AAAAAAAAAAAAAAAAA)
ABC -> (BBBBBBBBBBBBBBBBBBB)
ABC --> (CCCCCCCCCCCCCCCCCC)
}
}
#enduml
Is there a way to do that?

I managed to achieve it with a really crazy trick, I was trying to control layout with a hidden arrow;
I put left to right direction, since with normal direction I was unable to achieve exact vertical ordering
I reversed the direction of hidden arrow BB -[hidden]d-> CC
Though with different data it might get messy, do let me know if your real example works or not.
Working example

Related

How should i draw these DFAs?

I have to draw these 2 DFA,but i don't understand what logic should i follow.Before that,there were some easier,i got them.But these...
so the first is:
Σ={c,z}
L={W∈Σ* | w contain this:"czccz"}
I know that i have to draw 5circles with(c,cz,czc,czcc and czccz), but after that i have no idea how should i draw arrows and loops.Here is the next one.
Σ={a,m}
L={W∈Σ* | w NOT contain this:"ammam"}
If you can reccomend me some pages,where i can practise these,I would be very grateful.
This is my attempt:
I assume that your question is to find a DFA for a string in which it contains "czccz" as substring and the alphabet is (c,z). You can check your solution in the image provided.

PlantUML basic example

I'm evaluating if PlantUML can be a good alternative to GraphViz.
It's promoted as "intuitive" but honestly the very first example from the homepage is already confusing.
Why does the following create "Bob" and "Alice" twice?
I'm seeing 2 nodes in the text, and 4 in the output.
Also, the arrow doesn't go between the nodes, but between relations between duplications of the nodes.
Bob->Alice : hello
It makes zero sense to me.
What is the meaning of this example, and what would be a more trivial example with just 2 nodes and an arrow between them?
I see you have fallen for the classical trap of "The first page of the manual is not representative of the tool".(1)
Besides various UML diagrams (like the sequence diagram you encounered), PlantUML has support for various other Software development related formats (such as archimate, Block diagram, bpmn, c4, Computer network diagrams, erd, gantt chart, Mind maps, and wbd), as well as visualization of json and yaml files.
In fact, it even understands Graphviz syntax!(2)
Because of all of this, "intuitive" doesn't happen until you have some basic knowledge of PlantUML.
So back to your issue... What you are seeing isn't what you think it is.
What is that?
Relating things to Graphviz, instead of this:
digraph d {
Bob -> Alice : hello
}
You are actually seeing this:(3)
#startuml
digraph sequenceDiagramExample {
bobHead [ label="Bob" pos="0,1.5!" shape="record" ];
bobPoint0 [ pos="0,0.75!" shape="point" width="0" ]
bobFoot [ label="Bob" pos="0,0!" shape="record" ];
aliceHead [ label="Alice" pos="1,1.5!" shape="record" ];
alicePoint0 [ pos="1,0.75!" shape="point" width="0" ]
aliceFoot [ label="Alice" pos="1,0!" shape="record" ];
bobHead -> bobPoint0 -> bobFoot [ dir="none" style="dashed" ]
aliceHead -> alicePoint0 -> aliceFoot [ dir="none" style="dashed" ]
bobPoint0 -> alicePoint0 [ label="hello" labelloc="c" style="solid" ]
}
#enduml
Gimme an example!
What an example with just two nodes and an arrow between them looks like depends on the kind of graph chosen...
What you have to remember is that, with Graphviz, you have to apply all meaning to a diagram yourself. With PlantUML, the meaning is provided by PlantUML for you. All you need to do is tell PlantUML what you mean.
With a few basic pointers, this becomes intuitive quite quickly. You just need to know what kind of diagram you want to draw before starting...
As you can see from the examples below, PlantUML is a very powerful tool to add to your software developer toolbelt.
I hope the examples will help to make things more intuitive, and that your first misstep won't keep you from exploring PlantUML further!
Activity
#startuml
:Alice;
:Bob;
#enduml
Archimate
#startuml
archimate #Application Alice
archimate #Business Bob
Alice -> Bob
#enduml
Class
#startuml
Alice -|> Bob: Hello
#enduml
Component
#startuml
[Alice] -> [Bob]: Hello
#enduml
Deployment
#startuml
folder Alice
file Bob
Alice -> Bob: Hello
#enduml
Ditaa
#startuml
ditaa
+-------+ +-----+
| | hello | |
| Alice +------>| Bob |
| | | |
+-------+ +-----+
#enduml
Gantt
#startgantt
[Alice]->[Bob]
#endgantt
JSON
#startjson
{
"Alice": ["Bob"]
}
#endjson
MindMap
#startmindmap
+ Alice
++ Bob
#endmindmap
Network
#startuml
nwdiag {
network hello {
Alice;
Bob;
}
}
#enduml
Object
#startuml
object Alice
object Bob
Alice -> Bob
#enduml
Sequence
#startuml
Bob -> Alice : hello
#enduml
State
#startuml
[*] -> Alice
Alice -> Bob: hello
Bob -> [*]
#enduml
Timing
#startuml
concise Hello
0 is Alice
+100 is Bob
#enduml
Use Case
#startuml
:Alice: -> :Bob: : Hello
#enduml
WBS
#startwbs
+ Alice
++ Bob
#endwbs
Footnotes
It's not realy a classic, I just made that up. But it is something that commonly happens.
Reference the manual here: https://plantuml.com/dot
Rendered in neato not dot, see https://stackoverflow.com/a/53470455/153049
They are not “four nodes”, they are top and bottom headers for every participant in the sequence. This is useful for readability in larger sequence diagrams, see some examples here https://plantuml.com/en/sequence-diagram
You can style your diagram to comply with strict UML with
skinparam style strictuml
Full code
#startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
#enduml

How to change the border color of loop group in plantuml?

See, I have a loop in plantuml
loop
etl -> kafka:
kafka -> linda:
linda --> kafka:
kafka --> etl:
end
Now I want to change the border color of loop group from Black to DodgerBlue, neither
skinparam sequence {
SequenceGroupBorderColor DodgerBlue
}
nor
skinparam loop {
SequenceGroupBorderColor DodgerBlue
}
works, the documentation work of PlantUML is so poor, I can hardly find any detail things, how to deal with this work?
The following does work for me:
skinparam Sequence {
GroupBorderColor #ff0000
}
and
skinparam {
SequenceGroupBorderColor #ff0000
}
To get all possible skin parameters use:
java -Djava.awt.headless=true -jar plantuml.jar -language
and browse through the result.
See http://plantuml.com/skinparam for a small (incomplete) description of the skin parameters.
Edit: My initial: "Looks a bit like the color mnemonics don't work (maybe raise an issue at https://forum.plantuml.net/ask)" is not correct. I must have made a typo somewhere. retried with the comment from OP and it did work with DodgerBlue.

How to mix different plantuml diagram type elements?

I want to have deployment and sequence stuff in one and the same rendered plantuml picture. So I tried the following but it does not work, the rendering shows the sequence stuff for A, B and C as deployment.
How can I force rendering for "A->B" and "B->C" as sequence diagram stuff?
#startuml
file main.c
note right: I want to have description text here
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
#enduml
I think you need to add your note later:
#startuml
title file main.c
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
note right: I want to have description text here
#enduml
Result:

How to color a scnplane with 2 different materials?

I have a SCNPlane that I created in the SceneKit editor and I want 1 side of the plane to have a certain image and the other side of the plane to have another image. How do I do that in the Scenekit editor
So far what I've tried to do is adding 2 materials to the plane. I tried adding 2 materials and unchecking double-sided but that doesn't work.
Any help would be appreciated!
Per the SCNPlane docs:
The surface is one-sided. Its surface normal vectors point in the positive z-axis direction of its local coordinate space, so it is only visible from that direction by default. To render both sides of a plane, ether set the isDoubleSided property of its material to true or create two plane geometries and orient them back to back.
That implies a plane has only one material — isDoubleSided is a property of a material, letting that one material render on both sides of a surface, but there's nothing you can do to one material to turn it into two.
If you want a flat surface with two materials, you can arrange two planes back to back as the doc suggests. Make them both children of a containing node and you can then use that to move them together. Or you could perhaps make an SCNBox that's very thin in one dimension.
Very easy to do in 2022.
It's very easy and common to do this, you just add the rear as a child.
To be clear the node (and the rear you add) should both use the single-sided shader.
Obviously, the rear you add points in the other direction!
Do note that they are indeed in "exactly the same place". Sometimes folks new to 3D mesh think the two meshes would need to be "a little apart", not so.
public var rear = SCNNode()
private var theRearPlane = SCNPlane()
private func addRear() {
addChildNode(rear)
rear.eulerAngles = SCNVector3(0, CGFloat.pi, 0)
theRearPlane. ... set width, height etc
theRearPlane.firstMaterial?.isDoubleSided = false
rear.geometry = theRearPlane
rear.geometry?.firstMaterial!.diffuse.contents = .. your rear image/etc
}
So ...
///Double-sided sprite
class SCNTwoSidedNode: SCNNode {
public var rear = SCNNode()
private var thePlane = SCNPlane()
override init() {
super.init()
thePlane. .. set size, etc
thePlane.firstMaterial?.isDoubleSided = false
thePlane.firstMaterial?.transparencyMode = .aOne
geometry = thePlane
addRear()
}
Consuming code can just refer to .rear , for example,
playerNode. ... the drawing of the Druid
playerNode.rear. ... Druid rules and abilities text
enemyNode. ... the drawing of the Mage
enemyNode.rear. ... Mage rules and abilities text
If you want to do this in the visual editor - very easy
It's trivial. Simply add the rear as a child. Rotate the child 180 degrees on Y.
It's that easy.
Make them both single-sided and put anything you want on the front and rear.
Simply move the main one (the front) normally and everything works.

Resources