Display Z-coordinates automatically

Is it possible to display the Z-coordinate of a block in the model automatically?

 

It would be helpful to have an overview over the differents height in the drawing without clicking on every single block to view the Z-coordinate in the properties. There are too many blocks to write it in a special created block attribute by hand.

 

I use Bricscad V10.

 

Thank you,

A. Günther

Comments

  • Sure it's possible, that what makes Bricscad so cool : )
    You will need to define  "automatically" though. I.e. automatically when I insert a block, type a command, press a button etc.  You will also need to define the output format.

    Here is a lisp that will print the coordinates of every block, at the command line.. load it any type "getbz" at the prompt

     

    (defun c:getbz (/ activedocument c e iacadapplication ls modelspace s item)
     (vl-load-com)
     (setq IAcadApplication (vlax-get-acad-object)
           ActiveDocument (vla-get-ActiveDocument IAcadApplication)
           ModelSpace (vla-get-ModelSpace ActiveDocument)
           ls '()
     )
     (setq s (ssget "X" (list (cons 0 "INSERT"))))
     (setq c 0)
     (if s
      (progn
       (While (< c (sslength s))
        (setq e (vlax-ename->vla-object (cdr (car (entget (ssname s c)))))
              ls (append
                  (list (cons (vlax-get e 'name) (vlax-get e'InsertionPoint)))
                  ls
                 )
              c (1+ c)
        )
       )
       (setq ls (vl-sort ls
           (function (lambda (item1 item2)
               (< (car item1) (car item2))))))
        (foreach item ls
         (princ item)
         (princ "\n")
        )
       )
      (alert (strcat "Could Not find any blocks"))
     )
     (princ)
    )
  • Thank you very much for the code. It works and shows the coordinates in the command line, like you already mentioned. That's a very helpful code. I am sure that I will need it some time.

     

    But I would like to display the height of the blocks that are already inserted in the drawing, so that I can finally print it (as a layout). Is this also possible with lisp?

  • What do you mean by height, are you scaling the blocks non-uniformly ?

    Daniel

  • Anne,

    Not sure I follow you, but if you need to display Z coordinate, we have a tool in KitoxToolset named SmartElevation, also SmartLevel for Y and SmartCoord for X/Y coordinates.  Blocks are reactor based and updates automatically after position changes.

    Vaidas

  • Daniel, I thought of the Z-coordinate, when I wrote height. I have a drawing of a land parcel and I want to show the Z-coordinate of the blocks, e.g. the block of a duct cover, I inserted.

     

    Vaidas, great tool. That's nearly what I thought of. It writes the height in the drawing, when I click on the block. But I have serveral hundreds of blocks. I'll think of the tool again, if I don't find an automatic solution.

  • Anne,

    Many thanks for your opinion!

    My question is about 'hundreds of blocks'. Is it single named block inserted in your drawing? If yes, I can write custom code for you to insert SmartElevation block into the same insert-point of your block.

    But let's think about more usefull thing... It's possible to redefine your blocks as SmartElevation blocks and display Z coordinates automatically. What do you think about it?

    Vaidas

  • Thank you for your help.

     

    I think, that I will buy your tool, Vaidas.

     

    Nevertheless, I found another piece of code that might be helpful. Unfortunately it doesn't work with Bricscad yet. If you are interested: http://www.cad-huebner.de/download/Z2TXT.LSP.

  • Bricscad does not seem to like the mtext insertion in the code from www.cad-huebner.de.  Try changing 

        (COMMAND "_MTEXT"
    (LIST (+ (* 0.75 (GETVAR "TEXTSIZE")) (NTH 0 epkt))
    (+ (* 0.75 (GETVAR "TEXTSIZE")) (NTH 1 epkt))
    0.0
    ) ;_ Ende von LIST
    "_justif"
    "_ML" ; Positionierung Mitte zentriert
    "_WID"
    10.0 ; konstante Textfeldbreite - ist einfacher zu picken
    z
    ""
    ) ;_ Ende von COMMAND

    to

        (COMMAND "_TEXT"
    "j"
    "ML"
    (LIST (+ (* 0.75 (GETVAR "TEXTSIZE")) (NTH 0 epkt))
    (+ (* 0.75 (GETVAR "TEXTSIZE")) (NTH 1 epkt))
    0.0
    )
    (getvar "textsize")
    0.0
    z
    ) ;_ Ende von COMMAND
This discussion has been closed.