Print Page | Close Window

Problem updating dynamic block user parameters

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=4825
Printed Date: 13.Jun.2026 at 04:35


Topic: Problem updating dynamic block user parameters
Posted By: kinggi
Subject: Problem updating dynamic block user parameters
Date Posted: 23.Nov.2010 at 13:03
Hello,

I have some VBA code that updates specific parameters within a dynamic block (this occurs while the drawing file is open in autocad).

The code appears to run successfully and when looking in debug mode the new value of the parameter is successfully assigned and remains assigned, however in the autocad gui the drawing does not update, and even when going into the block editor the new values do not get shown. However, when performing various tasks and navingating through the gui it does at some point force a refresh and the drawing then reflects the changes.

I have tried adding block.update calls and thisdrawing.regen calls but there was no difference observed. There must be something I'm missing. Can someone help me out?

The guts of the code is:

    For Each ent In ThisDrawing.ModelSpace
    If ent.ObjectName = "AcDbBlockReference" Then
    Set oBkRef = ent
    If oBkRef.IsDynamicBlock = True Then 'Check if it is a dynamic block
    v = oBkRef.GetDynamicBlockProperties 'Get all Dynamic attributes
    If oBkRef.EffectiveName = Blockname Then
    For I = LBound(v) To UBound(v)
    Set oDynProp = v(I)
    If Not IsArray(oDynProp.Value) Then 'Not an array
    If oDynProp.PropertyName = Parametername Then
     Str (oDynProp.Value)
    oDynProp.Value = Newvalue 'Set the new value
     End If
    End If
    Next
    End If
    End If
    End If
    Next ent

Thanks very much,
-Steve



Print Page | Close Window