Can Not Instantiate User Object

SteelyDanalyst Member Posts: 1

I have created a user class that I would like to implement to drive ACT extension behavior. I have written some XML to insert a generic DataModelObject into the tree and given a class="MyClassName" attribute in the object tag for the xml definition. When I insert an object of my user defined type in the tree I get the following outputs to my ACT log:

Unable to instanciate object from class 'GenericClassName'.
'ObjectDictionaryExpando' object has no attribute 'GenericClassName'
at CallSite.Target(Closure , CallSite , Object )
at IronPython.Runtime.PythonContext.ScopeGetVariable(Scope scope, String name)
at Ansys.ACT.Core.Extension.CreateObjectController(String className, Object[] args)

I am not sure what the issue is here, I have files in the extension directory that define the class behavior and have included them using the .

I am also wondering how the underlying user object is associated to the corresponding DataModelObject that exists in the tree. I need the userobject to take data provided by the user in the properties of the DataModelObject that represents the userobject in the tree.


  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 290
    First Anniversary First Comment 5 Likes Ansys Employee
    edited May 3

    You can use something like this to start.

    ActObjDict = {}
    class ActObjClass:
    def init(self, ExtAPI, ActObj):
    global ActObjDict
    self.ActObj = ActObj
    self.ExtAPI = ExtAPI
    ActObjDict[self.ActObj.ObjectId] = self.ActObj

    def oninit(self, Obj):
    def onadd(self, Obj):
    def onremove(self, Obj):
        global ActObjDict
        del ActObjDict[self.ActObj.ObjectId]
    def GetMechanicalObject(self):