• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

diesel expression data field

  • Thread starter Thread starter luca.rgn
  • Start date Start date

luca.rgn

Guest
Good morning.
I'm trying to figure out how diesel expressions work in autocad and I'm doing some tests.
the main problem is with substr.
esempio: file name: xxxxxx
-xxxx-xxxx-xxxxxx name layout: Developedthe goal is to replace the characters of the file name from number 18 to 21 with the layout name so I wrote this$(substr,$(getvar,"dwgname"),1,17)$(getvar,"ctab")$(substr,$(getvar,"dwgname"),.this expression is working and fine, but since I want to take only characters from 18 to 21 of the file name does not work.
writing this:$(substr, $(getvar "dwgname"),18,21)It takes all the characters from18th onwards.
Can you explain why?
 
where we work we put as file nameclient-21-570.dwg in which 21 is the year and 570 is the code of the contract. I created in my drawings a data field with the format:

$(substr,$(getvar,dwgname),$(-,$(strlen,$(getvar,dwgname),9),6)

this allows me, starting from the last 9 characters of the file (21-570.dwg) and from them take only 6: i.e. exclude the dwg extension.

the result to video therefore is:

21-570

based on this reasoning, I think you can solve your problem... .

the strlen variable allows me to have a client name of any length.
 
Good morning.
...$(substr, $(getvar "dwgname"),18,21)It takes all the characters from18th onwards.
Can you explain why?
because you tell him to start from the 18th character and take 21
You should tell him $(substr,$(getvar,"dwgname"),18,4)

oops, same answer as rpor
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top