Adding pars/parGroups to sequence with python

I can´t find information on how to create a sequence from scratch using python.
Neither the Sequence Class nor the Par Class seem to have any methods or attributes that allow me to modify the behaviour.
In the Par Class the sequence attribute is Read Only.
Similiar, in the Sequence Class, the BlocPar and BlogParGroups attributes are also marked as read only.

You create custom parameters and sequences from parameter page objects

You can create such a page from a COMP object if there’s now custom parameter page yet.

Jo Josef,
The question is though how you can add a parameter to a sequence once created, as the only options that might be the right place of a sequence object are both read only. So either the documentation is wrong, incomplete or I looked in the wrong place :grimacing:

ah, indeed!

Also didn’t notice who asked the question, would have assumed that you’d know everything I wrote in my first answer(:

Hi @plusplusone,

after creating the sequence parameter and the parameters you would like to be part of the sequence, you can set the .blockSize

# create the page
p = op('/project1/base1').appendCustomPage('Page')
# create a sequence
seqPar = p.appendSequence('Test')
# create a parameter
p.appendInt('Integer')
# create another parameter
p.appendTOP('Topref')
# set the blocksize of the sequence
seqPar.sequence.blockSize = 2

We need to update both wiki pages on Sequence Class as well as on Sequential Parameters to make this more clear.

cheers
Markus

Hi Markus,
thanks for the example. This is pretty unintuitive I have to say but I think I get the idea. By adjusting the size the sequence basicly “swallows” the parameters added after it/in the list of parameters.
Is there not better way? Something like seqPar.appendInt("Name") or op("foo").par.Foo.addToSequence( op("foo").seq.Bar )? (If not, this is an RFE suddenly :slight_smile: )

Changing blockSize is the way things work under the hood, but I can see why you’d find it a bit odd. There’s no way to do the addToSequence you suggest, but I could imagine op(‘foo’).seq.Bar.appendInt. Will put in an RFE.