[Domanda] Visual Scripting, neues Attribut hinzufügen


Hallo,

Ich bin neu in Visual Scripting und weiß nicht viel.
Es tut mir leid, wenn diese Fragen dumm klingen.

In Beispielen habe ich die AttributeModifier.pyp gefunden. Es ermöglicht mir, Elemente zu filtern und dann einem Attribut einen neuen Wert hinzuzufügen. Aber ich habe keine Möglichkeit gefunden, ein neues Attribut hinzuzufügen und ihm dann einen Wert zu geben.

Ich möchte ein Skript erstellen, mit dem ich Elemente nach Attributen filtern und dann ein neues Attribut (z. B. Uniclass2015) hinzufügen und dann den Attributwert zuweisen kann.

Und weiter, wenn das möglich ist, ist meine neue Frage:
Ist es möglich, eine Dropdown-Liste mit bestimmten Werten zu erstellen, sodass ich keinen Wert schreiben muss, sondern ihn aus dem Dropdown-Menü auswählen muss?

Wenn ja, wo im Code soll ich die Werte importieren, die im Dropdown-Menü angezeigt werden.

Vielen Dank.

_________________________________________________

Hi there,

I'm new to visual scripting and don't know much.
I'm sorry if these questions sound stupid.

In examples, I've found the AttributeModifier.pyp. It allows me to filter elements and then add a new value to an attribute. But I didn't find a way how to ADD a new attribute and then give it a value.

I wish to create a script that will allow me to filter elements by attributes and then ADD a new attribute (eg. Uniclass2015), and then assign the attribute value.

And further on, if that is possible, my new question is:
Is it possible to create a drop-down list with certain values, so that I don't have to write a value, but choose it from the drop-down menu?

If yes, where in the code should I import the values that would show in drop-down menu.

Thank You a lot.

Allegati (1)

Type: image/png
251 scaricato
Size: 39,70 KiB

Show most helpful answer Hide most helpful answer

Entferne einfach die Verbindung von AttributeNumber.
Dann kann man die Attribut-ID eingeben, auch eine noch nicht vorhandene.

Eine Schwierigkeit ist: Man muss neben dem Elementtyp nach einem oder mehreren Attribut-Werten filtern (nicht nur nach der Existenz des Attributs), und ggf. mehrere Attribut-Werte mit UND- / ODER verknüpfen. Ich denke nicht, dass dies derzeit mit Visual-Scripting performant möglich ist.

Aber schauen Sie sich das Plugin Klassifizierung an.
Mit diesem Plugin können Sie die Elemente filtern nach: Elementtyp / Layer / Attribut-Werte und können dies mit einer freien Formel kombinieren. Die entstehenden Klassen lassen sich unterschiedlich einfärben (zur visuellen Kontrolle) und können in ein oder mehrere Attribute geschrieben werden.

Simply remove the connection of AttributeNumber.
Then you cann enter the Attribute ID, also a not yet existing one.

A special thing is: you have to filter for one or more attribute-values (not only for existence of attribute)and, if necessary, combine several attribute values with AND / OR. I think, currently this is not possible with visual scripting in acceptable performance.

But have a look at the Plugin Klassifizierung
With this Plugin you can filter Elements by: Elementtype / Layer / Attribute-Values and can combine this with a free formula.
The resulting classes can be colored differently (for visual control) and can be written to one or more attributes.

Allegati (1)

Type: image/png
220 scaricato
Size: 118,56 KiB

Entferne einfach die Verbindung von AttributeNumber.
Dann kann man die Attribut-ID eingeben, auch eine noch nicht vorhandene.

Eine Schwierigkeit ist: Man muss neben dem Elementtyp nach einem oder mehreren Attribut-Werten filtern (nicht nur nach der Existenz des Attributs), und ggf. mehrere Attribut-Werte mit UND- / ODER verknüpfen. Ich denke nicht, dass dies derzeit mit Visual-Scripting performant möglich ist.

Aber schauen Sie sich das Plugin Klassifizierung an.
Mit diesem Plugin können Sie die Elemente filtern nach: Elementtyp / Layer / Attribut-Werte und können dies mit einer freien Formel kombinieren. Die entstehenden Klassen lassen sich unterschiedlich einfärben (zur visuellen Kontrolle) und können in ein oder mehrere Attribute geschrieben werden.

Simply remove the connection of AttributeNumber.
Then you cann enter the Attribute ID, also a not yet existing one.

A special thing is: you have to filter for one or more attribute-values (not only for existence of attribute)and, if necessary, combine several attribute values with AND / OR. I think, currently this is not possible with visual scripting in acceptable performance.

But have a look at the Plugin Klassifizierung
With this Plugin you can filter Elements by: Elementtype / Layer / Attribute-Values and can combine this with a free formula.
The resulting classes can be colored differently (for visual control) and can be written to one or more attributes.

Allegati (1)

Type: image/png
220 scaricato
Size: 118,56 KiB

Hallo Nemo,

Danke für deine schnelle Antwort.

Noch eine Frage:
Wenn ich 2 Attribute gleichzeitig hinzufügen möchte? Ich muss das Skript zweimal ausführen?
Kann ich es sofort tun?

