itacad Posted September 27, 2019 Share Posted September 27, 2019 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 Quote Link to comment Share on other sites More sharing options...
itacad Posted September 29, 2019 Author Share Posted September 29, 2019 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 Quote Link to comment Share on other sites More sharing options...
steven-g Posted September 30, 2019 Share Posted September 30, 2019 You look to be on top of this now, so which parts are you still having problems with? Quote Link to comment Share on other sites More sharing options...
SLW210 Posted September 30, 2019 Share Posted September 30, 2019 Somewhere on CADTutor I posted some information on shortening the results and other useful Diesel tips. Found this https://www.cadtutor.net/forum/topic/54270-shortening-fields-in-attributes/ Quote Link to comment Share on other sites More sharing options...
itacad Posted September 30, 2019 Author Share Posted September 30, 2019 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 Quote Link to comment Share on other sites More sharing options...
tombu Posted October 1, 2019 Share Posted October 1, 2019 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)>% Quote Link to comment Share on other sites More sharing options...
itacad Posted October 2, 2019 Author Share Posted October 2, 2019 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 Quote Link to comment Share on other sites More sharing options...
tombu Posted October 3, 2019 Share Posted October 3, 2019 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) Quote Link to comment Share on other sites More sharing options...
Ciro Posted October 8, 2021 Share Posted October 8, 2021 Someone knows how can I remove the first 12 charts of my file name? I'm Using that expression to get the file and all UpperCase $(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4)) \f "%tc1%fn6">% File Name: P0000-E-000 Proposed xFSDV xxxxxxx xxxxxxx I want remove P0000-E-000 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted October 11, 2021 Share Posted October 11, 2021 $(substr,$(getvar,"dwgname"),12,$(-,$(strlen,$(getvar,"dwgname")),4)) \f "%tc1%fn6">% Not tested Quote Link to comment Share on other sites More sharing options...
op90o Posted December 10, 2021 Share Posted December 10, 2021 On 2021/10/8 at PM6點57分, Ciro said: 有人知道如何刪除文件名的前 12 個圖表嗎? 我正在使用該表達式來獲取文件和所有大寫 $(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),4)) \ f "%tc1%fn6">% 文件名:P0000-E-000 提議的 xFSDV xxxxxxx xxxxxxx 我想刪除 P0000-E-000 $(substr,$(getvar,"dwgname"),1,$(-,$(strlen,$(getvar,"dwgname")),35)) Quote Link to comment Share on other sites More sharing options...
TheVAS Posted February 27, 2023 Share Posted February 27, 2023 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 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 For #3 - $(SUBSTR,$(GETVAR,CTAB),3,7) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.