Author Topic: Assoc dims in a dyn block not changing when updated via LISP  (Read 782 times)

0 Members and 1 Guest are viewing this topic.

cadpoobah

  • Newt
  • Posts: 49
Assoc dims in a dyn block not changing when updated via LISP
« on: February 21, 2022, 11:00:34 AM »
Guys,

I am inserting a dynamic block with lisp and using code to push dynamic properties to it. The geometry in the block updates fine, but the associated dimensions (associated with the geometry that was updated) don't update.  :thinking:

If, however, I click one of the grips afterward, the block "refreshes" and the dims update correctly.

Is there a way to force this type of refresh programmatically?

Thanks!
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com #dayjob
www.unpavedart.com    #sidehustle

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Assoc dims in a dyn block not changing when updated via LISP
« Reply #1 on: February 22, 2022, 08:25:43 AM »
Try vla-update or moving it 0,0,0 to 0,0,0.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

cadpoobah

  • Newt
  • Posts: 49
Re: Assoc dims in a dyn block not changing when updated via LISP
« Reply #2 on: February 22, 2022, 11:45:01 AM »
Thanks, @alanjt!

I tried those w/o any luck.
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com #dayjob
www.unpavedart.com    #sidehustle

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Assoc dims in a dyn block not changing when updated via LISP
« Reply #3 on: February 22, 2022, 04:33:24 PM »
vla-update on the nested dimension objects? /guess

cadpoobah

  • Newt
  • Posts: 49
Re: Assoc dims in a dyn block not changing when updated via LISP
« Reply #4 on: February 22, 2022, 06:06:09 PM »
Thanks, Lee. I'll give it a try.

I found this code and modified it to simply perform a vla-update on all dimensions in the selected blocks. The original appears to run properly, but the dimensions do not update.

Code: [Select]
;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/color-of-dimensions-in-a-block-need-modification-in-lisp-code/td-p/8322296
;;
(defun c:RefreshBLkDim (/ *error* col ss i) ; modified from c:ColorDimInBlock
  (vl-load-com)
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *acdoc* (setq *acdoc* (vla-get-ActiveDocument *acad*)))
  (or *blocks* (setq *blocks* (vla-get-Blocks *acdoc*)))

  (defun *error* (msg)
    (and msg
         (/= (strcase msg) "FUNCTION CANCELLED")
         (princ (strcat "\nError: " msg))
    )
    (vla-EndUndoMark *acdoc*)
    (princ)
  )

  (if
    (and
      ;(setq col (acad_colordlg 256))
      (ssget '((0 . "INSERT")))
    )
     (progn
       (vlax-for br (setq ss (vla-get-ActiveSelectionSet *acdoc*))
         (or (member (vla-get-Name br) lst)
             (setq lst (cons (vla-get-Name br) lst))
         )
       )
       (vla-Delete ss)
       (foreach n lst
         (vlax-for obj (vla-Item *blocks* n)
           (if (member (vla-get-ObjectName obj) '("AcDbAlignedDimension" "AcDbRotatedDimension"))
     (vla-update obj)
             ;(vla-put-Color obj col)
           )
         )
       )
       (vla-regen *acdoc* acAllViewports)
     )
  )
  (*error* nil)
)


Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com #dayjob
www.unpavedart.com    #sidehustle