Dimension Text View Direction VLA-GET/PUT-DIMTXTDIRECTION

I'm looking to perform (vlax-put obj 'dimtxtdirection (~ (vlax-get obj 'dimtxtdirection))) to switch the Text View direction property of a Dimension object, but the DIMTXTDIRECTION property seems unavailable in Bricscad V21.02.6...

I think i can work around this working with entmod and dxf groups but i am unsure how.

I know and tested that modifying this property affects the -3 group which contains all the dim overrides :

Initial dimension (no dimtxtdirection override, value = "Left to right") : (-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 345) (1005 . "0") (1002 . "}")))
Switched to value = "Right to Left" : (-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 294) (1070 . 1) (1070 . 345) (1005 . "0") (1002 . "}")))
Switched back to "Left to right" : (-3 ("ACAD" (1000 . "DSTYLE") (1002 . "{") (1070 . 294) (1070 . 0) (1070 . 345) (1005 . "0") (1002 . "}")))

It must be related to the 1070 group... any idea how to entmod this back and forth?

Thanks.

Comments

  • I was partially wrong. I've understood the -3 group a little better with Lee-Mac's #11 post.
    (1070 . 294) (1070 . 1) and (1070 . 294) (1070 . 0) are the override.
    1070 group indicates an integer, 294 is the dxf group for DIMTXTDIRECTION, and 0 or 1 is the value.

    I must now proceed to query the current value and switch this back and forth using entmod.

  • 1LandSurveyor
    edited October 2021

    So i came up with this which works great :smile:

    (defun c:Flip ( / ss ent i eLst cXdata cDirXPosition cDirection newXdataPre cXdataEnd cXdataEndTrimmed newXdata)
        (setq ss (ssget ":S:L" (list (cons 0 "DIMENSION"))))
        (repeat (setq i (sslength ss))
                (setq ent (ssname ss (setq i (1- i))))
                (setq eLst (entget ent '("ACAD")))
                (if (setq cXdata (cadr (assoc -3 eLst))) ; 
                    (progn
                    (if (setq cDirXPosition (vl-position (cons 1070 294) cXdata))
                            (setq cDirection (cdr (nth (1+ cDirXPosition) cXdata))))
    
                    (cond   ((= cDirection 1) (progn
                                                    (setq newXdataPre (reverse (member (cons 1070 294) (reverse cXdata))))
                                                    (setq cXdataEnd (member (cons 1070 294) cXdata))
                                                    (setq cXdataEndTrimmed (Flip:remove_nth (Flip:remove_nth cXdataEnd 0) 0))
                                                    (setq newXdata (append newXdataPre (list (cons 1070 0)) cXdataEndTrimmed))
                                                ))
                            ((= cDirection 0) (progn
                                                    (setq newXdataPre (reverse (member (cons 1070 294) (reverse cXdata))))
                                                    (setq cXdataEnd (member (cons 1070 294) cXdata))
                                                    (setq cXdataEndTrimmed (Flip:remove_nth (Flip:remove_nth cXdataEnd 0) 0))
                                                    (setq newXdata (append newXdataPre (list (cons 1070 1)) cXdataEndTrimmed))
                                                ))
                            (T (progn
                                                    (setq newXdataPre (reverse (member (cons 1002 "{") (reverse cXdata))))
                                                    (setq cXdataEnd (member (cons 1002 "{") cXdata))
                                                    (setq cXdataEndTrimmed (Flip:remove_nth cXdataEnd 0))
                                                    (setq newXdata (append newXdataPre (list (cons 1070 294) (cons 1070 1)) cXdataEndTrimmed))
                                                ))  
                        )
                        (entmod (subst (cons -3 (list newXdata)) (cons -3 (list cXdata)) eLst))
                    )
                    (progn
                    (setq newXdata (list "ACAD" '(1000 . "DSTYLE") '(1002 . "{") '(1070 . 294) '(1070 . 1) '(1002 . "}")))
                    (entmod (append eLst (cons -3 (list newXdata))))
                    )
                )
        ) ;repeat
    )
    
    (defun Flip:remove_nth ( lst n / lstn )
       (setq n (1+ n))
       (foreach x lst (if (/= 0 (setq n (1- n))) (setq lstn (cons x lstn))))
       (reverse lstn)
    )
    
  • Roy Klein Gebbinck
    edited October 2021

    Deleted. The OP changed the question.

  • Indeed, that DIMTXTDIRECTION is actually not implemented in our Teigha COM system :-(
    Best if you file a support request, so that we can implement this property.
    many greetings !