Controling compression of cel file

Hi,
I have empty cell file.
I would like to create hundreds of cell in a loop.
After creating my cell element, I use AttachedCellLibrary.AddCell function in order to put newly created cell into .cel file.
Everything works fine until now.
My problem is evertime cell created and put into cel file, cell file is compressed for each loop.
In the beginning performance still ok.
but after creating hundreds of cell, compression makes performance slower

Is there any suggestion that I can control compression of cel file?
So that I let compression of cel file after 100 loops instead for each loop.

Kind Regards,
Olcay Ebcin
  • Loop Control

    Unknown said:
    Is there any suggestion that I can control compression of cel file? So that I let compression of cel file after 100 loops instead for each loop.

    I'm guessing at what your code might be, but I'm assuming there's a loop (i.e. For ... Next or Do ... Loop).

    Put a counter in your loop. When the counter reaches 100, call your compress procedure and reset the counter. Like this …

    Const nProcedureTrigger As Integer = 100
    Dim trigger As Integer
    trigger = 0
    ' Start making cells
    Do While makeCell
       ' Make cell
        …
       trigger = trigger + 1
       If nProcedureTrigger = trigger Then
          trigger = 0
          Call DoSomethingOccasionally
       End If
    Loop
    Sub DoSomethingOccasionally ()
       ' Compress or whatever
    End Sub

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Dear Jon,

    I sent you a part of my code below.

    It doesnt ask me to compress or not. How can I control it?

    Regards,

    Olcay Ebcin

       Do While Not rs.EOF

           msl = rs(0)  'mslink

           sgeom = rs(1)  'geometry

           prms = Split(sgeom, ",")

           x = -1

           aa = UBound(prms) + 1

           If aa = 0 Then Exit Sub

           ReDim Po(aa / 3 - 1)

           For i = 0 To aa - 1

               x = x + 1

               Po(x) = Point3dFromXYZ(prms(i), prms(i + 1), prms(i + 2))

               i = i + 2

           Next i

           Set bina = CreateShapeElement1(Nothing, Po, msdFillModeNotFilled)

           Set arr(0) = bina

           Set eleCell = CreateCellElement1(msl, arr, bina.Centroid, False)

           AttachedCellLibrary.AddCell eleCell, CStr(msl), "id " & msl, False  ' ---------> compression occure here.

       rs.MoveNext

       Loop

  • The attached cell library is not open as the active design file, therefore you can't compress it.

    Are you sure that it requires compression?  VBA is good at using lots of memory and failing to free it.  One approach that may work is to explicitly free your eleCell memory after adding to the cell library:

    AttachedCellLibrary.AddCell eleCell, CStr(msl), "id " & msl, False

    Set eleCell = Nothing

    Open Cell Library as Active Design

    An alternative approach would be to open the cell library as the active design file.  Then, add a new model (cell) to the DGN file instead of your current technique.  The result is the same — you populate a cell library with new cells — but because your library is now the active DGN file, you can use the compress command.

     
    Regards, Jon Summers
    LA Solutions

  • I'm sure it compresses attached cel file.

    I debug my code using F8.

    after debugging AttachedCellLibrary.AddCell eleCell, CStr(msl), "id " & msl, False line, compression starts immediately.

    for each loop "File compressed(..\standards\cell\binalar3D.cel)" and "compress in progress" messages appear in status bar. It is getting slower after 1000.

    Maybe issue is about configuration of microstation.

    Regards,

    Olcay

  • Is your question that the cell library is compressed automatically after you call AttachedCellLibrary.AddCell?

     
    Regards, Jon Summers
    LA Solutions

  • This is unexpected behaviour.  Perhaps the alternative I suggested would give you more control of the library.

     
    Regards, Jon Summers
    LA Solutions

  • I think cell compression event occur inside AttachedCellLibrary.AddCell function.