PlantUML - Long description with nest brackets - plantuml

I'm trying to draw a long description square with nested components.
Something like
node mynode [
<<device>>
--
long description here
] {
artifact "a nested element"
}
The processor give me error until I remove the long description bracket (or viceversa, I decide to remove the nested element). Therefore, if both elements are presents, some problems occurs.

If simple text long description is enough, then you can just put description in quotation marks and use alias:
database "Some long description" as oracle1 {
storage data
}
actor user
user --> oracle1
If more complex description is required then you can use nested diagrams. But in this case you can't link elements of nested diagrams with elements of the outer diagram.
rectangle rect1 [
Long long description
---
Some more
===
{{
rectangle nested1
rectangle nested2
nested1 --> nested2
}}
]
rectangle rect2
rect1 ---> rect2

How about this:
#startuml
node "<<device>>\n----\nlong description here" as mynode {
artifact "a nested element"
}
#enduml

Related

Why does an arrow make a duplicate component in a PlantUML diagram?

I'm very new to PlantUML, so this is likely something basic.
Sometimes when I add a arrow from one rectangle to another, the original component is not linked. Instead, a new component is created and linked. What am I doing wrong?
In my example, I have this fairly simple diagram:
#startuml
database "DB" {
frame Rules {
rectangle "Item 1"
rectangle "Item 2"
}
}
rectangle "App Server" {
rectangle "My UI"
}
rectangle "System" {
rectangle "Foo"
}
[My UI] --> [Item 1] : create and edit
[System] --> [Item 1] : extract
#enduml
And this is generated:
Note that the arrow from System to Item 1 is for a new component and not the existing "System" element.
What am I doing wrong?
I asked the same question in the PlantUML forum, and was told that this is due to the brackets around the name System in the arrows. I guess they can only be used if the name contains a space.
So replacing
[System] --> [Item 1] : extract
with
System --> [Item 1] : extract
fixes the issue, and creates this diagram:

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 store literals using #entity.values on Slot IBM Conversation Service?

I'm trying use slots on my dialog nodes on Watson conversation but seems that is not properly useful if you want to play with array of literal. I've an entity "#email" that is a pattern so I must use .literal if I want to store the "real value", that is sent by the user, on a context variable. Trouble starts when I try to use #entity.values to store all values that are sent by the user. Actually is not possible to store an array of literals and I'm stuck at this point.
Anyone developed a workaround for this?
The literal is a method, not an attribute. The entities contains a location field, which you can programatically use at the application layer to parse the input text.
If you want to pull them out in conversation, you can use a counter to walk through the entities.
For example:
In your slot node "Then respond with" add the following context bit.
"context": {
"counter": "<? entities.size() ?>",
"literals": ""
},
Next create three child nodes.
Node 1: Create a dummy node, set condition to true. Have it jump to the second node.
Node 2: For the second node, set the condition to $counter > 0 and add the following code to the JSON section.
"context": {
"counter": "<? $counter - 1 ?>",
"literals": "<? entities[$counter].literal + ',' + $literals ?>"
},
Have it jump back to Node 1. The reason for this is Conversation will not allow you to jump to the same node.
Node 3: Have it output the answer. For example: Literal Values: $literals
Here is a sample workspace.
https://pastebin.com/xwgnLq9n
Warning
Watson Conversation has a built in endless loop detection. If a node is hit 50 times in one request, it will throw the following error:
Detected recursion when processing the node with id
[node_20_1513835954092]. This node has been already processed [50] times
in this execution step
At which point the node will fail and you will get no result back. So if you expect more than 50 entities then you need to do this at the application layer.

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.

Graphisoft GDL - How to get layout name and number inside GDL object

I want to show the layout name and number inside a gdl object that I placed on my layout.
How can I get a layout name and number into my GDL script?
You can get the layout name in several ways inside your GDL script.
A commonly used solution is to use the autotext tags <LAYOUTNAME> or <LAYOUTID> as a string. This tag will be replaced by the layout name or layout id AFTER the gdl object has compiled.
xPos = 0;
yPos = 0;
TEXT2 xPos, yPos, '<LAYOUTNAME>'
or
TEXT2 xPos, yPos, '<LAYOUTID>'
All autotext tags can be found here in the documentation.
Note: Be aware that <LAYOUTID> and <LAYOUTNUMBER> are two different things!
The problem with this solution is that you cannot use the value in for example function to compare with a value. So this will never evaluate to true:
'<LAYOUTNAME>' = 'my layout name'
In case you want to do something like that that there is an alternative way using the GDL REQUEST options function
n = request ("HomeDB_info", "", n, LayoutId, LayoutName, n)
The values will be stored in the variables LayoutId and LayoutName
This is also documented here and mentioned here on the ArchiCAD-TALK forum
It is possible to evaluate this value and use this directly in your code:
IF LayoutName = 'my layout name' THEN
! layout name is 'my layout name'
ELSE
! layout name is something else
ENDIF

Resources