Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Diesel Expression - File name IF Equations

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Oli
Enthusiast
1161 Views, 5 Replies

Diesel Expression - File name IF Equations

Hi All, 

 

Hoping you can help me, trying to write an expression to take part of a file name to inform an attribute, but I'm having a tad of trouble, and I'm not sure if its possible?!

 

What I'm trying to achieve is that "VAR" in the sample file name below can be a series of pre-defined letters that equal a drawing status, and when this is change its will update the attribute in the titleblock

 

                  Filename = ####-###-VAR

                 ASB  = AS BUILT

                 INF = INFOMATION

 

So I assumed I could do something like this:   $(if, ($(eq, val1, val2)), dotrue [, dofalse]) 

Where:

                 Val1 = ($(substr,$(getvar,dwgname),10,3))

                 Val2 = INF 

                 dotrue = Infomation

                dofalse = repeat simualr to excel IF equation. to include other variations

 

i have a feeling that   $(eq, val1, val2) has to be numerical?! - is there a version that works for text? that returns a 1 or 0 that would work wit with the IF equation?

Or is there a better way of doing this? 

 

Thanks in advance!

 

 

5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Oli

Message 3 of 6
Oli
Enthusiast
in reply to: Anonymous

Hi,

 

thanks for your post - although I've already got that bit of code - what I'm trying to do is use an IF equation to convert a series of letter within the drwaing title to a full word, this would allow me to maintain file naming standard.

 

 

Message 4 of 6
Paul_Gander
in reply to: Oli

You are on the right track. Try this:

 

$(if,$(eq,$(upper,$(substr,$(getvar,dwgname),10,3)),INF),Information,$(if,$(eq,$(upper,$(substr,$(getvar,dwgname),10,3)),ASB),As built, ))

There is a limit to the number of variations you'll be able to add to this though.

Message 5 of 6
ronjonp
in reply to: Oli

If I'm understanding correctly you need to nest like so:

$(if,$(eq, ($(substr,$(getvar,dwgname),10,3)), INF), Information, $(if,$(eq, ($(substr,$(getvar,dwgname),10,3)), ASB), AS BUILT, XXX))

*Edit TOO SLOW 🙂 

Message 6 of 6
Oli
Enthusiast
in reply to: Paul_Gander

Thanks Paul,

 

I'd done too many brackets in my attempt - nice to know i was on the right track!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta