Hello,
I am doing the following all in python:
But when I try to regenerate the model using the new rule file, it seems to fail unless I put a delay in front, as in:
time.sleep(10)
shapes = ce.getObjectsFrom(ce.scene, ce.isShape)
ce.generateModels(shapes)
Is there a reason why the delay is needed? I might be doing something wrong here.
Thanks,
Robert
Solved! Go to Solution.
From trial and error, it looks like whenever you associate a .cga with a shape,
one should add a bit of delay to it, as in (function "framewait" defined in earlier post)
ruleFile = "rules/foo.cga"
ce.setAttribute(zone, "/ce/rule/ruleFile", ruleFile)
framewait(2)
That's probably because CE is still busy with the first model generation. Try ce.waitForUIIdle().
Thanks for the suggestion. I gave it a try it works a bit better. I ended up doing a hack, where
I estimate the wait delay based on how many buildings (collada) I need to redraw.
def framewait(delay=0😞
print "Waiting", delay, "seconds ..."
time.sleep(delay)
views = ce.getObjectsFrom(ce.get3DViews())
views[0].frame()
ce.waitForUIIdle()
print "frame finished"
Have you looked into @noUIupdate and ce.generateModels ( --> asynchronous)? Those might help as well.
I upload the results to arcGIS online, so I do need the model to be complete. With @noUIUpdate and asynchronous, how can I tell when the models are ready for upload?
From trial and error, it looks like whenever you associate a .cga with a shape,
one should add a bit of delay to it, as in (function "framewait" defined in earlier post)
ruleFile = "rules/foo.cga"
ce.setAttribute(zone, "/ce/rule/ruleFile", ruleFile)
framewait(2)