Ich denke, das würde AND / OR-Funktion benötigen.

Freundliche Grüße
____________________________________________

Hello Nemo,

Thank You for your fast reply.

One more question:
If I want to add 2 attributes at once? I need to run the script twice?
Can I do it at once?

I guess that would require AND / OR function.

Best regards

Also thanks for the plugin recommendation.

Es gibt ein Script "AttributeConditionFilter" in den Examples (attr_cond.png),
welches man leicht erweitern kann (attr_cond_vs.png), um den gewünschten Workflow zu erhalten.
Wenn man das dann ausführt, kann man einen oder mehrere Element-Typen auswählen,
diese nach einem Attribut-Wert filtern, und den so gefilterten Elementen einen neuen Attribut-Wert zuweisen(s.attr_cond_vs_exec.png)
Für die Zuweisung des Attributes muss man auf den Knopf "Ändern" drücken!
Nach Änderung der Attribut-Nr. und des Attribut-Werts kann man sicher gleich nochmlal auf den Knopf "Ändern" drücken.
Muss man einfach ausprobieren...

-------------------------------------------------------------------------

There is a script "AttributeConditionFilter" in the Examples (attr_cond.png),
which can easily be extended (attr_cond_vs.png) to get the desired workflow.
When you execute this, you can select one or more element types,
filter them by an attribute value and assign a new attribute value to the elements filtered in this way (see attr_cond_vs_exec.png)
To assign an attribute, you should press the "Change" button!
After changing the attribute no. and the attribute value you can press the "Change" button.
You just have to try it out...

Allegati (3)

Type: image/png
83 scaricato
Size: 38,36 KiB
Type: image/png
163 scaricato
Size: 40,24 KiB
Type: image/png
111 scaricato
Size: 37,66 KiB

Ja ich verstehe das.

Das ist was ich will (test11.png).
Aber es funktioniert immer noch nicht, ich kann nicht 2 Attribute hinzufügen oder nach 2 Attributen filtern.

eg. Ich möchte nur die Wand in der Mitte auswählen.

Es filtert nicht das gewünschte Element, sondern nur den zuletzt verwendeten Filter, sodass Wände nach 0,1 und nicht nach Material gefiltert werden.

Und sobald ich auf Ändern klicke, hat die zweite Schaltfläche "Ändern" überhaupt keine Wirkung (test234.png).

Vielen Dank.
__________________________________________

Yes, I understand that.

This is what I want (test11.png).
But it still doesn't work, I can't add 2 attributes, or filter by 2 attribute.

eg. I want to only select the wall in the middle.

It doesn't filter the element I want, but only uses the last filter I used, so it filters walls by 0.1 and not by material (test234.png).

Thanks.

Allegati (3)

Type: image/png
137 scaricato
Size: 60,33 KiB
Type: image/png
129 scaricato
Size: 170,82 KiB
Type: image/png
79 scaricato
Size: 21,23 KiB

Ich habe es geschafft, das Problem zu beheben. Jetzt wird nach 2 Attributen gefiltert, aber ich kann der gefilterten Wand immer noch keine 2 neue Attribute hinzufügen.

Wenn ich jedoch eine andere Wand mit den Filtern auswähle, kann ich der anderen Wand ein neues Attribut hinzufügen, aber das zweite Attribut kann ich immer noch nicht hinzufügen.

Das Skript für ein Attribut befindet sich im Anhang.

__________________________________

I managed to fix it, now it filters by 2 attributes, but I still cannot add 2 new attributes to the filtered wall, only one.

However, if I choose another wall with the filters, I can add new attribute to the other wall, but still can't add the second attribute.

Script for one attribute is in attachment.

Allegati (1)

Type: text/xml
1130 scaricato
Size: 4,94 KiB

It works for me (see attr_cond_2.png)

Be sure, that you have connected the "Filtered Element"-Output from AttributeValueFilter-Node
to the second AttributeFilter-Node! (In your screenshot you have used Element-Output)

And:
You don't need 2 AttributeModifier-Nodes chained!
Take only one and click "Change" twice!

Allegati (1)

Type: image/png
174 scaricato
Size: 44,83 KiB

Sorry Nemo,

I kept trying several times before asking for help again.
I attached a video (test.mp4) explaining what's happening to me, the second attribute won't even add.
//I understood it like that the script came to an end and that same element can't be filtered again, and nothing new (i.e. new attribute, value etc..) can be added to that same element.
//Only the first attribute gets added to each element I filter and its value cannot be changed unless I close and re-run the script.

Is there a possibility of refreshing the script after an attribute is applied to an element? If you understand what I mean.
Edit: I tried reinstalling Allplan as well, I'm wondering do you encounter the same issue? Or could it be due to my PC?

Thank You a lot for helping!

Allegati (1)

Type: video/mp4
1355 scaricato
Size: 6,51 MiB

Hello Jsabic,

I run into the same kind of bugs in VS after changing attributes. only solution So far: rerun the script.
Hope they fix the refresh of the attributes during the same scriptrun soon.

Best regards
Marek

czyborra klingbeil architekturwerkstatt - http://www.cka.berlin


https://campus.allplan.com/ utilizza cookies  -  Maggiori informazioni

Accetta