IF / Then / Else MACRO to Check for existing linetype before loading

IF / Then / Else MACRO to Check for existing linetype before loading

Anonymous
Not applicable
873 Views
3 Replies
Message 1 of 4

IF / Then / Else MACRO to Check for existing linetype before loading

Anonymous
Not applicable

Afternoon All,

 

Can someone please help with my below macro, I cannot seem to get it to work:

 

^C^C$M=$ (if,$(=,(TBLSEARCH "LTYPE" "bank_top_l"),nil),-LINETYPE;L;BANK_TOP_L;LINKSLT1.lin;,)

 

Basically I want to check if an existing linetype "bank_top_l" exists within the dwg file and if it doesn't load the linetype and if it does exist do nothing.

0 Likes
Accepted solutions (1)
874 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I think am getting closer:

 

^C^C$M=$(if,$(=,$(eq,nil,(TBLSEARCH "LTYPE" "bank_top_l")),1),-LINETYPE L bank_top_l LINKSLT1.lin,)

 

But still not working, any ideas?

0 Likes
Message 3 of 4

cadffm
Consultant
Consultant
Accepted solution
untested.

Without a crazy mix of DIESEL and LISP, pure Lisp:
(if (and(not(tblsearch "LTYPE" "bank_top_l"))(findfile "LINKSLT1.lin"))(command "_.-Linetype" "_load" "bank_top_l" "LINKSLT1.lin"))

Tblsearch is a Lispfunction, there is no Dieselfunction to check if ltype loaded.

Sebastian

Message 4 of 4

Anonymous
Not applicable

Cool cheers for that cadffm.

0 Likes