jhonnying Posted November 10, 2011 Posted November 10, 2011 Hello to everyone! I'm from Romania and i'm new in this forum. I have found very interesting this .lsp programs and i wonder if you can help with this kind of problem. For example, if i have in excel 2 columns containing values for altitude of points in a column and distance beetween those points in the other column, i want to generate a table and a drawing like in the attachment, that contains automatic counting of points, the altitude, the partial distance and the cumulative distance. It will be great if the automatic counting of points starts with a value entered from the keyboard. Excuse my english please! Thanks, i home you understand what i mean! Good luck! Quote
ketxu Posted November 10, 2011 Posted November 10, 2011 May be we can do with more detail, your files ^^ Quote
jhonnying Posted November 10, 2011 Author Posted November 10, 2011 hello! what kind of detail would you like?? perhaps i've confuzed you with the automatic counting of points. The automatic counting of points i can generated myself in excel. I attached an excel data file to be more specific. Sinceraly, it takes a lot of days to complete this kind of drawing (table) if i have for example 200 points, that's why i started searching the internet for some help. I hope you understand my issue! thanks a lot for posting me back and for showing interesting for my problem! excel data.xls Quote
jhonnying Posted November 22, 2011 Author Posted November 22, 2011 anyone looked over my problem? at least please give an opinion! Quote
jvillarreal Posted November 22, 2011 Posted November 22, 2011 (edited) jhonnying, It's definitely possible to generate your table/profile drawing through lisp but, in my opinion, someone would have to be pretty generous with their time to provide the routine (for free) as it would be tailored to your needs and likely nothing more than an example/learning reference to anyone else. Maybe you can go to lee-mac.com and hire him to write it for you? If your current process typically takes days to complete as you say, I'm sure the program will pay itself off with its first use. Edited November 22, 2011 by jvillarreal Quote
FELIXJM Posted November 24, 2011 Posted November 24, 2011 The following prototype program for the file posted. ;;; (vl-load-com) (setq #arq (getfiled "Selecione o arquivo" "" "xls" 2)) (setq celulas nil) (setq excel-app (vlax-create-object "excel.application")) (setq wb-collection (vlax-get excel-app "workbooks")) (setq arq (vlax-invoke-method wb-collection "Open" #arq)) (setq pastas (vlax-get arq "sheets")) (setq pasta1 (vlax-get-property pastas "item" 1)) (setq celulas (vlax-get pasta1 "cells")) (COMMAND "_PLINE") (SETQ NL 1) (REPEAT 7 ;Pega os dados armazenados na planila atual na linha NL e coluna 1=A,2=B,3=C,4=D,5=E (setq V-A (vlax-variant-value (vlax-variant-change-type (vlax-get-property celulas "item" NL 1) vlax-vbstring))) (setq V-B (vlax-variant-value (vlax-variant-change-type (vlax-get-property celulas "item" NL 2) vlax-vbstring))) (setq V-C (vlax-variant-value (vlax-variant-change-type (vlax-get-property celulas "item" NL 3) vlax-vbstring))) (setq V-D (vlax-variant-value (vlax-variant-change-type (vlax-get-property celulas "item" NL 4) vlax-vbstring))) (setq V-E (vlax-variant-value (vlax-variant-change-type (vlax-get-property celulas "item" NL 5) vlax-vbstring))) (PRINT (STRCAT "A=" V-A " B=" V-B " C=" V-C " D=" V-D " E=" V-E)) (SETQ PX (ATOF (VL-STRING-SUBST "." "," V-E))) (SETQ PY (ATOF (VL-STRING-SUBST "." "," V-B))) (IF (AND (> PX 0) (> PY 0)) (COMMAND (LIST PX PY)) ) (SETQ NL (+ NL 1)) ) (COMMAND "") (COMMAND "_ZOOM" "_E") (vlax-invoke-method wb-collection "Close") (vlax-invoke-method excel-app "Quit" ) (PRINC) ;;; OK. Quote
jhonnying Posted November 24, 2011 Author Posted November 24, 2011 Thank you very much, but please tell me how i can run this program in autocad?? Quote
FELIXJM Posted November 24, 2011 Posted November 24, 2011 Save the program in a file with the LSP In AutoCAD go to the top menu TOOL -> AutoLISP -> LOAD APLICATION and select the file, then click LOAD. You do not need help, but of a consulting service. OK? Quote
jhonnying Posted November 25, 2011 Author Posted November 25, 2011 I know this procedure, but i don't know the command from the keyboard, usually i use the 'name' from the sintagm: defun c:'name', but in the program above i don't see that. What is the command i'll entry from the keyboard? Thanks a lot for your promptitude! Quote
Organic Posted November 25, 2011 Posted November 25, 2011 I know this procedure, but i don't know the command from the keyboard, usually i use the 'name' from the sintagm: defun c:'name', but in the program above i don't see that. What is the command i'll entry from the keyboard? Thanks a lot for your promptitude! Save the file as something.lsp using Notepad (not the .txt default extension) Load it in AutoCad, Tools => AutoLisp => Load Application When you load it, the script will run and ask you to select the Excel file. Quote
jhonnying Posted November 25, 2011 Author Posted November 25, 2011 I'm sorry guys but the program doesn't work properly. It only draws a polyline...i attached a dwg file and a new excel sheet with other values to give a more concludent example. It is written in romanian. Thanks! Good luck! profil transversal.dwg excel data1.xls Quote
Organic Posted November 26, 2011 Posted November 26, 2011 Why not purchase a civil software program that you can use to create cross sections? Quote
jhonnying Posted November 27, 2011 Author Posted November 27, 2011 Because i'm so familiar with the 2004-2008 autocad format, and i don't have time to learn a new one by myself. Take care! Thx! Quote
FELIXJM Posted November 28, 2011 Posted November 28, 2011 The program that was posted a small example of how to use Excel to access the Autolisp, if not program or do not have time for this should then pay for the service ready for a specific program. OK. Quote
fixo Posted November 28, 2011 Posted November 28, 2011 I'm sorry guys but the program doesn't work properly. It only draws a polyline...i attached a dwg file and a new excel sheet with other values to give a more concludent example. It is written in romanian. Thanks! Good luck! I can commence working on the programming task, that you have described, immediately. Upon completion of the program, may I ask that if you are satisfied with the final product, that you donate $5 to the forum in order to offset its running costs so other people around the world can continue to benefit from it. ~'J'~ Quote
fixo Posted November 28, 2011 Posted November 28, 2011 Great suggestion. OK. Thanks for the support, Regards, ~'J'~ Quote
fixo Posted November 28, 2011 Posted November 28, 2011 (edited) Try this framework See comments above the code ~'J'~ profil-transversal.LSP Edited November 28, 2011 by fixo spell check Quote
FELIXJM Posted November 28, 2011 Posted November 28, 2011 Oleg (FIXED) complicated because you both the selection of the spreadsheet and not simply asked the User to select the XLS file? OK? Quote
fixo Posted November 28, 2011 Posted November 28, 2011 Oleg (FIXED) complicated because you both the selection of the spreadsheet and not simply asked the User to select the XLS file?OK? Agreed, it's just to show using Excel methods in Autolisp, perhaps it will be reasonable for other forum members Regards, ~'J'~ 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.