﻿ ZWCAD Tip: X and Y Ordinate Dimension in a Single Step - ZWCAD Technical Support | CAD Free Support - ZWSOFT.com

ZWCAD Tip: X and Y Ordinate Dimension in a Single Step

January 27, 2010

Q: Ordinate dimensions are essential elements of geographic drawings. Ordinate dimensions enable you to indicate positional information of objects and geometry. For my work, I almost always need to place x and y ordinates at the same time. Is this possible?

A: Fortunately, ZWCAD makes it possible to create new commands through the use of the LISP application interface. With the help of the following LISP routine, it is possible to place x and y ordinate dimensions in a single step.

;;(User-defined variable names are boldfaced.)
(defun c:OXY()
(setq pt (getpoint "Input point: "))
(setq zg 5); text height is 5)
(setq x (car pt))
(setq y (cadr pt))
(setq xzb (strcat "X="(rtos x 2 2)))
(setq yzb (strcat "Y="(rtos y 2 2)))
(setq num (strlen xzb))
;;(command "text" (list (+ x 2) (+ y 2)) zg "" xzb "")
(command "text" (list (+ x 2) (+ y 2)) zg "" xzb)
(command "pline" (list (+ x 2) y) (list (+ x 2 (* (* zg 0.85) num)) y) "")
;;(command "text" (list (+ x 2) (- y 5.5)) zg "" yzb "")
(command "text" (list (+ x 2) (- y 5.5)) zg "" yzb)
(princ)
)

To use this code, follow these steps:
1. Copy and paste the above code to a Notepad file.
2. Save the file as OXY.LSP. (Be sure to modify the txt extension to lsp.)
3. Load the LISP program into ZWCAD using the AppLoad command.
4. Enter OXY to execute the function, like this:
Command: oxy
5. At the prompt, pick a point in the drawing.
Input point: (Pick  a point.)

This routine uses a fixed text height of 5 units. If this height is too tall or too short, modify the number in the  code, and then reload the routine into ZWCAD:
(setq zg 5); Change text height from 5

I hope that many AEC designers find this function useful, especially in the surveying and mapping Industry.

Print PDF