I would like to ask whether there is a way (command in SimTalk) how to check whether a certain (NOT user-defined) attributes of a specific object exists or not. For example, I want to find out, whether a certain object has or has not the attribute "ShiftCalendarObject".
If it was a user-defined object I would use the command "getAttrNo". Yet, I do not know how to ask the same query regarding a "native" attribute.
I do not need to inquire the VALUE of the attribute, but whether it exists or not.
Thank you very much in advance.
Solved! Go to Solution.
neither the command "isNameUnique" nor "HasAttribute" works.
Yet, I found the command PutAttributeNamesIntoTable which seems to pot all attributes into a table in which I can then easily find the individual attribute (if its exists).
This semms to be a satisfactory solution, so far.
...neither the command "isNameUnique" nor "HasAttribute" works....
Sorry, but I cannot follow you there, as both methods work.
Please provide an example, highlighting in which way you called the methods to fail.
Also, which version of Plant Simulation are you using? "HasAttributed" was added somewhere between PlantSim 13.1 and 14.0. (I dont' know which one)
Edit: Apparenty it was added in PlantSim 14.1
That might be the case - I am still using PS 13.0.9
Therefore, the command HasAttribute is not provided.
SingleProc.isNameUnique("ProcTime") returns false.
- I am not sure how to recognize then whether the Attribute exists or not...
"IsNameUnique" only checks whether or not the string (in this case "ProcTime") is used as a name on any object already present in the model. Two objects in the same frame can not have the same name, as you probably already know.
Edit: ignore the advice above, it seem like I misunderstood how the command "IsNameUnique" works.
I see two solutions: Either check the objects manually, either with the help guide or the "Show attributes and methods" window. (right click on an object/select the object and press F8)
Or do as @Eventdebugger usually says:
Always consider using the AttributeExplorer!
If I read well, checking, if an attribute (name) exits or not,
is what @JiriHloska is looking for.
IsNameUnique does exactly this (also in v13 s.b.)
returning false means the name / attribute is not unique -> exists
returning true means the name / attribute is unique -> does not yet exist
For more details have a look at "isNameUnique" in the help file