Jump to content
itacad

Data Field and Diesel Expression, file name and layout name

Recommended Posts

itacad

Hello, I'm trying to automate the compilation of the attributes of some blocks...I would like to:

1) Write the filename without the extension

with this expression in data field i can write the file name, but it has the extension

%<\AcVar Filename \f "%fn6">%

with this diesel expression I can write the file name or part of it but I don't know how to cut the extension without counting the characters

$(SUBSTR,$(GETVAR,DWGNAME))

2) Write the file name starting from a certain character, for example the tenth, until its end but excluding the extension

$(SUBSTR,$(GETVAR,DWGNAME),10)

3) Write only a part of the layout name

with this data field I can write the name of the layout, but I don't know how to use only part of the string, for example the characters from the fourth to the eighth

%<\AcVar ctab \f "%tc1">%

is there a diesel expression to write the name of the layout?

Regards

Share this post


Link to post
Share on other sites
itacad

Hello, I found some answer for this post...

1) write the filename without extenion

$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4))

3) For this point, now I understand! it was enough to replace the dwgname variable with ctab and use the expression!

for the rest I have to study well how these diesel exactions work!

Regards

Share this post


Link to post
Share on other sites
steven-g

You look to be on top of this now, so which parts are you still having problems with?

Share this post


Link to post
Share on other sites
itacad

Thanks for the links!
Another combination I should make with some filename is to write the file name from a certain character (for example the tenth), up to its end but without the extension.

Let's see if I can with a combination of the previous cases.

Regards
 

Share this post


Link to post
Share on other sites
tombu
On 9/27/2019 at 4:04 PM, itacad said:

Hello, I'm trying to automate the compilation of the attributes of some blocks...I would like to:

1) Write the filename without the extension: %<\AcVar Filename \f "%fn2">%  You missed the checkbox.

 

2) Write the file name starting from a certain character, for example the tenth, until its end but excluding the extension:

%<\AcDiesel $(SUBSTR,$(GETVAR,DWGNAME),10,$(-,$(STRLEN,$(GETVAR,DWGNAME)),13))>%

 

3) Write only a part of the layout name with this data field I can write the name of the layout, but I don't know how to use only part of the string, for example the characters from the fourth to the eighth: %<\AcDiesel $(SUBSTR,$(GETVAR,CTAB),4,4)>%

 

Share this post


Link to post
Share on other sites
itacad

I think I managed to use only an indefinite part of the filename starting from a certain character, up to the end, without the extension!

The files I use have the following structure:

- the first alphanumeric part always consists of 18 characters

- the second part (which is what I need), descriptive and with a non-predetermined number of characters

If I add the characters to remove to the formula that deletes the extension to the filename, I get the part of filename that I need but without having to count anything!

regards

C2019-015-EL-007S QE.GEN.dwg

C2019-015-EL-008P PIANO 1 FM.dwg

Share this post


Link to post
Share on other sites
tombu
14 hours ago, itacad said:

I think I managed to use only an indefinite part of the filename starting from a certain character, up to the end, without the extension!

The files I use have the following structure:

- the first alphanumeric part always consists of 18 characters

- the second part (which is what I need), descriptive and with a non-predetermined number of characters

If I add the characters to remove to the formula that deletes the extension to the filename, I get the part of filename that I need but without having to count anything!

regards

C2019-015-EL-007S QE.GEN.dwg 58.24 kB · 1 download

C2019-015-EL-008P PIANO 1 FM.dwg 51.02 kB · 1 download

This should work as the DIESEL to remove both the first 18 characters and the extension leaving the descriptive and with a non-predetermined number of characters you are looking for:

$(substr,$(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4)),19)

 

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...