你好,安培,
这会让你开始。。。
(defun C:GetDimLengths ( / AllDimensions CheckDimension n dimlist dimcontent filename fil ) ; Define the command name, localize the variables.(setq AllDimensions (ssget "_X" (list (cons 0 "Dimension")))) ; Sets AllDimensions as a selection set of all Dimensions the the drawing.(setq n 0) ; Set loop counter 0.(setq dimlist '()) ; Set dimensionslist cleared.(repeat (sslength AllDimensions) ; Repeat for all in selectionset AllDimensions (setq CheckDimension (entget (ssname AllDimensions n))) ; Gets the entity (setq dimcontent (cdr (assoc 42 CheckDimension))) ; Reads the measured distance (setq dimlist (cons dimcontent dimlist)) ; Adds this distance to a totallist (setq n (+ 1 n)) ; Up the counter for next dimension) ; End repeat(if (setq filename (getfiled "\nFile Location..." "DimensionExport" "txt" 11)) ; Make a new textfile with default name (progn ; When created do this. (setq fil (open filename "w")) ; Open the new file (foreach x dimlist ; For all dimensions in the totallist (princ (strcat (rtos x 2) "\n") fil) ; Print them in them in the textfile ) ; Close 'foreach' (close fil) ; Close filewriter (startapp "notepad" filename) ; Open created file with notepad (graphscr) ; Return to screen ) ; Close 'do this') ; End if(princ) ; Silent exit) ; End function
-“红色”是如何控制的?ByLayer还是set in the properties?
-需要对列表进行排序吗?