pmadhwal7 Posted July 8, 2020 Posted July 8, 2020 Dear All, I have nearly 400 layouts and in each sheet having total length and Start and End Chainage as a Patch length and we note down those patch length on excel sheet now is that possible to import those patch length from excel to autocad both excel and autocad file are attached here. Patch length.dwg Patch length.xlsx Quote
devitg Posted July 8, 2020 Posted July 8, 2020 5 hours ago, pmadhwal7 said: is that possible to import those patch length from excel to autocad both excel and autocad file are attached here. Hi pmadhwal7 , to import to? Where do you need to import such text from the xls file? Do you mean to rename the layout ? Please , upload a sample DWG , with desired result. See attached dwg with the layout 01 changed to "Patch Length 90 (CH-0 TO CH-90)" Please consider to save the xls as CSV comma separated value, without head line, like the csv attached Patch length-new layout names.dwg Patch length-01-08.csv Quote
pmadhwal7 Posted July 9, 2020 Author Posted July 9, 2020 4 hours ago, devitg said: Hi pmadhwal7 , to import to? Where do you need to import such text from the xls file? Do you mean to rename the layout ? Please , upload a sample DWG , with desired result. See attached dwg with the layout 01 changed to "Patch Length 90 (CH-0 TO CH-90)" Please consider to save the xls as CSV comma separated value, without head line, like the csv attached Patch length-new layout names.dwg 299.06 kB · 0 downloads Patch length-01-08.csv 344 B · 0 downloads Thanks for your kind reply i didn't want to change layout name i want to import patch length which was already note down in excel, if you check my dwg file so i mention in first sheet patch length which is noted down in excel "Patch Length 90 (CH-0 TO CH-90)" other sheets having different patch length in compression to excel sheet i also attaching screen shot kindly help me Quote
BIGAL Posted July 9, 2020 Posted July 9, 2020 Providing the text is at same location on ever sheet then easy just go to each layout check its number/name and make text. What is your layout name if its like layout1 then add that to excel. If the layout name is all over the place you can use layout order instead. Do a csv export then its simple read the csv and (setvar 'ctab layoutnumber) (command "text" Pt .......) Use lee-mac parse csv to make a list of the layout details. Then use foreach on the list very simple. (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq tabs (vla-get-Layouts doc)) (while read csv ; make a list here from csv use (car (cadr get Y (repeat (vla-get-count tabs) (vlax-for lay tabs (setq x (vla-get-taborder lay)) (setq tabname (vla-get-name lay)) (if (and (= y x) (/= tabname "Model")) ; add text now. Quote
pmadhwal7 Posted July 9, 2020 Author Posted July 9, 2020 4 hours ago, BIGAL said: Providing the text is at same location on ever sheet then easy just go to each layout check its number/name and make text. What is your layout name if its like layout1 then add that to excel. If the layout name is all over the place you can use layout order instead. Do a csv export then its simple read the csv and (setvar 'ctab layoutnumber) (command "text" Pt .......) Use lee-mac parse csv to make a list of the layout details. Then use foreach on the list very simple. (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq tabs (vla-get-Layouts doc)) (while read csv ; make a list here from csv use (car (cadr get Y (repeat (vla-get-count tabs) (vlax-for lay tabs (setq x (vla-get-taborder lay)) (setq tabname (vla-get-name lay)) (if (and (= y x) (/= tabname "Model")) ; add text now. i tried readcsv lsp but not able to use can u please check it in my attached dwg, Patch length.dwg Patch length(1).xlsx Quote
devitg Posted July 9, 2020 Posted July 9, 2020 20 hours ago, pmadhwal7 said: is that possible to import those patch length from excel to autocad both excel and autocad file are attached here. Hi pmadhwal7 , to import to? Please clear , at your dwg , the patch length is at al 8 sheets And a like , not equal text, is at the XLS So, the task to do is: replace the text at the DWG , by the text at the XLS . It seem to be that you are updating the dwg as it had be changed adding a new LAYOUT's between 2 or more existing layouts. Maybe if you could explain WHAT you have , and not HOW to do , it will clear us. Quote
devitg Posted July 9, 2020 Posted July 9, 2020 On 7/8/2020 at 2:53 PM, pmadhwal7 said: is that possible to import those patch length from excel to autocad both excel and autocad file are attached here. Hi pmadhwal7 , Could it be so ? Please consider to save the xls as CSV comma separated value, without head line, like the csv attached Patch length-patch changed.dwg Patch length-01-08.csv Quote
pmadhwal7 Posted July 11, 2020 Author Posted July 11, 2020 On 7/10/2020 at 4:46 AM, devitg said: Hi pmadhwal7 , Could it be so ? Please consider to save the xls as CSV comma separated value, without head line, like the csv attached Patch length-patch changed.dwg 294.62 kB · 3 downloads Patch length-01-08.csv 344 B · 4 downloads and how can i able to import them in cad? Quote
devitg Posted July 11, 2020 Posted July 11, 2020 11 hours ago, pmadhwal7 said: and how can i able to import them in cad? I ask if it could be so , if you agree, a lisp can be made . Quote
BIGAL Posted July 11, 2020 Posted July 11, 2020 (edited) Whilst Devitg is correct pretty easy to change the text, it would be way better if you made the Title block into a block with attributes, you could do so much more updating, the 1 of 500 split into two sheet number and total number, the total number being updated by either how many layouts or a number like 500. Start sheet number if multi dwgs. Yes you would have 2 -3 different functions but the code for the tasks already exists. The only change required is block name and tag name. By making a block eliminates the error of selecting text by a pt, if you dont have the title work at an exact pt then it may error. Also for me with layouts and title blocks I set them up with lower left at 0,0 just for simplicity yours is at -177, 2.9 re read at an exact point. Re 1st line in csv is header not a problem so long as always produced that way its a 50/50 question. For me leave in just do a dummy read 1st line. If you can find time to do into a block lower left 0,0. Can provide some code. Edited July 12, 2020 by BIGAL Quote
pmadhwal7 Posted July 12, 2020 Author Posted July 12, 2020 4 hours ago, BIGAL said: Whilst Devitg is correct pretty easy to change the text, it would be way better if you made the Title block into a block with attributes, you could do so much more updating, the 1 of 500 split into two sheet number and total number, the total number being updated by either how many layouts or a number like 500. Start sheet number if multi dwgs. Yes you would have 2 -3 different functions but the code for the tasks already exists. The only change required is block name and tag name. By making a block eliminates the error of selecting text by a pt, if you dont have the title work at an exact pt then it may error. Also for me with layouts and title blocks I set them up with lower left at 0,0 just for simplicity yours is at -177, 2.9 re read at an exact point. Re 1st line in csv is header not a problem so long as always produced that way its a 50/50 question. For me leave in just do a dummy read 1st line. If you can find time to do into a block lower left 0,0. Can provide some code. Thanks for ur kind reply but it not possible to now to make it as a attribute block...anyway i will done it manually thanks all for help.... Quote
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.