Start a new topic

Errors and crashes when creator exits after running a script

Original Post by: chrisell Thu Oct 7 17:42:41 2010


I've got a scripting problem that I'm not sure how to resolve. The script I've written runs cleanly when in use, but whenever I've used it, I get a couple of error dialogs as Creator is closing.

Note the errors never come up when creator is running, only when it's closing down.

The first one is DuumyGLWnd: mgfltx.exe - Application error. When I OK that one, I then get a pure virtual function call error (R6025). When I OK that one I get another DummyGLWnd error. Only when I OK that third error is Creator finally shut down.

The script is designed to parse a model and turn off sections of it based on some of our custom attribution. eg if we have a model with 20 different colour schemes in it, only make one of them visible without having to hunt through the hierarchy and do it manually.


Any ideas ?


#!/usr/local/bin/python


# Set up hex masks for status box

MMBX_OK = 0x00000001

MMBX_OKCANCEL = 0x00000002

MMBX_YESNO = 0x00000004

MMBX_YESNOCANCEL = 0x00000008

MMBX_STATUS = 0x00000100

MMBX_WARNING = 0x00000200

MMBX_ERROR = 0x00000400

MMBX_QUESTION = 0x00000800


# These lines tell the script where to find our custom attributes by byte offset.

# This info comes from the .h files

EP2_SITEID = "EP2DATA"

eEp2SwitchExt=264

eEp2SwitchSelectNum=2098

ep2SwitchExt=ddGetUCode(EP2_SITEID, eEp2SwitchExt)

ep2SwitchSelectNum=ddGetUCode(EP2_SITEID, eEp2SwitchSelectNum)


MEL_SITEID = "MELDATA"

eMelSwitchExt=260

eMelSwitchSwitchNumGlobal=2059

melSwitchExt=ddGetUCode(MEL_SITEID, eMelSwitchExt)

melSwitchSwitchNumGlobal=ddGetUCode(MEL_SITEID, eMelSwitchSwitchNumGlobal)


# Pop up a box asking for the select number

s,usercontaminant = mgPromptDialogInteger (None, "Enter contaminant number (1 - 8)", 1)

if usercontaminant <1:

usercontaminant = 1

if usercontaminant >8:

usercontaminant = 8


def ToggleDisplay (db, parent, rec, userData):

if (mgGetCode (rec) == userData):

return MG_TRUE

return MG_FALSE


db = mgGetCurrentDb()

code = fltSwitch

mgDeselectAll (db)

nodes = mgFind (db, ToggleDisplay, code, 0)


num = mgGetRecListCount (nodes)

name = ddGetLabel(code)


message = "Changed %d %s%s" % (num,name,('\0' if num==1 else 'es'))

mgSendMessage (MMSG_STATUS, message)

# Uncomment this next line if you want a popup confirmation dialog

# mgMessageDialog(None, "Title", "%s"% message, MMBX_OK+MMBX_WARNING)


rec,matrix = mgGetNextRecInList (nodes)

while rec != None:

contam = 0

if mgHasAtt(rec, ep2SwitchExt):

contam = mgGetAttList (rec, ep2SwitchSelectNum)[2]

elif mgHasAtt(rec, melSwitchExt):

contam = mgGetAttList (rec, melSwitchSwitchNumGlobal)[2]

if (contam !=usercontaminant):

mgSetAttList (rec, fltIOn, 0)

elif contam >0:

mgSetAttList (rec, fltIOn, 1)

rec,matrix = mgGetNextRecInList (nodes)


Login to post a comment