icon

Das Wissen aller Anwender nutzen

Im Allplan Connect Forum tauschen sich Anwender aus, geben wertvolle Tipps oder beraten sich bei ganz konkreten Aufgabenstellungen − auch international.
Und damit wirklich keine Frage unbeantwortet bleibt, unterstützen die Mitarbeiter des Technischen Supports ebenfalls aktiv das Forum.

Es erwarten Sie:

  • Foren-Vielfalt aus CAD Architektur, CAD Ingenieurbau uvm.
  • Tipps von User für User
  • international: Deutsch, Englisch, Italienisch, Französisch und Tschechisch

Melden Sie sich jetzt an und diskutieren Sie mit!

Zur Registrierung

[Frage] Modify Style Area of BaseElementAdapter [Gelöst]

Schlagworte:
  • Allplan
  • 2025
  • PythonParts
  • StyleArea

Hello everyone,
I work on Allplan 2025
I am trying to change the Style Area of elements.
In my script:
- Get all elements in my drawing
- Modify the style area of them via the attribute [at]125[at]

---------------------------------------------------------------------------
document_manager: DocumentManager = DocumentManager.get_instance()

document_adapter: AllplanEleAdapter.DocumentAdapter = document_manager.document

all_elements: AllplanEleAdapter.BaseElementAdapterList = AllplanBaseElements.ElementsSelectService.SelectAllElements(document_adapter)

print(len(all_elements))
print("*"*50)

for element in all_elements:
print("\t"+ element.GetDisplayName())

AllplanBaseElements.ElementsAttributeService\
.ChangeAttribute(125,301, all_elements)
---------------------------------------------------------------------------

Unfortunately it doesn't work. I tried other attributes but it works except [at]125[at]

The Trace window shows:

1
**************************************************
3D object

Check and update (Fill)...
Data Update - 0 ms
Update Asso View- 0 ms
Update UVS - 0 ms
Update Finish Elements - 0 ms
Fill Finish Elements - 0 ms
Update MVS Section Doc - 0 ms

Does anyone have any ideas
Thanks
Tan

Lösung anzeigen Lösung verbergen

Hi,

VisualScripting uses the same API so it's an PythonPart.

The example "AssignFaceStyle" has ModifyFormatProperties

AllplanBaseElements.ElementsPropertyService.ModifyFormatProperties([(AllplanBaseElements.ModifyPropertyID.FaceStyle, face_style)],NodeObjectUtil.create_base_element_adpter_list(objects))

Here an example

Christophe

Hi,

You're looking at this function, but it's look like in ALLPLAN 2026.

I don't know if you can do this with 2025.

Best
Christophe

Hi cmaignan,
I have no intention of upgrading to version 2026. When I use Visual Scripting on version 2023, there is an "AssignFaceStyle" button, and I though PythonPart has a similar method on the same version. Anyway, thanks for your solution.

Thank
Tan

Hi,

VisualScripting uses the same API so it's an PythonPart.

The example "AssignFaceStyle" has ModifyFormatProperties

AllplanBaseElements.ElementsPropertyService.ModifyFormatProperties([(AllplanBaseElements.ModifyPropertyID.FaceStyle, face_style)],NodeObjectUtil.create_base_element_adpter_list(objects))

Here an example

Christophe

Hi cmaignan,
Thank for your solution.
It is perfect for me.
I have updated my code according to it:

document_manager: DocumentManager = DocumentManager.get_instance()
document_adapter: AllplanEleAdapter.DocumentAdapter = document_manager.document
all_elements: AllplanEleAdapter.BaseElementAdapterList = AllplanBaseElements.ElementsSelectService.SelectAllElements(document_adapter)
face_style: int = 301
AllplanBaseElements.ElementsPropertyService.ModifyFormatProperties([(AllplanBaseElements.ModifyPropertyID.FaceStyle, face_style)],all_elements)

Thank you again
Tan

You're welcome

Christophe