I would like to get some objects from other models in my modelgroup. However, the debugger receives an error message that the model does not exist. I get the modelid, the correct modelname and there are defined objects of the class in the model but the access to a specific object is not possible.
I tried this code but the returned objids in line 23 is always empty.
1ON_EVENT "AfterEditAttributeValue" {
2#The parameter instid contains the model ID of the modified instance,
3#attrid the ID of the changed attribute, modelid the ID of the model containing the modified instance and attrtypeid the attribute type code
4SET veränderteAttrid:(attrid)
5SET veränderteModelid:(modelid)
6CC "Core" GET_CLASS_ID objid:(instid)
7SET veränderteClassid:(classid)
8CC "Core" GET_CLASS_ID classname: "Kalender"
9SET kalenderClassid:(classid)
10IF ((veränderteClassid) = (kalenderClassid)) {
11 CC "Core" GET_MODELGROUP_ID mgroupname: "Models" sep:" "
12 CC "AdoScript" INFOBOX ("modelgroupid " + STR(mgroupid))
13 CC "Core" GET_MODELGROUP_MODELS mgroupid: (mgroupid)
14 CC "AdoScript" INFOBOX ("modelle " + (modelids))
15 FOR mid in:(modelids) {
16 CC "AdoScript" INFOBOX ("mid: " + mid)
17 CC "AdoScript" INFOBOX ("current model id: " + (mid))
18 CC "Core" GET_MODEL_MODELTYPE modelid:(VAL mid)
19 IF ((modeltype)="Lehrveranstaltung") {
20 CC "Core" GET_MODEL_INFO modelid:(VAL mid)
21 CC "AdoScript" INFOBOX ("current model name: " + modelname)
22 CC "Modeling" OPEN modelids:(mid)
23 CC "Core" debug GET_ALL_OBJS_OF_CLASSNAME modelid:(VAL mid) classname:("Vorlesung")
24 CC "AdoScript" INFOBOX (" found objs: " + objids)
25 #CC "Modeling" CLOSE modelids:(mid)
26 }
27 }
28 }
29}
Why is the objids empty and why does the error message say that the model does not exist?
You find the library in the attachment. The error occurs in the modeltype “Menschen” when an attribute is changed for the class “Kalender”. The script should find all objects of the classname “Vorlesung” in the modeltype “Lehrveranstaltung”.