I would strongly advise against using 1 - it is likely to change. There really is no public API to create an ADE state outside of ADE - whilst in theory it might be possible using the asiSaveState() API, that requires a "sev" (simulation environment, i.e. ADE window) around to about to save the state. That's because mostly the save state functionality is really part of the ADE interface.
In reply to Andrew Beckett:
Thanks for the reply.
I tried the below two methods to save state and my inferences are as below:
Schematic and ADE are open. Both were opened manually.
sevS = hiGetCurrentWindow()->sevSession
// Obtain ADE's o_session
sevSo1 = sevEnvironment(sevS)
//Add a new DesignVariable
asiAddDesignVarList(sevSo1, list('("x" "1"))
This opens a FORM to save the state. Human interface needs to be avoided !
so2 = asiGetCurrentSession()
// Save ASI State
WARNING (ADE-1071): Cellview nil of type nil already exists.
Above warning appears. However, so2->cellName has the correct value and is not 'nil'. But so2->name is nil.
Any clues on which approach is right and if Method(2) is correct, what is wrong in ASI state not getting saved.
In reply to GaneshShamnur:
Run out of time to check now, but my first guess is that in method 2 you need to provide some of the keyword arguments to asiSaveState (such as ?name, ?cell, ?lib etc) - see the documentation. Note that it's the lib/cell/view of the state that matters here, not the design.
Your guess was partly correct. The API needed 'name' parameter.
After passing a name for the state to save, i.e asiSaveState(so2 ?name "spectre_custom_state"), a proper ADE session state could be saved.
However, the interesting question is why does it seek 'name' as argument while the session-object already has a value for 'name'.
In API description, 'name' is an optional argument.Moreover the warning message didn't mean that either !.
But the API does work. Thank You.
How would the session object have a name for the state? I agree the error messages are not that great though - this API doesn't have as much checking as it should...
I meant about the default 'name' a session picks.
I expect it to save with the same name when no 'name' parameter is passed.
se4 = asiGetCurrentSession()
So, 'spectre6' is the expected state to be saved.
I have no idea why you think that name would have anything to do with the state name. It's a unique name given to the session (used to generate unique identifiers for certain objects), and is unrelated to the name of the state that you are saving.
It doesn't (as far as I know) say anywhere in the documentation that this is the state name.
Note that in general you should not be querying attributes on asi objects - these are not a public interface and may change without warning. Instead you should use the public API to isolate you from any necessary implementation that we might have to make to improve the tools in the future.
Thanks for the explanation.