Will incorporate suggestion on getCurveSegments and setCurveSegments.
Pity about SendToBack - I may have to shrink footpath widths and tone down colour instead.
About SendToBack, the only thing I can think of is to create the objects in the correct order so they will be displayed in the correct hierarchy. But I understand if that is not possible to do for all objects in your model.
(that is to first create the conveyor, then workplaces etc. Then the conveyor should be in the bottom and workplaces on top of it)
Thanks for last suggestion - that leads to a nice solution :-
Allocate a display layer parameter in each call (which creates that object in the physical layer and connects it to the Worker Pool with Footpaths).
Then run a loop round all these calls, with the display layer incrementing from 1 (backmost layer) until no further object is processed.
Create the object only if the current display layer matches the display layer in the loop.
How's that for a workaround ?
I don't know the details of your model, but it sounds like it should work :-)
It depends a lot of the situation that you need to add the line. I think my approach would be to first create the line and set the linesegments. Then, create a workplace in each end of the line. Then simply connect the line to the workplace and set the attribute .station to whatever the workplaces should be connected to.
But it also sounds like you have some complicated conditions as to when you need to create a line, so you probably have the correct approach already.
As usual, emergent behaviour is not always as expected - unplanned effort is required to address this behaviour - but through ongoing effort the result is beginning to look like a robust solution to ......
... remember this was the gist of the task .....
Take an existing production line, implemented solely using workstations without human resources, and automate adding workers to this using a generally applicable method.