Set block's attributes lisp

Set block's attributes lisp

Anonymous
Not applicable
1,001 Views
4 Replies
Message 1 of 5

Set block's attributes lisp

Anonymous
Not applicable

Hi this is my very first time posting here.

I need to solve this problem: I've an Excel sheet with some different blocks with attributes. I need a LISP routine to insert  directly the block with the correct attributes.

I'm getting started through programming in LISP

Thanks!

0 Likes
1,002 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Hello @Anonymous
Could you post an example of your spreadsheet?

 

 

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

Sure!

 

Blk NameAtt1Att2Att3Att4Att5Att6Att7Att8Att9Att10Att11Att12Att13Att14Att15
Name1N-XX ART-x<><><><><><><><><><>xx4
Name2N-XX A<>ID-xYY-mAA<><><><><><><>xx6
Name3<><><><><>IC-xN-XX A<><><><><>xx4
Name4N-XX A<><><><><><>RIM-x<><><>xx5
Name5<><><><><><><><><>CM<><>xx3
Name6N-XX A<><>YY-mAA<><><><><>IMD-x<>xx6
Name7<><><><><><><><><><><>CMxxx3

 *(where <> means empty)

Each column is an attribute. I want to draw each block with its attributes at a given known position. I'd rather do this with some command functions  in a lisp file instead of lisp functions. By the moment, I know how to write attibutes. I've done something like that:

(command "insert" "blockname" (list base_point) scales rotation "first attribute's value" "second..." till the 15th)

By the way, how can I spicify how many attributes a block has and set it in a command line?

 

Thanks a lot!

 

0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor

You can write everything in excel and just copy a column to the command line, you use the concatenate command you would though need a IF blank then "" else value, using a lisp to read direct from excel would be easier just read block name then check excel row for attribute values using say a cell value as end of attributes so blanks work properly. 

0 Likes
Message 5 of 5

Anonymous
Not applicable

It's been a usefull idea, thanks! However, how may I read each cell at the excel sheet? I've thought something similar to this:

(defun myfun file_path column_number

(open "file_path" "r")

(while not_empty_cell (setq atts (list read_cell)) (to_next_cell))

)

I don't know how to do the Italic tasks, and here's my problem...

Thanks a lot!

 

 

 

 

0 Likes