Jump to content

Recommended Posts

Posted

Dear friends

lets say that i want to draw somthing and i want to read the information from csv file.

what i'm looking for is a lisp that read from csv file and store the cell content at A1/A2/A3...

and when there is empty cell in the row he start to read the second col and store them as B1/B2/B3....

 

i search all the web with no succes

plz help :)

 

PAD.csv

Posted

Dont understand when you open the csv in excel it makes a pattern, to do with pads.

 

You need to post a dwg or image about what it is your trying to do.

Posted

HI BIGAL

i'm attaching DWG and part of my code

what i want is set the parameter W1/L1/H1.... from the excel and not from autocad

and after the routine is finish he will start to read from the second col of excel and so on.

 

PAD.dwg

PAD 3 STEPS - Copy (6).LSP

Posted (edited)

ziele is on the money it would be much easier to just use the csv than read from excel, yes you can do read an excel cell value I uses GETEXCEL.lsp

 

Looking at it further you can build a big list combining each line of the csv file

 

(("PAD1" "PAD2" "PAD3" "PAD4")
("WIDTH1" "400" "350" "" "")
("LENGTH1" "500" "460" "" "")
("HEIGHT1" "100" "80" "" "")
("WIDTH2" "300" "300" "" "")
("LENGTH2" "400" "350" "" "")
("HEIGHT2" "80" "70" "" "")
("WIDTH3" "200" "250" "" "")
("LENGTH3" "300" "300" "" "")
("HEIGHT3" "60" "60" "" "")
("WIDTH_COL" "40" "40" "" "")
("LENGTH_COL" "80" "80" "" ""))

 

Using the nth function in a double repeat loop you can pull out the correct values for this part of your code

W1 (getreal "\nEnter Width Of Pad (cm) :")
	L1 (getreal "\nEnter Length Of Pad (cm) :")
	H1 (getreal "\nEnter Hight Of Pad (cm) :")
	W2 (getreal "\nEnter Width2 Of Pad (cm) :")
	L2 (getreal "\nEnter Length2 Of Pad (cm) :")
	H2 (getreal "\nEnter Hight2 Of Pad (cm) :")
	W3 (getreal "\nEnter Width3 Of Pad (cm) :")
	L3 (getreal "\nEnter Length3 Of Pad (cm) :")
	H3 (getreal "\nEnter Hight3 Of Pad (cm) :")
	W4 (getreal "\nEnter Width Of Col (cm) :")
	L4 (getreal "\nEnter Length Of Col (cm) :")

GetExcel.lsp

Edited by BIGAL
Posted

Something like this

 

(setq x 1)
(set1 y 1)
(while (/= (setq W1 (nth x (nth y lst))) nil)
(setq L1 (nth x  (nth (setq y (+ y 1)) lst)))
(setq H1 (nth x (nth (setq y (+ y 1)) lst)))
......
Draw now
(setq x (+ x 1))
(setq y 1)
)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...