Lisp string

Lisp string

Anonymous
Not applicable
2,307 Views
19 Replies
Message 1 of 20

Lisp string

Anonymous
Not applicable

I HAVE A VLISP STRING

 

(defun xls ( Data-list header Colhide Name_list / *aplexcel* *books-colection* Currsep *excell-cells* *new-book* *sheet#1* *sheet-collection* col iz_listo row cell cols)
(defun Letter (N / Res TMP)(setq Res "")(while (> N 0)(setq TMP (rem N 26)
  TMP (if (zerop TMP)(setq N (1- N) TMP 26) TMP)
  Res (strcat (chr (+ 64 TMP)) Res)  N   (/ N 26))) Res)
(if (null Name_list)(setq Name_list ""))
(setq  *AplExcel*     (vlax-get-or-create-object "Excel.Application"))
(setq *Books-Colection*  (vlax-get-property *AplExcel* "Workbooks")
              *New-Book*     (vlax-invoke-method *Books-Colection* "Add")
          *Sheet-Collection* (vlax-get-property *New-Book* "Sheets")
               *Sheet#1*     (vlax-get-property *Sheet-Collection* "Item" 1))
(setq *excell-cells*     (vlax-get-property *Sheet#1* "Cells"))
(setq col 0 cols nil)
(if (> (strlen Name_list) 26)
(setq Name_list (strcat (substr Name_list 1 10) "..." (substr Name_list (- (strlen Name_list) 13) 14))))
(vlax-for sh *Sheet-Collection* (setq cols (cons (strcase(vlax-get-property sh 'Name)) cols)))
(setq row Name_list)
(while (member (strcase row) cols)(setq row (strcat Name_list " (" (itoa(setq col (1+ col)))")")))
(setq Name_list row)
(vlax-put-property *Sheet#1* 'Name Name_list)
(setq Currsep (vlax-get-property *AplExcel* "UseSystemSeparators"))
(vlax-put-property *AplExcel* "UseSystemSeparators" :vlax-false) 
(vlax-put-property *AplExcel* "DecimalSeparator" ".")           
(vlax-put-property *AplExcel* "ThousandsSeparator" " ")
(vlax-put-property *excell-cells* 'NumberFormat "0.000")
(vla-put-visible *AplExcel* :vlax-true)(setq row 1 col 1) (repeat (length header)(vlax-put-property *excell-cells* "Item" row col (vl-princ-to-string (nth (1- col) header)))(setq col (1+ col)))(setq row 2 col 1) (repeat (length Data-list)(setq iz_listo (car Data-list))(repeat (length iz_listo) (vlax-put-property *excell-cells* "Item" row col (vl-princ-to-string (car iz_listo))) (setq iz_listo (cdr iz_listo) col (1+ col)))(setq Data-list (cdr Data-list))(setq col 1 row (1+ row))) (setq col (1+(length header)) row (1+ row)) (setq cell (vlax-variant-value (vlax-invoke-method *Sheet#1* "Evaluate" (strcat "A1:" (letter col)(itoa row))))) ;_ end of setq (setq cols (vlax-get-property cell 'Columns)) (vlax-invoke-method cols 'Autofit) (vlax-release-object cols)(vlax-release-object cell) (foreach item ColHide (if (numberp item)(setq item (letter item))) (setq cell (vlax-variant-value (vlax-invoke-method *Sheet#1* "Evaluate" (strcat item "1:" item "1")))) (setq cols (vlax-get-property cell 'Columns)) (vlax-put-property cols 'hidden 1) (vlax-release-object cols)(vlax-release-object cell)) (vlax-put-property *AplExcel* "UseSystemSeparators" Currsep) (mapcar 'vlax-release-object (list *excell-cells* *Sheet#1* *Sheet-Collection* *New-Book* *Books-Colection* *AplExcel*))(setq *AplExcel* nil)(gc)(gc)(princ))

wHAT DO I DO FROM HERE TO GET MY POINT DATA TO EXEL??
0 Likes
Accepted solutions (1)
2,308 Views
19 Replies
Replies (19)
Message 2 of 20

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

what is the source of that LISP, any link where you have that got from?

I guess you might get the info how to use it in the same place.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 20

Anonymous
Not applicable

Hi Alfred.

 

I got this string form a forum member on a previous post.

Do you have a Vlisp string that i can use?

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/export-data-to-excel/m-p/7289770#M35...

 

 

0 Likes
Message 4 of 20

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I got this string form a forum member on a previous post

Then please ask there, the developer of that code can help you best.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 5 of 20

devitg
Advisor
Advisor

Please upload your  dwg , where to apply it

Message 6 of 20

Anonymous
Not applicable

Hi DevitG

 

Here is the file

 

 

0 Likes
Message 7 of 20

devitg
Advisor
Advisor

Hi Benny , what do you want or need to do??

 

 

0 Likes
Message 8 of 20

Anonymous
Not applicable

so what i need to do is the following:

 

Each Polyline has a data Point So, in essence, a XYZ Value,

So the data extractor can only extract point data from a line.

I need a Vlisp string to export my XYZ polyline data to an Exel format

0 Likes
Message 9 of 20

C.Utzinger
Collaborator
Collaborator
Accepted solution

HI first you need is a code for get the needed data from the polylines into a list. Something like:

 

 

((("POLY" . "1")( "X" . "141.141")( "Y" . "234.034") ( "Z" . "0")))

 

 

Attached a complete LSP for inserting and extracting Points.

 

 

Sorry it's German!!! 

 

 

Kind regards

 

Message 10 of 20

Anonymous
Not applicable

Thank you very much,

 

How do i execute these LSP

 

No problem, i speak Afrikaans  derived from Dutch/German. Try my best

0 Likes
Message 11 of 20

C.Utzinger
Collaborator
Collaborator

OH OK! Let's start whith this...

 

For testing you can just drag and drop it into AutoCAD.

 

For execute, write <Koordpunkt in the commandline.

 

Make sure that AutoCAD can find the files (.dcl and the .dwg). Save the Folder in the AutCAD Options.

 

 

Good luck!

 

 

 

Message 12 of 20

Anonymous
Not applicable

THANKS MAN!!!

 

What do i chose to open and export to excel?

0 Likes
Message 13 of 20

C.Utzinger
Collaborator
Collaborator

"Liste" and then "Alle" (Chose all)

Message 14 of 20

C.Utzinger
Collaborator
Collaborator

I don't think it is exactly what you need, but it is something to start with....

 

For example in the Excel, the X Y are changed, because we Need it for coordinates in construction and those are changed...

 

 

Kind regards

 

 

0 Likes
Message 15 of 20

Anonymous
Not applicable

It worked thanks.

 

So what i use it for is for mining.

And data is needed from the "Underground Road" and the ORE body. if that makes sense?

 

Thank you very much!

We have an OEM Licence for AutoCAD .It blocks the usage of app data,unfortunately, but this gives me a good example to follow in programming a new function! 

 

Du bist ein Champion!

 

0 Likes
Message 16 of 20

C.Utzinger
Collaborator
Collaborator

OK, cool...

 

I'm not a Champion, all users who help here are. I received a lot of help here, so i could make my own functions.

 

Would be lost without this Forum....

 

 

Kind regards

0 Likes
Message 17 of 20

devitg
Advisor
Advisor

Could it be the solution you need , 

My English is not better , I´m from Argentina , Spanish Idiom. 

 

Please see the XLS attached , it hold a few  vertices for the upper poly .

 

As you do not answer my previous post , I stop working further . 

Message 18 of 20

Anonymous
Not applicable

Hi devit i did please see email that i sent this morning.

 

Thanks alot!

0 Likes
Message 19 of 20

devitg
Advisor
Advisor

I do. 

0 Likes
Message 20 of 20

devitg
Advisor
Advisor

See the first attemp 

 

 

0 Likes