Forum de la communauté Allplan

[Question] Script stuck/looped and question about attributes re-assignment [Résolu]


Greeting everyone,
Recently I have been developing a script command for “Tile by sample”. The point is to make a command that can provide fast outcome for wide range of objectives. The problem is it doesn’t always work.

For what it can be used:
- Pavement tiling using pre-determined tile configuration (supports more than 1 samples)
- Interior tiling – not only it can tile square shapes, but different polygonal shapes (you can tile hexagonals, provided that you know the required diagonal distances/offsets)
- Roof tiling – generate the roof tile, rotate it so the next one can go under it, and use the script. After selecting the tile area, check the slope options and finally use the cut-outs option to remove any chimney spots or irregulates.

How does it work? – Upon start this is the usual order of inputs:
- Select tiling start point
- Select tile area
- Select sample anchor point
- Select samples
- Slope rotation axis (even when off, it requires it as input for some reason)
Now it will generate preview, which you can adjust further by the additional options in the Node palette (rotation, unique rows and their offset, properties, etc)

Problem / debugging: Often there is an error where the script gets stuck on “To point” input, from you can’t go any further, as the input doesn’t work. I have no clue know why, how and where it comes from, but the only way around it is to click on a handle point of the selected tile area, provided that the handles are visible, as they don’t always appear.

Bonus points question: As the final outcome is generated from “Intersection” command, all objects lose their attributes. Any ideas how to keep/reassign them again? I saw a few posts such as:
https://connect.allplan.com/forum/topics/topic/topics/visual-scripting/assign-attribute-to-geometry-object.html – state that there is a example script that comes with allplan, but I don’t have access to it at work. Is there any place where I can download them?
https://connect.allplan.com/forum/topics/topic/topics/pythonparts/accessibility-of-geometrical-attributes-within-the-pythonpart-api-and-visual-scripting.html – suggest using “GetObjectsAttributes” and assign them to the final outcome, but it won’t work with multiple samples (provided that they have different attributes.

I have provided 2 files:
The “Tile by object.pyp” definitely works, but still gets stuck from time to time.
The “Tile by object with slope.pyp” is the same like the other but with slope options. Here the script always gets stuck early on, I haven’t managed to get an output once.

Pièces-jointes (2)

Type: text/xml
Téléchargé 698 fois
Size: 47,78 KiB
Type: text/xml
Téléchargé 754 fois
Size: 57,86 KiB

Show solution Hide solution

Cité par DGeorgiev

Problem / debugging: Often there is an error where the script gets stuck on “To point” input, from you can’t go any further, as the input doesn’t work. I have no clue know why, how and where it comes from, but the only way around it is to click on a handle point of the selected tile area, provided that the handles are visible, as they don’t always appear.

I checked your script Tile by object.pyp and the node "MoveByPointInput" caused your problem. The node "MoveByPoints" should solve your problem, as you don't need to interactively define your target point with mouse click.

Cité par DGeorgiev

As the final outcome is generated from “Intersection” command, all objects lose their attributes. Any ideas how to keep/reassign them again?

Currently the object inside the PythonPart container doesn't have attributes. If you explode / unlink the PythonPart, the individual objects you get, won't keep the attribute from that PythonPart.
Cité par DGeorgiev

there is a example script that comes with allplan, but I don’t have access to it at work. Is there any place where I can download them?

Example files are always installed together with Allplan. Please check Examples.png to find them.

Product Owner API, Allplan GmbH

Pièces-jointes (2)

Type: image/png
Téléchargé 65 fois
Size: 56,86 KiB
Type: image/png
Téléchargé 34 fois
Size: 22,55 KiB

Cité par DGeorgiev

Problem / debugging: Often there is an error where the script gets stuck on “To point” input, from you can’t go any further, as the input doesn’t work. I have no clue know why, how and where it comes from, but the only way around it is to click on a handle point of the selected tile area, provided that the handles are visible, as they don’t always appear.

I checked your script Tile by object.pyp and the node "MoveByPointInput" caused your problem. The node "MoveByPoints" should solve your problem, as you don't need to interactively define your target point with mouse click.

Cité par DGeorgiev

As the final outcome is generated from “Intersection” command, all objects lose their attributes. Any ideas how to keep/reassign them again?

Currently the object inside the PythonPart container doesn't have attributes. If you explode / unlink the PythonPart, the individual objects you get, won't keep the attribute from that PythonPart.
Cité par DGeorgiev

there is a example script that comes with allplan, but I don’t have access to it at work. Is there any place where I can download them?

Example files are always installed together with Allplan. Please check Examples.png to find them.

Product Owner API, Allplan GmbH

Pièces-jointes (2)

Type: image/png
Téléchargé 65 fois
Size: 56,86 KiB
Type: image/png
Téléchargé 34 fois
Size: 22,55 KiB

I checked your script Tile by object.pyp and the node "MoveByPointInput" caused your problem. The node "MoveByPoints" should solve your problem, as you don't need to interactively define your target point with mouse click.

Thank you mate, the node swap fixed the script.