Design Review
Welcome to Autodesk’s Design Review Forums. Share your knowledge, ask questions, and explore popular Design Review topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Iterating DWF Objects Increases Memory usage

0 REPLIES 0
Reply
Message 1 of 1
mauroanzola
501 Views, 0 Replies

Iterating DWF Objects Increases Memory usage

I call every 1 second this Subroutine.

The application is working well but everytime I call the Sub the memory usage in task manager increase, What can I do for resetting memory usage everytime I call the Subroutine?

 

Private Sub Aggiorna_Stato()
Dim CompositeViewer As AdCommon.IAdECompositeViewer3 
Dim Section As ECompositeViewer.IAdSection
Dim MyObjects As AdCommon.IAdCollection, MyObjectProperties As AdCommon.IAdCollection
Dim MyObjectsNamedCollection As AdCommon.IAdUserCollection
Dim MyObjectsNamedCollection1 As AdCommon.IAdUserCollection
Dim ObjectContent As ECompositeViewer.IAdContent
Dim MyObject As ECompositeViewer.IAdObject
Dim MyObjectProperty As AdCommon.IAdProperty
Dim ObjectName As String, Stato As String, Ugo As Integer, Idx As Integer
Dim Commands As AdCommon.IAdCollection
Dim Command As ECompositeViewer.IAdCommand
Dim iIndex As Integer
Dim ObjType As String, ObjDeck As Integer, ObjName As String, ObjState As String, FldLiv As Integer
Dim Transp As Boolean
Dim SectionType As ECompositeViewer.IAdSectionType
Dim nRed As Integer, nGreen As Integer, nBlue As Integer

Idx = 1

Set CompositeViewer = CExpressViewerControl1.ECompositeViewer
Set Commands = CompositeViewer.Commands
Set Section = CompositeViewer.Section
Set SectionType = Section.SectionType
Set ObjectContent = Section.Content
Set MyObjectsNamedCollection = ObjectContent.CreateUserCollection
Set MyObjectsNamedCollection1 = ObjectContent.CreateUserCollection
Set MyObjects = ObjectContent.Objects(0) '0 is to return all objects
ObjectContent.Objects(1) = MyObjectsNamedCollection
FSHigh = Not FSHigh
For Each MyObject In MyObjects
    Set MyObjectProperties = MyObject.Properties
    For Each MyObjectProperty In MyObjectProperties
       If InStr(LCase(MyObjectProperty.Value), BloN) <> 0 Then
        If InStr(MyObjectProperty.Value, "3D") <> 0 Then
          ObjName = Mid(MyObjectProperty.Value, InStr(MyObjectProperty.Value, "3D") + 10)
          ObjType = Mid(MyObjectProperty.Value, InStr(MyObjectProperty.Value, "3D"), 4)
          ObjDeck = Val(Mid(MyObjectProperty.Value, InStr(MyObjectProperty.Value, "3D") + 7, 2))
          ObjState = Mid(MyObjectProperty.Value, InStr(MyObjectProperty.Value, "3D") + 5, 1)
          Select Case ObjType
          Case "3DSC" 'Scafo
           .
           .
           .
           .
          Case Else
          End Select
          ObjectName = MyObjectProperty.Name + " " + Str(Idx)
          Idx = Idx + 1
          MyObjectsNamedCollection.AddNamedItem MyObject, ObjectName
          If Transp = True Then
            MyObjectsNamedCollection1.AddNamedItem MyObject, ObjectName
         End If
        End If
      End If
Salta:    Next
Next
Set Commands = CompositeViewer.Commands
Commands.Item("ISOLATE").Enabled = True
Commands.Item("TRANSPARENT").Enabled = True
Commands("CANVASTOOLBAR").Toggled = False
Commands.Item("RIBBONBAR").Toggled = False
CompositeViewer.Section.SectionType.LightingOption = "Daylight"
CompositeViewer.Section.SectionType.ShowViewCompassEnabled = False
CompositeViewer.ObjectSelectionHighlightingEnabled = False
CExpressViewerControl1.AutoOpenPalettesDisabled = 1
CExpressViewerControl1.CanvasToolbarEnabled = False
ObjectContent.Objects(1) = MyObjectsNamedCollection
CompositeViewer.ObjectSelectionHighlightingEnabled = False
CompositeViewer.ObjectHighlightingEnabled = False
SectionType.ModelEdgeColorAsPublished = False
nBlue = 110
nGreen = 110
nRed = 30
SectionType.ModelEdgeColor = nBlue * 65536 + nGreen * 256 + nRed
SectionType.DisplayMode = 2
Me.CExpressViewerControl1.Visible = False
CompositeViewer.ExecuteCommand ("SHOWALL")
CompositeViewer.ExecuteCommand ("ISOLATE") 'Isolates the selected object
ObjectContent.Objects(1) = MyObjectsNamedCollection1
CompositeViewer.ExecuteCommand ("TRANSPARENT")
Me.CExpressViewerControl1.Visible = True
MyObjectsNamedCollection.Flush
ObjectContent.Objects(1) = MyObjectsNamedCollection
End Sub

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report