alanjt Posted November 27, 2009 Posted November 27, 2009 I agree that no-one would really set it to 1, but I have seen examples in the past where Fixo sets Sys Vars differently... Then I retract my statement. Quote
stevesfr Posted November 27, 2009 Posted November 27, 2009 Oh really, now I have to remember where all those drawings are saved I tried it on hehe And actually I'd really like to know how to get "Command:" back? I had to quit Acad and fire it up again to get "Command:" back. Quote
alanjt Posted November 27, 2009 Posted November 27, 2009 I had to quit Acad and fire it up again to get "Command:" back. Just type nomutt 1. You can't see it, but it will fix it. Quote
cadman2009 Posted November 27, 2009 Author Posted November 27, 2009 Here is another one too big but with flowers ~'J'~ Dear fixo Hi when I use your code , after picking on a pline the below massage occurs : Command: _appload PlineImport.LSP successfully loaded. Command: >>> Start command with PVI Command: Command: PVI >>> Select polyline to import coordinates >>> Select polyline to import coordinates >>> Select polyline to import coordinates >>> Select polyline to import coordinates *Cancel* *Cancel* why ? Quote
fixo Posted November 27, 2009 Posted November 27, 2009 Dear fixoHi when I use your code , after picking on a pline the below massage occurs : Command: _appload PlineImport.LSP successfully loaded. Command: >>> Start command with PVI Command: Command: PVI >>> Select polyline to import coordinates >>> Select polyline to import coordinates >>> Select polyline to import coordinates >>> Select polyline to import coordinates *Cancel* *Cancel* why ? See post #23 ~'J'~ Quote
cadman2009 Posted November 27, 2009 Author Posted November 27, 2009 See post #23 ~'J'~ Dear fixo I make a 3dpoly and save it to c:\polytest.dwg and then load your code and type in command line pvi , after selecting polyline don't make any excel file and when I type nomutt 0 the command line appear and when I type nomutt in command line Disappear command line . However Is not made any excel file . I have this problem with 2 files : plineImport.lsp and dwgtoexcel.lsp please tell me how I can run these files step by step and where I must retrieved follow them . thanks Quote
Lee Mac Posted November 27, 2009 Posted November 27, 2009 Please try this instead CadMan, it works fastest if Excel is already open. ;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 27.11.2009 (defun c:pExp (/ *error* ObjRel ss col row ent tot j pt) (vl-load-com) (defun *error* (e) (ObjRel (list xlApp xlCells)) (or (wcmatch (strcase e) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error : " e " **"))) (princ)) (defun ObjRel (lst) (mapcar (function (lambda (x) (if (and (eq (type x) 'VLA-OBJECT) (not (vlax-object-released-p x))) (vl-catch-all-apply 'vlax-release-object (list x))))) lst)) (if (setq i -1 ss (ssget '((0 . "*POLYLINE")))) (progn (setq xlApp (vlax-get-or-create-object "Excel.Application") xlCells (vlax-get-property (vlax-get-property (vlax-get-property (vlax-invoke-method (vlax-get-property xlApp "Workbooks") "Add") "Sheets") "Item" 1) "Cells") col 0 row 1) (mapcar (function (lambda (x) (vlax-put-property xlCells "Item" row (setq col (1+ col)) x))) '("Point""X""Y""Z""Distance""Total")) (while (setq ent (ssname ss (setq i (1+ i)))) (setq tot 0. row (1+ row) j (1- (vlax-curve-getStartParam ent))) (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent)) (setq col 0 pt (mapcar 'rtos (vlax-curve-getPointatParam ent j))) (mapcar (function (lambda (x) (vlax-put-property xlCells "Item" row (setq col (1+ col)) x))) (list (rtos (1+ j) 2 0) (car pt) (cadr pt) (caddr pt) (rtos (setq dis (- (vlax-curve-getDistatParam ent j) (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (rtos (setq tot (+ dis tot))))) (setq row (1+ row)))) (vlax-put-property xlApp 'Visible :vlax-true) (ObjRel (list xlApp xlCells)))) (princ)) Quote
fixo Posted November 27, 2009 Posted November 27, 2009 Dear fixoI make a 3dpoly and save it to c:\polytest.dwg and then load your code and type in command line pvi , after selecting polyline don't make any excel file and when I type nomutt 0 the command line appear and when I type nomutt in command line Disappear command line . However Is not made any excel file . I have this problem with 2 files : plineImport.lsp and dwgtoexcel.lsp please tell me how I can run these files step by step and where I must retrieved follow them . thanks Ok, I see where I'm wrong, sorry This one is working for me nice I use A2008 an Excel 2003 Try it again (Refresh my memory where is dwgtoexcel.lsp) ~'J'~ PlineImport.LSP Quote
cadman2009 Posted November 27, 2009 Author Posted November 27, 2009 Please try this instead CadMan, it works fastest if Excel is already open. ;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 27.11.2009 (defun c:pExp (/ *error* ObjRel ss col row ent tot j pt) (vl-load-com) (defun *error* (e) (ObjRel (list xlApp xlCells)) (or (wcmatch (strcase e) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error : " e " **"))) (princ)) (defun ObjRel (lst) (mapcar (function (lambda (x) (if (and (eq (type x) 'VLA-OBJECT) (not (vlax-object-released-p x))) (vl-catch-all-apply 'vlax-release-object (list x))))) lst)) (if (setq i -1 ss (ssget '((0 . "*POLYLINE")))) (progn (setq xlApp (vlax-get-or-create-object "Excel.Application") xlCells (vlax-get-property (vlax-get-property (vlax-get-property (vlax-invoke-method (vlax-get-property xlApp "Workbooks") "Add") "Sheets") "Item" 1) "Cells") col 0 row 1) (mapcar (function (lambda (x) (vlax-put-property xlCells "Item" row (setq col (1+ col)) x))) '("Point""X""Y""Z""Distance""Total")) (while (setq ent (ssname ss (setq i (1+ i)))) (setq tot 0. row (1+ row) j (1- (vlax-curve-getStartParam ent))) (while (<= (setq j (1+ j)) (vlax-curve-getEndParam ent)) (setq col 0 pt (mapcar 'rtos (vlax-curve-getPointatParam ent j))) (mapcar (function (lambda (x) (vlax-put-property xlCells "Item" row (setq col (1+ col)) x))) (list (rtos (1+ j) 2 0) (car pt) (cadr pt) (caddr pt) (rtos (setq dis (- (vlax-curve-getDistatParam ent j) (if (zerop j) 0 (vlax-curve-getDistatParam ent (1- j)))))) (rtos (setq tot (+ dis tot))))) (setq row (1+ row)))) (vlax-put-property xlApp 'Visible :vlax-true) (ObjRel (list xlApp xlCells)))) (princ)) Thanks LEE it works correctly like your other programs Quote
Lee Mac Posted November 27, 2009 Posted November 27, 2009 Thanks LEEit works correctly like your other programs You're welcome CadMan Quote
cadman2009 Posted November 27, 2009 Author Posted November 27, 2009 Ok, I see where I'm wrong, sorryThis one is working for me nice I use A2008 an Excel 2003 Try it again (Refresh my memory where is dwgtoexcel.lsp) ~'J'~ Dear sir I thanks very much , Please Excuse me as to why I insisted something I repeated questions . Quote
fixo Posted November 27, 2009 Posted November 27, 2009 Dear sirI thanks very much , Please Excuse me as to why I insisted something I repeated questions . No worries, please Ask me again and again You helped me too to find the mistakes Regards, ~'J'~ Quote
leo321 Posted August 6, 2013 Posted August 6, 2013 There is a way to associate info export with the name of layer like this; buts this only take area (defun c:pline-area ( / *error* data-lst sorted-lst str-lst top-str polys data cnt obj file-nm tmp item tmp-str fl) (defun *error* (msg) (if(= msg "quit / exit abort") (princ "\nNo output file was selected") (princ msg) ) ) (setq top-str "" file-nm (getfiled "Output File" "" "doc" 1) ) (if(null file-nm)(exit)) (if(setq polys(ssget '((0 . "*POLYLINE")))) (repeat(setq cnt(sslength polys)) (setq obj (vlax-ename->vla-object (ssname polys (setq cnt(1- cnt)) ) ) data-lst (cons (list(vlax-get obj 'Layer) (vlax-get obj 'Area) ) data-lst ) ) ) ) (while data-lst (setq data (car data-lst) data-lst (cdr data-lst) tmp (list data) ) (foreach item data-lst (if(=(car item)(car data)) (setq tmp (cons item tmp) data-lst (vl-remove item data-lst) ) ) ) (setq sorted-lst(cons tmp sorted-lst)) ) (setq sorted-lst (vl-sort sorted-lst '(lambda(a b)( ) (foreach item (reverse sorted-lst) (setq top-str (strcat(caar item)"," top-str) ) ) (setq str-lst (cons top-str str-lst) cnt 0 ) (repeat(apply 'max(mapcar 'length sorted-lst)) (setq tmp-str "") (foreach item (reverse sorted-lst) (setq tmp-str (if(setq tmp(nth cnt item)) (strcat(rtos(cadr tmp)) "," tmp-str) (strcat "," tmp-str) ) ) ) (setq cnt (1+ cnt) str-lst (cons tmp-str str-lst) ) ) (if(setq fl(open file-nm "w")) (progn (foreach str (reverse str-lst) (write-line str fl) ) (close fl) (alert(strcat file-nm " was created")) ) (alert "Unable to create file") ) (princ) ) 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.