Manipulating dynamic block properties via VBA - not updating correctly

Hello,

I'm in the process of trying to convert some VBA code (in MS Access) written for AutoCAD to test with BricsCAD and I'm having trouble with dynamic blocks. I have successfully inserted the block in an open drawing, updated various attribute values and am now changing some of the dynamic properties.  As I step through the code I can see that the dynamic property values are being modified correctly, but the graphic image on the screen in the drawing does not update accordingly.  Specifically, I am modifying a flip state, a visibility state (via a block table) and a distance.  I have tried a regen and it has no effect. 

Here’s a snippet of the code:

'-----------------------------------------------------------------------------------

      'set the dynamic block properties

    If BlockRef.IsDynamicBlock Then

        dybprop = BlockRef.GetDynamicBlockProperties

        For b = LBound(dybprop) To UBound(dybprop)

            If dybprop(b).PropertyName Like "Block Table*" Then     'ex: Block Table1 - ConnectorConfiguration

                dybprop(b).Value = intBLKTBL                        'New/Existing & Broken/Solid

            ElseIf dybprop(b).PropertyName = "Flip state1" Then

                dybprop(b).Value = intFLIP                          'Flipped/Not Flipped

            ElseIf dybprop(b).PropertyName = "Distance1" Then

                dybprop(b).Value = (Me.frmInsert_InlineConnectors_sub1.Form.txtCountSelections * 0.25)  'set height based on number of pins selected

            End If

        Next b

    End If

'-----------------------------------------------------------------------------------  

Any ideas would be greatly appreciated.

Kind Regards,

Lorna

Comments

  • Try using a variant instead of an integer for the flip state:
    [code]Sub Test()
      Dim blk As AcadEntity
      Dim flp As Variant
      flp = 1
      ThisDrawing.Utility.GetEntity blk, pt, "Select a block:"
      dyn = blk.GetDynamicBlockProperties
      For i = LBound(dyn) To UBound(dyn)
        If dyn(i).PropertyName Like "*Flip*" Then
          dyn(i).Value = flp
        End If
      Next i
    End Sub[/code]
  • ... Oops.
    The type of flp does not seem to be the issue. The test code also works if flp is an integer.
    When I run the code inside BricsCAD V14 the block is updated immediately.
    I don't have MS Access, but if I run similar code from an HTA application I again see an immediate update.
  • Sorry, I should let you know, I'm using BricsCAD version 16.2 and MS Access 2010.
  • FWIW: For my second test I have used BricsCAD V16.2 (64 bit) and an HTA application that uses VBScript functions to access the BricsCAD COM-interface. VBScript has a syntax that is similar to VBA.
    Are you sure you are actually changing the dynamic properies? If you save and reopen the dwg do the changes display correctly? Have you tested your code with simpler dynamic blocks?
  • Lorna, have you found a solution to this problem?
  • Hi Roy,

    Not yet.  I'm also getting inconsistent results just by inserting the dynamic block into the drawing and changing the settings via the drawing window (ie. not via code).  I'm wondering if my dynamic blocks are too complex for BricsCAD?  Besides Flip, I have Move, Stretch, Visibility and a Block Table to manage multiple actions.  Come to think of it, I do not see the Block Table grip on the screen - I have been changing the Block table setting from the Properties window.  I do see the Flip and Stretch grips (see attachment).

    Another thought I had was software versions.  The dynamic blocks were created in AutoCAD 2010 and I'm using BricsCAD v16.2.

    Still testing....

    Thanks,

    Lorna

    imageIn-Line.JPG
  • Hi Lorna,

    There are certainly types of dynamic blocks that BricsCAD will not be able to work with. Generally this relates to dynamic blocks that use the newer geometric constraint type options. If your applying annotative scaling to dynamic blocks you may also strike issues.

    It looks like you've already done this, but I would check that you can manually manipulate your dynamic block via the on-screen glyphs & property bar. If these work then it points to a code issue, which may require an SR to get resolved.

    You may also like to know that you can mimic some dynamic block functions in BricsCAD Platinum by applying 2D geometric constraints to your objects, then use BMINSERT to insert. You will see the blocks parameters listed in the property bar. You can also use BIM tools to manipulate such as BIMFLIP.

    Regards,
    Jason Bourhill

This discussion has been closed.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!