nhatquyelec Posted March 1, 2012 Share Posted March 1, 2012 hello, everybody i have a following problem : i want to export properties of aligned dimension ( that is "measurement") to excell when i click to choose the aligned dimensions and enter(click), the properties of aligned dimension ( that is "measurement", ex: 45,48,78...) will be exported to excel. Help me and thanks ! (have a attach file(help.docx)) help.docx Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 1, 2012 Share Posted March 1, 2012 Look into the DATAEXTRACTION command. Quote Link to comment Share on other sites More sharing options...
fixo Posted March 1, 2012 Share Posted March 1, 2012 Try this program ;;----------------------------ALDIMTXL.LSP-------------------------------;; ;; fixo (02012 * all rights released ;; 3/1/12 (defun C:ALDIMTXL (/ *error* col data dm elist en fname row sset xlapp xlbook xlbooks xlcells xlsheet xlsheets) (defun *error* (msg) (if (vl-position msg '("console break" "Function cancelled" "quit / exit abort" ) ) (princ "Error!") (princ msg) ) (princ) ) ;;;local defun (defun setcelltext(cells row column value) (vl-catch-all-apply 'vlax-put-property (list cells 'Item row column (vlax-make-variant (vl-princ-to-string value) )) ) ;;; main part (if (setq sset (ssget (list (cons 0 "dimension")))) (progn (while (setq en (ssname sset 0)) (setq elist (entget en)) (if (member "AcDbAlignedDimension" (mapcar 'cdr elist)) (progn (if (eq "" (cdr (assoc 1 elist))) (setq dm (rtos (cdr (assoc 42 elist)) 2 (getvar "dimdec"))) (setq dm (cdr (assoc 1 elist))) ) (setq data (cons dm data)) ) ) (ssdel en sset) ) (alert "Wait...") (setq xlapp (vlax-get-or-create-object "Excel.Application") xlbooks (vlax-get-property xlapp 'Workbooks) xlbook (vlax-invoke-method xlbooks 'Add) xlsheets (vlax-get-property xlbook 'Sheets) xlsheet (vlax-get-property xlsheets 'Item 1) xlcells (vlax-get-property xlsheet 'Cells) ) (vla-put-visible xlapp :vlax-true) (setq row 1) (setq col 1) (foreach dim data (setcelltext xlcells row col dim) (setq row (1+ row) ) ) ) ) (vlax-invoke-method (vlax-get-property xlsheet 'Columns) 'AutoFit) (setq fname (strcat (getvar "dwgprefix")(vl-string-right-trim ".dwg" (getvar "dwgname")) ".xlsx")) (vlax-invoke-method xlbook 'SaveAs fname nil nil nil :vlax-false :vlax-false 1 2 ) (vlax-invoke-method xlbook 'Close) (vlax-invoke-method xlapp 'Quit) (mapcar '(lambda (x) (vl-catch-all-apply '(lambda () (vlax-release-object x) ) ) ) (list xlcells xlsheet xlsheets xlbook xlbooks xlapp) ) (setq xlapp nil) (gc)(gc)(gc) (alert (strcat "File saved as:\n" fname)) (*error* nil) (princ) ) (prompt "\n\t\t---\tStart command with ALDIMTXL\t---\n") (princ) (vl-load-com) (princ) ;;----------------------------code end-------------------------------;; ~'J'~ Quote Link to comment Share on other sites More sharing options...
nhatquyelec Posted March 2, 2012 Author Share Posted March 2, 2012 thanks "lee mac", but "data extraction" isn't available on CAD2007 Quote Link to comment Share on other sites More sharing options...
nhatquyelec Posted March 2, 2012 Author Share Posted March 2, 2012 thanks "fixo" so much ! your lisp is very good ! thanks ! Quote Link to comment Share on other sites More sharing options...
fixo Posted March 2, 2012 Share Posted March 2, 2012 To be honestly this isn't so good Change it to get a robust result ~'J'~ Quote Link to comment Share on other sites More sharing options...
wrha Posted January 13, 2013 Share Posted January 13, 2013 Mr fixoYour lisp very good thank you very much Quote Link to comment Share on other sites More sharing options...
fixo Posted January 13, 2013 Share Posted January 13, 2013 Mr fixoYour lisp very good thank you very much Not so good as you think, keep varnish them to your suit Cheers Quote Link to comment Share on other sites More sharing options...
tuncakca Posted February 1, 2013 Share Posted February 1, 2013 your moduls takes just nominal value can I EXPORT dimensions with tolerances,? example value : 11,20-11.60 nominal dimension (11.40) Thanks I hope explain my problem. Quote Link to comment Share on other sites More sharing options...
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.