kinggi
23.11.2010, 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 entThanks very much,-Steve