Jump to content

Lisp routine use csv to update title block attributes - on ctab


HRae

Recommended Posts

We'll get there but I mustn't be understanding this part correctly, so we'll have to go back a step.

 

The image I've attached is of the csv file. Where I've circled is where the program will stop because the first item in the line is the drawing name (plus as I understand it, the layout name) . If this is incorrect and the item does not include the layout name can you indicate where in this image is the layout name found?

 

FYI. CTAB = The Current Tab that autocad is actively viewing, not multiple layouts/tabs.

temp csv.jpg

Link to comment
Share on other sites

  • Replies 116
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    31

  • HRae

    26

  • SteveK

    17

  • johmmeke

    15

Top Posters In This Topic

Posted Images

Hi Steve,

 

No you aren't missing anything, I also went back to a basic xls/csv file where the xls columns are the block attributes in the drawing. I created a layout tab when first looking to modify the lisp routine, but realised that the lisp wasn't looking at that.

 

So back to first principles, the basic block attribute information is put into xls, then the xls collates the project number, stage and sheet number to create the .dwg file that the lisp routine looks for (my guess).

 

I don't know the sequence of the lisp routine, meaning from the csv, does it collect the information to create/determine the .dwg file then tells it to update the attributes. I think this is where it is getting lost as if the routine specifically looks for a .dwg file then those with two or more layouts won't actually have a .dwg file.

 

Not sure, at least I'm not in a rush.

 

Once again thanks for taking the time to help.

Would you need to use something like this in your line of work?

 

To answer your question (I think) the xls title column "drawing_no" is the 3 digit number of the sheet, when in Autocad the layout tab is renamed to match this ie 002 and the .dwg is this also. So in essense, the drawing_no is also the layout tab.

Hope this makes sense.

 

Heather

Link to comment
Share on other sites

Gday Heather,

 

Ok. :) Well I think there's a bit of conflict as to which column is the layout name column. Test_Document Control.csv has DRAWING_NO (column G or 7).

 

Then I checked another one of the other csv's you've posted, 2118876 Document Control.csv and it doesn't have a column titles DRAWING_NO but it does have a column titled LAYOUT (column E or 5).

 

If you want autocad to always find the layout name it needs to be either a unique column title that is common to all csv files or it needs to always be in a particular column. If this needs to happen can someone at your work modify your "Write CSV" code in your xl files? If not perhaps you could try get someone to edit it in a vb forum. How much do you want this? 8)

 

As for if I would use this at my work, at my current work I don't think so, but I'm sure if we got something quality working people could use it. If...

 

Steve

Link to comment
Share on other sites

Hi Steve,

 

I'm starting to wonder if it is worth it all. :roll: :oops:

 

Ok, we will fix the layout to match the drawing number in the xls, this means it will be column D.

 

All I ask is that you can show me where the lisp routine looks for this information, so that in the future if we develop the xls spreadsheet and the column changes, then I can modfify the lisp.

 

Thanks again for your help.

 

Kind regards

Heather

Link to comment
Share on other sites

I'm starting to wonder if it is worth it all. :roll: :oops:

 

Ok, we will fix the layout to match the drawing number in the xls, this means it will be column D.

 

All I ask is that you can show me where the lisp routine looks for this information, so that in the future if we develop the xls spreadsheet and the column changes, then I can modfify the lisp.

Yeah it becomes a fair bit of effort when a common template isn't used. If it's too much effort to streamline your xls/csv files then I wouldn't bother with the lisp either.

 

I'll let you know when I change the lisp how to change the column.

 

Column D, ok. When you get a csv with the layout names in column D can you post it with the associated drawing? (for testing)

Link to comment
Share on other sites

Hi Heather,

 

I have an update, try it out, I hope it works for you.

 

I've written this from the ground up, below is the header from the file which I hope explains things.

