|
Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Previous Document: [21] Sample Lisp Programs: Next Document: [22] Block Attributes See reader questions & answers on this topic! - Help others by sharing your knowledge
;;; CDF - comma delimited string
(defun CDF-POINT (pt)
(strcat (car pt) ", " (cadr pt) ", " (caddr pt)))
;;; SDF - space delimited, may easier be read back in to AutoCAD
(defun SDF-POINT (pt)
(strcat (car pt) " " (cadr pt) " " (caddr pt)))
;;; convert this SDF format back to a point with
(defun STR->POINT (s)
(eval (read (strcat "(" s ")"))))
;;; Write a XYZ file of all selected objects (SDF see below)
(defun C:XYZ (/ ss fname f)
(if (and (setq ss (ssget))
(setq fname (getfiled "Write XYZ to file"
(strcat (getvar "DWGNAME") ".XYZ") "XYZ" 7))
(setq f (open fname "w")))
(foreach ele (sslist ss) ; -> [20.4]
(foreach pt (getpts ele) ; -> [23.1]
(write-line (cdf-point pt) f))))
(if f (close f)))
;;; => <fname>.xyz
;;; 0.45, 12.3, -34.0
For a ASC file (SDF-format) simply change all XYZ to ASC
and cdf-point to sdf-point above.
For the other way 'round, creating PLINES from a ascii x,y file
best convert the file to a script like:
PLINE
300.2,10
350.4,10.4
User Contributions:Top Document: comp.cad.autocad AutoLISP FAQ (part 2/2) - samples, code Previous Document: [21] Sample Lisp Programs: Next Document: [22] Block Attributes Part1 - Part2 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: rurban@xarch.tu-graz.ac.at (Reini Urban)
Last Update March 27 2014 @ 02:11 PM
|

Comment about this article, ask questions, or add new information about this topic: