Indeed this could be a reason, the memory usage gradually increases with every new model that I generate, reaching from 450MB to ~800MB before crashing (however this is not critical for the system, I have 128GB available).
What is the best way to do a "wipe out" of all elements in memory, after I delete them from the preprocess document? If not a single command exists for this, could start a new project each time do the trick (
App.runCommand('NewPreDocument'))? If yes, could you maybe let me know how I can "Save as" a project so that I don't have to interact with the popup window?
Btw, this is how I delete the geometry each time.
Code: Select all
def clear_model():
"""
Define geometry deletion.
"""
doc_pre.scene.unselectAll()
# existing_beam_geom = doc_pre.getGeometry(doc_pre.geometries.getlastkey(0))
existing_beam_geom = doc_pre.geometries.getlastkey(0)
existing_physical_props = doc_pre.physicalProperties.getlastkey(0)
existing_element_props = doc_pre.elementProperties.getlastkey(0)
existing_conditions = doc_pre.conditions.getlastkey(0)
existing_analyses_steps = doc_pre.analysisSteps.getlastkey(0)
if existing_beam_geom is not None:
for existing_beam_geom_id in range(existing_beam_geom):
existing_beam_geom_selected = doc_pre.getGeometry(doc_pre.geometries.getlastkey(0))
shape = existing_beam_geom_selected.shape
for edge_id in range(shape.getNumberOfSubshapes(MpcSubshapeType.Edge)):
doc_pre.scene.select(existing_beam_geom_selected, edge_id, MpcSubshapeType.Edge)
App.runCommand("DeleteGeometry")
if existing_physical_props is not None:
for physical_prop_id in range(existing_physical_props):
physical_prop = str(doc_pre.physicalProperties.getlastkey(0))
App.runCommand("DeletePhysicalProperty", physical_prop)
if existing_element_props is not None:
for element_prop_id in range(existing_element_props):
element_prop = str(doc_pre.elementProperties.getlastkey(0))
App.runCommand("DeleteElementProperty", element_prop)
if existing_conditions is not None:
for condition_id in range(existing_conditions):
condition = str(doc_pre.conditions.getlastkey(0))
App.runCommand("DeleteCondition", condition)
if existing_analyses_steps is not None:
for analyses_step_id in range(existing_analyses_steps):
analysis_step = str(doc_pre.analysisSteps.getlastkey(0))
App.runCommand("DeleteAnalysisStep", analysis_step)
doc_pre.commitChanges()
doc_pre.dirty = True
App.runCommand("Regenerate")
App.processEvents()
Also, this is the Error details that I get from the Windows Event Viewer:
Faulting application name: STKO.exe, version: 0.0.0.0, time stamp: 0x641976ba
Faulting module name: Qt5Core.dll, version: 5.13.2.0, time stamp: 0x5db2b3bb
Exception code: 0xc0000409
Fault offset: 0x0000000000022d28
Faulting process id: 0x2398
Faulting application start time: 0x01d9ba13ca64b80e
Faulting application path: C:\Program Files\STKO\STKO.exe
Faulting module path: C:\Program Files\STKO\Qt5Core.dll
Report Id: 360123b1-3b29-4741-90fe-c3bf43804e92
Faulting package full name:
Faulting package-relative application ID:
- <Event xmlns="
http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Application Error" />
<EventID Qualifiers="0">1000</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>100</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2023-07-19T08:32:00.8029283Z" />
<EventRecordID>38537</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>TUD1005139.tudelft.net</Computer>
<Security />
</System>
- <EventData>
<Data>STKO.exe</Data>
<Data>0.0.0.0</Data>
<Data>641976ba</Data>
<Data>Qt5Core.dll</Data>
<Data>5.13.2.0</Data>
<Data>5db2b3bb</Data>
<Data>c0000409</Data>
<Data>0000000000022d28</Data>
<Data>2398</Data>
<Data>01d9ba13ca64b80e</Data>
<Data>C:\Program Files\STKO\STKO.exe</Data>
<Data>C:\Program Files\STKO\Qt5Core.dll</Data>
<Data>360123b1-3b29-4741-90fe-c3bf43804e92</Data>
<Data />
<Data />
</EventData>
</Event>