AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Auto Generating the "Drawing" portion in the "Sheet Values" of Drawing Props

6 REPLIES 6
Reply
Message 1 of 7
afh_98
655 Views, 6 Replies

Auto Generating the "Drawing" portion in the "Sheet Values" of Drawing Props

I've read conflicting opinions on this topic, and though it seems like it should be possible - I need help (if it is possible). I am capable and know just enough to be stubbornly mislead...Smiley Frustrated

 

My intent is to write a script that can be run via the "Project-wide utilities" for each drawing in a project. I thought the script could just edit the block "WD_M" within each drawing, setting the "sheetdwgname" attribute equal to the "dwgname," but am unsure how to achieve it.

 

From reading the discussion group, I've learned the following: 

 

I can get the results I want (drawing file name with no extension) by inserting a field into MTEXT: %<AcVar Filename\f "%tc1%fn2">%

However, I can't get the equivalent into a script.

 

I've also read that this script - (c:wd_modattrval (ssname(ssget "X" (list (cons 0 "insert")(cons 2 "WD_M"))) 0) "SHEETDWGNAME" "NEW VALUE" 1) - will set the "sheetdwgname" to "NEW VALUE," so I would think that I could somehow merge the two concepts.

Again, however, I've had no success. Is this even possible?

 

Oh - I am running AcadE2009.

Thanks for any help/advice,


Adam

6 REPLIES 6
Message 2 of 7
Icemanau
in reply to: afh_98

Why are you trying to write a script to do something that ACADE already has.

 

If your title block is set up correctly, the Title Block Update function can change the file name for you. It even gives you the option of just the filename, the file name and extension or the full path, file name & extension.

 

This can be applied to either the active dwg or selected dwgs in the project.

 

Or you can do as I've done and have the file name field inserted into the title block. This then automatically keeps track and changes the file name every time the file is saved or what ever your Field Update Settings are.

 

Regards Brad

>

Brad Coleman, Electrical Draftsman
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 3 of 7
rwydesk500
in reply to: Icemanau

Ah ha! So there IS someone still using fields while creating drawings with AutoCAD Electrical. Have you ever found a case where the fields conflicted with what AutoCAD Electrical was doing. In my limited knowledge of things, so far, it seems that might be possible. Maybe I'm just overly fearful in my ignorance.Smiley Wink

Regards,

Rick Yoerger

AutoCAD Electrical 2016
Message 4 of 7
afh_98
in reply to: Icemanau

My intent is to have the %D for each drawing automatically match the file name of the drawing (minus the file extension). At this point I have been unable to do this using the title block features you mention.

My ultimate goal is custom source/destination arrows with references as "Line %N, DWG. %D". It works while manually changing the %D value for each drawing, but I wanted to automate that step, so no matter what the file name changes to, it can easily be updated.

 

 

Thanks,

 


Adam

Message 5 of 7
PatMurnen_Adsk
in reply to: afh_98

This can be accomplished with a combination of a lisp and script file. The lisp function assigns the drawing name to the attribute on the WD_M block. The script file calls the lisp function. Then you can use the Project-Wide Utilities to run the script on the drawings across the project.

 

I've attached a first pass at the lisp and script for you to try. I would make back up copies of the test drawings.

 

For this to work the lisp function needs to be auto-loaded every time a drawing is opened. This can be accomplished doing the following:

1. In AcadE type APPLOAD

2. In the lower right in the Startup Suite area select the Contents button.

3. Click Add on the Startup Suite dialog.

4. Browse to the lisp file, select it, and Open.

5. Close all dialogs.

 

Now you are ready to try it.

1. Run the Project-wide Utilities

2. Pick Run command script file

3. Browse to the .scr file

4. OK, pick the drawings to process.

 

Hope this helps,

 



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 6 of 7
Icemanau
in reply to: rwydesk500

This function does not interfere with the electrical functions at all. The only other fields I use actually duplicate attributes that are set by the Title Block Update.

 

Specifically the Project number, Drawing Number and sheet number.

 

Regards Brad

>

Brad Coleman, Electrical Draftsman
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 7 of 7
rwydesk500
in reply to: afh_98

Thanks for more detail on that Brad. The ability of my title blocks to automatically update the drawing number based on the filename, through the use of fields, has been a huge help when dealing with hundreds of drawings in a project where the client has changed their mind a few times as to what the drawing filename/drawing number format will be.

 

Also, your response has led me back to this thread where I just saw something I previously missed in Pat's response. I think it deserves another thread - "Batch Scripting Drawings in AutoCAD Electrical".

Regards,

Rick Yoerger

AutoCAD Electrical 2016

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost