Set dimstyle by selecting a dimension

Is there a shortcut to setting the dimstyle by selecting a dimension?

DIMSTYLESET would be my first choice but this does not work. Or is this a bug?.

I need something simple like:

(defun c:DSS ()
(setvar "cmdecho";0)
(command "-dimstyle";"R";;)
(setvar "cmdecho";1)
(princ)
)

(COMMAND "-DIMSTYLE";"R";;) This one does not work completely because the last enter is not accepted and I have to do that manually.

; = enter (space in some cad programs)

Comments

  • I found a lisp that worked and also sets the layer:

    (defun C:SETDIM (/ e)
    (if
    (setq e (ssget ":E:S" '((0 . "DIMENSION"))))
    (progn
    (setq e (entget (ssname e 0)))
    (command "DIMSTYLE" "R" (cdr (assoc 3 e)))
    (setvar "CLAYER" (cdr (assoc 8 e)))
    )
    )
    (princ)
    )

  • The built-in MatchProp command can copy an entity's Dimstyle, and also its layer, color, and other properties. There's a Settings dialog that allows you to choose which properties are to be copied.

  • ALANH
    edited January 16

    Another

    (defun C:SETDIM (/ obj)
    (setq obj (vlax-ename->vla-object (car (entsel "\nPick Dim object "))))
    (command "DIMSTYLE" "R" (vlax-get obj 'StyleName))
    (setvar 'clayer (vlax-get obj 'layer))
    (princ)
    )