whoolieshop Posted November 15, 2018 Posted November 15, 2018 (edited) Good Evening! I have a lisp script that exports dimension values to a csv file. I have modified it to only export selected dimensions which is exactly what I want. However; I would also like to export any prefix the dimension has and include it with the exported dimension: EG: a dimension of 36" that has a prefix of R should be something like R - 36, a dimension with no prefix would just be 36 Attached is my current lisp script: ; Save the Dimension's values to a CSV file ; mfuccaro@hotmail.com ; 2008 May ; Enhancements by CAD Studio, 2012 ; Modified by WhoolieShop to include prefix's and only work on current selection. ; (setq _dimexpdelimiter ",") ; set to ";" for CSY/DEU... (defun C:DimExp ( / s tx fn i d dl m file) (setq s (ssget (list '(0 . "DIMENSION"))) tx nil fn (strcat (getvar "dwgprefix") "DimExp.csv")) (repeat (setq i (sslength s)) (setq d (ssname s (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) (if (not (member m tx)) (setq tx (cons m tx))) ) (setq s nil) (if tx (progn (setq file (open fn "a")) ; append (write-line "" file) (princ (strcat (getvar "dwgname") _dimexpdelimiter) file) (foreach x tx (princ x file) (princ _dimexpdelimiter file) ) (if file (close file)) (princ (strcat "\n" (itoa (length tx)) " dimensions written to " fn)) )) (princ) ) Thanks in advance! Edited November 15, 2018 by whoolieshop more info added. Quote
whoolieshop Posted November 16, 2018 Author Posted November 16, 2018 Okay about 3 hours of tinkering have gone by and if i change 42 to 1 I can get any overridden text pulled out, and if I change it to 3, i can get the dimension style names which could totally work. How would I go about editing this code around the line with 42 to include, Option 42 AND option 3? (dimension style names) Note I also need duplicates exported, NOT grouped together if there are 40 dimensions exported and 20 are the exact same I need 40 values exported to the csv. (setq d (ssname s (setq i (1- i))) dl (entget d) m (cdr (assoc 42 dl))) Quote
BIGAL Posted November 16, 2018 Posted November 16, 2018 Have you looked at using vlisp (setq obj (vlax-ename->vla-object (ssname s (setq i (1- i))))) (setq txt (vla-get-TextOverride obj)) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.