vla-put-StyleName with dimension

VILACAD
edited December 10 in LISP

Hello everyone
I have several dimensions in a drawing, and I want to change the dimension style of all selected dimensions. In Autocad I have this code that works fine:

(SETQ SEL (SSGET "X" (LIST (CONS 0 "DIMENSION"))))
(IF SEL
(PROGN
(SETQ CONT 0)
(REPEAT (SSLENGTH SEL)
(vla-put-StyleName (vlax-ename->vla-object (SSNAME SEL CONT))) "style1")
(SETQ CONT (+ 1 CONT)))
) ;REPEAT
) ;PROGN
) ;IF

But in Bricscad it does nothing. What am I missing?
Thanks

And, if I add:
(vla-Update (vlax-ename->vla-object (SSNAME SEL CONT)))

nothing happens

Comments

  • Maybe try

    (vla-put-StyleName (vlax-ename->vla-object (SSNAME SEL CONT))) "style1")

    (vlax-put (vlax-ename->vla-object (SSNAME SEL CONT)) 'Stylename "style1")

  • thanks Alanh.

    in fact, it appears as if the dimension style has been changed, but the text does not appear above the dimension line, as defined in the style. If I change the style manually, it does update.
    Any suggestions?

  • Hello.

    It seems that there is a typo, either here or in the main code.

    The call of (vla-put-stylename) should be:
    (vla-put-stylename (vlax-ename->vla-object (ssname sel cont)) "style1")

    Before "style1" there should be only 2 closing parentheses.

    This version worked fine in my testing.

  • (vla-put-stylename (vlax-ename->vla-object (ssname sel cont)) "style1") ⇒

    I have tested it on my bricscad 23.2.03 and it really doesn't do it as expected.

    before:

    after:

    and the text is not above the line…as defined in the dimension style

    Thanks Virgil and Alanh. I continue to search for the error

  • Hello.

    I am not sure about it, but the case might require clearing some existing dimension overrides.

    So, after updating the dimension style, this is something you could experiment with:
    (command "_dimoverride" "_c" sel "")

  • thanks i'll try