goofygirl72 Posted April 7, 2010 Posted April 7, 2010 I am trying to find away to export all the dimension out of a drawing to files so I can show a total of leghts. Is there away I can do this? Quote
JohnM Posted April 7, 2010 Posted April 7, 2010 The answer is yes, but you need to be a lot more detailed about what you are attempting to do. Only selected dims? All dims? Dims on a certain layer? What type of file to export to? Do you know how to code in lisp? Do you want someone to write this for you? Quote
fuccaro Posted April 7, 2010 Posted April 7, 2010 Welcome in the forum Gufygirl72! Click these links, maybe you can get some help from... http://www.cadtutor.net/forum/showthread.php?t=23285 http://www.cadtutor.net/forum/showthread.php?t=767 Quote
goofygirl72 Posted April 7, 2010 Author Posted April 7, 2010 Johnm I need dims on a certain layer. export to cvs or excel have worked with lisp but not that good. thank you for your reply Quote
goofygirl72 Posted April 7, 2010 Author Posted April 7, 2010 fuccaro I tried your dex lisp and I get ; error: bad argument type: streamp nil I am not the good at lisp to know what causing this. Quote
JohnM Posted April 7, 2010 Posted April 7, 2010 Now is a good time to learn more. Crank up your lisp editor and dive in. I will not write it for you but will help. Here is an outline of some of the functions that you will need (ssget "_X" '((0 . "DIMENSION")(8 . "the layer you need")(410 . "Model")))with a filter for dimensions and the layer (sslength) (ssname) (while) (strcat) (open) (write-line) (close) basically you need to: get only dimensions on a particular layer using ssget get the number of items in the ssget selection set using sslength set up a while loop to go through the items and parse out the dimension text create a list of the dim text and add a (,) between them to create a csv style when the loop is finished open a file to write the list to write the list to the file close the file. If you decide to do this your self this would be a good lips to learn from Quote
Lee Mac Posted April 7, 2010 Posted April 7, 2010 Quick one, (defun c:DimExport (/ i ss file e) (if (and (setq i -1 ss (ssget '((0 . "DIMENSION")))) (setq file (getfiled "Output" "" "txt;csv" 1))) (progn (setq file (open file "w")) (while (setq e (ssname ss (setq i (1+ i)))) (write-line (rtos (cdr (assoc 42 (entget e)))) file)) (close file))) (princ)) Bear in mind Angular Dims will export in Radians Sincere Apologies John - I didn't realise you had posted. Quote
JohnM Posted April 7, 2010 Posted April 7, 2010 No problem lee mac I just like to see more people learn to fish for themselves. I also have a hard time passing up a quicky Quote
fuccaro Posted April 8, 2010 Posted April 8, 2010 fuccaroI tried your dex lisp and I get ; error: bad argument type: streamp nil I am not the good at lisp to know what causing this. After years I tried it again and it worked in AutoCAD 2006. You entered in the program text the path to the file, didn't you? Nevermind, I see in the mean time you get help. Quote
mdbdesign Posted April 8, 2010 Posted April 8, 2010 Perfect, how about preserve dimension style i.e.: architectural (1'-7"), fraction (7 1/4) in exported file? Quote
Lee Mac Posted April 8, 2010 Posted April 8, 2010 Give this a try: (defun c:DimExport (/ i ss file e d) ;; Lee Mac ~ 08.04.10 (if (and (setq i -1 ss (ssget '((0 . "DIMENSION")))) (setq file (getfiled "Output" "" "txt;csv" 1))) (progn (setq file (open file "w")) (while (setq e (ssname ss (setq i (1+ i)))) (setq d (cdr (assoc 42 (entget e)))) (write-line (if (or (= 2 (logand 2 (cdr (assoc 70 (entget e))))) (= 5 (logand 5 (cdr (assoc 70 (entget e)))))) (angtos d (getvar 'DIMAUNIT) (if (minusp (getvar 'DIMADEC)) (getvar 'DIMDEC) (getvar 'DIMADEC))) (rtos d (getvar 'DIMLUNIT) (getvar 'DIMDEC))) file)) (close file))) (princ)) 1 Quote
mdbdesign Posted April 8, 2010 Posted April 8, 2010 No more question. Working perfect and no dialog box req'd :-) Thank you. Quote
goofygirl72 Posted April 8, 2010 Author Posted April 8, 2010 Thank you all so much this will help and will save so much time listing over 5000 dimensions. Thank you again Goofygirl72 Quote
icalara1921 Posted October 27, 2022 Posted October 27, 2022 On 4/8/2010 at 7:02 AM, Lee Mac said: Give this a try: (defun c:DimExport (/ i ss file e d) ;; Lee Mac ~ 08.04.10 (if (and (setq i -1 ss (ssget '((0 . "DIMENSION")))) (setq file (getfiled "Output" "" "txt;csv" 1))) (progn (setq file (open file "w")) (while (setq e (ssname ss (setq i (1+ i)))) (setq d (cdr (assoc 42 (entget e)))) (write-line (if (or (= 2 (logand 2 (cdr (assoc 70 (entget e))))) (= 5 (logand 5 (cdr (assoc 70 (entget e)))))) (angtos d (getvar 'DIMAUNIT) (if (minusp (getvar 'DIMADEC)) (getvar 'DIMDEC) (getvar 'DIMADEC))) (rtos d (getvar 'DIMLUNIT) (getvar 'DIMDEC))) file)) (close file))) (princ)) Hi Lee Mac, I was looking for a lisp like this. On my job I have to set different suffix/prefix or codes by overriding or addin text into the dimensions. So, I have a couple of questions: 1. Is tehere a way to also obtain the prefix and sufix of the selected dimensions? 2. Is it possible to get the overrided dimensions/text? thanks in advance! Quote
mhupp Posted October 27, 2022 Posted October 27, 2022 (edited) Setup a template drawing and and save dimension styles. You can use his steal function to copy the style into a new drawing with this. (defun C:DStyle () (Steal "C:\\path\\to\\drawing\\that\\has\\dims.dwg" '(( "Dimension Styles" ("Dim Name")))) (princ) ) --edit textoverride isn't part of the dimstyles and would need to be inputted for each dimension. I would also suggest to use a prefix to show that its an overridden dimension. * or [ORD] 8'0" - no idea text is overridden *8-'0" [ORD] 8-'0" * 8-'0" * Edited October 27, 2022 by mhupp 1 Quote
Dadgad Posted October 28, 2022 Posted October 28, 2022 Might SELECTSIMILAR be helpful in searching for overridden text? If I were doing it I would use an ActionMacro, as I am not lisp literate. Quote
BIGAL Posted October 28, 2022 Posted October 28, 2022 (edited) Try this and look at code ( 1. xxx) (entget (car (entsel "\nPick dim"))) You will see the <> in the dxf group (1 . this means use the value based on the dim points, if you fully overide the <> will not be there. You can see that in your dim string for the 3rd example. So pre<> is a prefix <>suf is a suffix. Yes could do a look into the dim text string and work out what type it is. So when you say can you GET what you want, what to do with result make a file, make a table etc ? Edited October 28, 2022 by BIGAL 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.