nids_1978 Posted June 5, 2010 Share Posted June 5, 2010 Currently I am working on set of drawings for which I need to insert DXF files. These DXF files contain BOM extracted from our in house software. I usually prepare the drawings and insert the DXF by simply dragging the file into drawing, then scaling and placing in the right place. This take bit of time and just boring. I want to do this process using Script. We care currently using this software - ezscriptpro We are write small scripts like below, it great to changing constant things Zoom extent cht c 70,22 100,30 t r ISSUED FOR CONSTRUCTION qsave The problem this time is I have to insert DXF file using command : Insert (below is the script) Zoom extent -insert “(substr,$(getvar,dwgname),14,4) “ 450,20 1 1 0 qsave This gives error because insert command need file name not string “(substr,$(getvar,dwgname),14,4) “ but I need string as DXF name keeps changing with Drawing name. Drawing name –5099221_DD03_5501_001_00.dwg, 5099221_DD03_5502_001_00.dwg, 5099221_DD03_5503_001_00.dwg……………..etc Dxf name – 5501, 5502, 5503……..etc “(substr,$(getvar,dwgname),14,4) “ give out put as “5501, 5502, 5503” If anyone know how to solve this problem or have a better idea to do this process pls let us know. Quote Link to comment Share on other sites More sharing options...
MSasu Posted June 5, 2010 Share Posted June 5, 2010 Try to write it like: (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) Regards, Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 5, 2010 Share Posted June 5, 2010 Perhaps: (substr (getvar 'DWGNAME) 14 4) Or if you wanted to stick to DIESEL: (menucmd "m=$(substr,$(getvar,dwgname),14,4)") Quote Link to comment Share on other sites More sharing options...
nids_1978 Posted June 7, 2010 Author Share Posted June 7, 2010 Thanx guys for the input... msasu Code - (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) give below output.......... Command: (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) "5099221_DD03_5514_001_00" Lee... the code you gave is right.. but the problem is using this in Inset Command.. below is the output.. Command: -INSERT Enter block name or [?] : (substr (getvar 'DWGNAME) 14 4) "(substr (getvar 'DWGNAME) 14 4).dwg": Can't find file in search path: C:\Program Files\AutoCAD 2008\fonts\ C:\Program Files\AutoCAD 2008\help\ C:\Program Files\AutoCAD 2008\Express\ C:\Program Files\AutoCAD 2008\drv\ C:\Program Files\AutoCAD 2008\ *Invalid* Insert command need drawing name... i want to use string so that i can use this in a loop... Quote Link to comment Share on other sites More sharing options...
nids_1978 Posted June 7, 2010 Author Share Posted June 7, 2010 Perhaps: (substr (getvar 'DWGNAME) 14 4) Or if you wanted to stick to DIESEL: (menucmd "m=$(substr,$(getvar,dwgname),14,4)") ------------------------------------------------------------------------ Hi Lee... the code you gave is right.. but the problem is using this in Inset Command.. below is the output.. Command: -INSERT Enter block name or [?] : (substr (getvar 'DWGNAME) 14 4) "(substr (getvar 'DWGNAME) 14 4).dwg": Can't find file in search path: C:\Program Files\AutoCAD 2008\fonts\ C:\Program Files\AutoCAD 2008\help\ C:\Program Files\AutoCAD 2008\Express\ C:\Program Files\AutoCAD 2008\drv\ C:\Program Files\AutoCAD 2008\ *Invalid* Insert command need drawing name... i want to use string so that i can use this in a loop... let me know your thoughts... cheers Prav Quote Link to comment Share on other sites More sharing options...
nids_1978 Posted June 7, 2010 Author Share Posted June 7, 2010 Try to write it like: (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) Regards, ---------------------------------------------------------------------- hi msasu Code - (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) give below output.......... and it gives error.. cant put this in a loop..!!:( Command: (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) "5099221_DD03_5514_001_00" 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.