If it doesn't make sense, what you just need to be concerned with is the value of the variable layoutNameCol. At the moment it is set to 6, which is correct for the csv that corresponds to drawing 4431-21-002.dwg. Note for that particular drawing the layout names are not preceded with 00 in the csv as they are in the drawing so you will have to add those 00's into the csv for that particular drawing for this to work. (I'm not sure if that is common for all your drawings??)

layoutNameCol is the value of the column of the layout name, so you can easily change that if necessary. To change, look for CSV Specific Preferences in the lisp, it is just below that.

If you need further explanation don't hesitate to contact me. :)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;                                                                              ;;
;;      Import Attributes from CSV File                                         ;;
;;                                                                              ;;
;;      Type "CSV2ATTS" to run.                                                 ;;
;;                                                                              ;;
;;      Description:                                                            ;;
;;         Gets attributes from a CSV file and imports to                 ;;
;;        attributes.                                                     ;;
;;         Rules as follows:                                              ;;
;;        - Attribute names are contained in the first row of             ;;
;;          CSV file.                                                     ;;
;;        - Subsequent rows are checked for;                              ;;
;;          Drawing Name (column # determined by variable dwgNameCol),    ;;
;;          Layout Name (column # determined by var layoutNameCol),       ;;
;;          Block Name (column # determined by var blkNameCol).            ;;
;;                Note all variables are optional.                              ;;
;;        - If block is found to meet these criteria then a search is     ;;
;;          made for attribute tags found in first row, replacing if      ;;
;;          found.                                                        ;;
;;                                                                              ;;
;;      ------------------------------------------------------------------      ;;
;;      Eg.                                                                     ;;
;;                                                                              ;;
;;       Current Drawing Name is ABC.dwg and contains layout names lay1 & lay2.    ;;
;;      Variables set to:                                                       ;;
;;            dwgNameCol = 0                                                    ;;
;;            layoutNameCol = 2                                                    ;;
;;            blkNameCol = nil                                                  ;;
;;                                                                              ;;
;;      Example CSV File:                                                       ;;
;;       Drawing_Name,Rev_No,Layout_Name,Drawn_By                               ;;
;;       ABC,1,lay1,SteveK                                                      ;;
;;       DEF,2,lay1,SteveK (this row will be ignored)                           ;;
;;       ABC,4,lay2,JSmith                                                      ;;
;;                                                                              ;;
;;      Output:                                                                 ;;
;;       Attributes on layout "lay1":                                           ;;
;;            with tag "Drawing_Name" will be changed to "ABC",                    ;;
;;            with tag "Rev_No" will be changed to "1",                            ;;
;;            with tag "Layout_Name" will be changed to "lay1",                 ;;
;;            with tag "Drawn_By" will be changed to "SteveK",                  ;;
;;      Attributes on layout "lay2":                                            ;;
;;            with tag "Drawing_Name" will be changed to "ABC",                    ;;
;;            with tag "Rev_No" will be changed to "4",                            ;;
;;            with tag "Layout_Name" will be changed to "lay2",                    ;;
;;            with tag "Drawn_By" will be changed to "JSmith",                    ;;
;;      ------------------------------------------------------------------      ;;
;;                                                                              ;;
;;      Version:                                                                ;;
;;            1.0   Initial Release.                                            ;;
;;            1.1   Variables dwgNameCol & layoutNameCol made optional.         ;;
;;                                                                              ;;
;;      ------------------------------------------------------------------    ;;
;;                                                                              ;;
;;      Copyright © steve.k, November 2009.                                     ;;
;;      SteveK can be contacted @ CadTutor.net, theSwamp.org                    ;;
;;      Permission to use, modify, and share this program                       ;;
;;      is granted, provided copyright notice is included.                      ;;
;;                                                                              ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

v1.1

CSV2ATTS.lsp

Link to comment
Share on other sites

Hi Steve,

 

Work is really busy at present, so I haven't had time to look at this. Hopefully over the next week I can run a test and let you know the outcome.

 

Thanks

Heather

Link to comment
Share on other sites

  • 4 months later...

Hi there

 

Paul Frylink here

Just stumbled upon this thread - very interesting where your code ends up...

That is quite an old version of update.lsp at the beginning of this thread!

 

I never did publicly release it, but I guess with the number of joint ventures going on here in Brisbane, systems become public property by default.

Link to comment
Share on other sites

lol, hope you're not too mad about it, excel-to-cad is a common request on this forum.

 

ps. maybe you can help Heather if she is still around and my lisp I made for her didn't work... :)

Link to comment
Share on other sites

Hi there Paul and Steve,

 

Paul from my work experience I think that your original lisp is being widely used around many offices and companies. Had I known how to contact you personally, I wouldn't have posted this.

I still haven't been able to have it amended to read layout tabs.

I have also given up on it being acheivable.

 

Steve - thanks again for all your effort with getting this to work.

Link to comment
Share on other sites

Interesting!

 

A bit of history - I first developed the link between AutoCAD and Excel (update.lsp) when I was working with Maunsell in the Philippines in 1999. A large team of drafters were producing lots of drawings - consistency with title blocks was an issue. I came up with this system to feed the information from the drawing list we had in Excel through to AutoCAD attributes.

I have continued to develop the system in the ensuing years, to the point now where it has many bells and whistles – such as inserting blocks, attaching xrefs filling in tables or even run other lisp files all from the master spreadsheet. Data can also be exported in the form of Transmittals, drawing lists for insert onto drawings or text files for upload to Doc control systems. We have a reactor setup when AutoCAD starts which automatically triggers update to run on any save event.

We (AECOM – nee Maunsell) also use systems such as Bentley’s ProjectWise for drawing control, but it is hard to go past the simplicity of a spreadsheet for managing our drawings

Link to comment
Share on other sites

Yes, I think at my last company the lisp routine was set up in the way you mentioned, funny that I haven't worked for Maunsell, yet that is where you are based. I first came across the system some 6 years ago and from the looks of it, it hasn't been modifed in any way.

This being your original work, and since you are a guru as the lisp routine, I was using it in the way you say, spread sheet linking to the title block etc, doing dynamic updating, out putting to another sheet for transmitals...The orginal collated the spreadsheet information to create the 'autocad drawing file' that the lisp routine looked for first (my basic understanding). are you aware of anyway to modify either the spreadsheet or lisp to make it look for a layout tab instead????

Basically I have a working version of your old one....but can it be modified to read both the autocad drawing and then the layout tab? I'm more curious now if this is possible or not, as opposed to make it work for where I'm currently working.

 

Heather

Link to comment
Share on other sites

Heather

 

Checking for current layout name (CTAB) while updating the attributes should be achievable, but currently working 50+ hours/wk on a tender design.... so no time to play.

 

I might add my 2 bobs worth though - my personal view - simply for file management and document control, I believe 1 drawing per physical DWG is safest!

Link to comment
Share on other sites

Paul,

 

I agree with you with one drawing, however my current place of work doesn't have the same opinion. I have also moved to a smaller company and they don't have the size of projects that I used to work on.

 

As mentioned earlier, i had given up on the ctab working, so if you get to have a look in the next 4 months or so, then that would be great. It has been 6 months or more since the idea of using ctab came about.

 

Tenders....hmmm great things they are. Have fun! :)

 

Heather

Link to comment
Share on other sites

  • 7 months later...

Hey all, maybe a little to late, but is somone stil working on this?

 

I have same proble as Heather did.

How do i setup my excel for the csv? or an example?

 

Thanks John

Link to comment
Share on other sites

Hi John,

 

This still hasn't been resolved. The only way that this lisp routine works (at the moment) is to have one ACAD file for one drawing sheet.

 

If you have your files set up like this then I can walk you through how the lisp routine works.

 

Heather

Link to comment
Share on other sites

Hey Heather,

 

Great to hear from you. So it is stil not possible to have one list with mutiple drawings and update that way?

 

Can you explane just how to setup my drawings. At the moment i have it so that one drawing has 4 layouts en contains 2 block's.

The blocks use almost the same attribute's, so they can be used for by the 2 block's (same value in both block's).

 

Greats John (sorry for bad enghlis)

Link to comment
Share on other sites

Hi Guys,

 

I haven't read the whole thread, but what is the overall goal of the routine, and what are the issues you are having?

 

From the few posts I have read, perhaps this may assist you?

 

Lee

Link to comment
Share on other sites

Lee,

 

Background - drawing title sheets that have text block attributes, use an excel spreadsheet to manage title block, revisions etc information. This is then converted into a csv file that the lisp routine reads. The lisp routine has been written to look for the ACAD drawing file and then fill in the text block attribute information. As the lisp routine first looks for the ACAD file, when layouts are used, there are 2 (or more) blocks in the drawing and therefore the lisp routine only fills in data of the first block. Also as the lisp routine first looks for the ACAD file name (which is the drawing number) it can't cope with layouts and therefore technially 2 drawing files.

 

The spreadsheet and lisp routine doesn't follow any particular excell cell, is it defined by the block attribute code. So modifing the lisp routine to look for a particular cell to determine the layout (ctab) isn't viable.

 

Is is basically a 'attsin' proceedure but has trouble when mulitple blocks are used.

 

John - if Lee has a solution for the ctab option, then telling you how to set up your drawing file, excel spreadsheet etc for individual files will be redundant.

 

Lee - if you have any ideas that would be great.

 

Heather

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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