[gme-users] Populating a model with an addon
Zoltan Molnar
zolmol at isis.vanderbilt.edu
Mon Aug 6 15:20:36 CDT 2007
Hi Brian,
The code snippet itself is correct, however the BON2 add-ons proved not
to be too reliable (because of referencecounting bugs) over the long run
(especially in case of the 'OnCreated' event ). I could recommend
writing C++ Raw COM add-ons instead.
If you invested a lot into this Bon2 add-on and you'd like to use it,
setting the autocommit to false might help as follows:
In objecteventperformed() method's first line please insert this:
if( object) object->getProject()->setAutoCommit( false);
Or you could use simply:
project->setAutoCommit( false);
in the Component::initialize( Project& project ) method.
I tried out both of these, and they solve the error message you have
seen.
Br,Zoli
> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf
> Of Bryan Perozzi
> Sent: Tuesday, July 31, 2007 9:15 AM
> To: gme-users
> Subject: [gme-users] Populating a model with an addon
>
>
> Hello all,
>
> I'm creating a BON2 add-on for GME 7.6.29 to populate a model
> based on events. In the process I've observed some unusual
> errors. For instance, the following code creates a folder and
> then a model as its child, but always throws "(0x8073200C):
> No territory has been selected" seemingly after leaving the
> context of the add-on.
>
> objectEventPerformed( Object& object, unsigned long event,
> VARIANT v ) { if (object->getObjectMeta().name() == "System")
> { Folder root = object->getParentFolder();
>
> Folder folder = Folder::create(root, "FolderType");
> folder->setName("NewFolderName");
> Model model = Model::create(folder, "ModelType");
> }
> }
>
> Now, the code the add-on is using is pulled from a working
> interpreter that I wrote earlier on.
>
> Does anyone have any insight on why object creation seems to
> function differently between add-ons and interpreters, or is
> this a bug?
>
> Thanks,
> - Bryan
>
> ----------------------
> Bryan Perozzi
> Lockheed Martin ATL
>
>
>
>
>
>
>
> ---- Msg sent via ATL Webmail
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
>
More information about the gme-users
mailing list