Search code examples
autocadautolisp

Autocad Autolisp variable Start Z / End Z


What variable will we extract the START Z value from the line.

e.g. getvar "perimeter" - get the length of the selected polyline


Solution

  • You will need to obtain the list of coordinates associated with DXF group 10 from the DXF data for the line.

    You can obtain the DXF data for the line entity using the entget function:

    (defun c:test ( / ent enx )
        (if (setq ent (car (entsel)))
            (setq enx (entget ent))
        )
    )
    

    You can then obtain DXF group 10 using the assoc function:

    (defun c:test ( / ent enx )
        (if (setq ent (car (entsel)))
            (progn
                (setq enx (entget ent))
                (assoc 10 enx)
            )
        )
    )