Author Topic: Moving drawing to new template ...  (Read 5536 times)

0 Members and 1 Guest are viewing this topic.

Hangman

  • Swamp Rat
  • Posts: 566
Moving drawing to new template ...
« on: January 15, 2011, 10:59:12 AM »
Good morning everyone.

I have about two hundred drawings that are in need of a major facelift.  We outsourced the project and the company went and used the wrong titleblock, text style, dim style, etc.  Now they claim they did as was instructed and won't fix the package unless they are paid +some for extra time.  Needless to say, we won't be using them again.
Unfortunately, we have two hundred plus drawings we now need to fix.

So in a nutshell, I've been writing a routine that will save the drawing as an original (DrawingName.orig.dwg), then clean up the drawing; take out the old titleblock, change the text style, dim style, etc.
My intention here is to copy everything to the clipboard, open up our template, save it as the drawing file name, paste everything from the clipboard and woalla, we have a clean drawing.

I know I can't run the same LiSP on two different drawings, so I wrote two LiSP's and a VBScript (which was fun 'cause I haven't written one in over a year) to complete this task.

I would prefer having the drawing on a clean template so we won't have to deal with the all the extra text styles, dim styles, and the miscellaeous crap from the outsourced company.
On my way home I started thinking about it some more and I feel there is a better way of doing this, but I can't see it.  I'm using two commands; CopyBase & PasteOrig to copy to the clipboard and paste in the new template.  They work, but I would prefer something else.  Also, I don't care for the idea of a LiSP to run a script to open a template to then run a second LiSP to finish the project.   :|

I have the code at my office PC, so I can't post any yet as I'm not there but when I get back I'll do so.
In the mean time, can you all give me some suggestions and idea's as to a best way to accomplish this task?

Thank you all very much.

[edited] forgot to mention, I'm running Map3D 2010 & 2011 if this info is pertinent for your thoughts.  Thanks.
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #1 on: January 15, 2011, 11:12:41 AM »
Offer:

Send me 5+/- buggered drawings, and then the same fixed up to your satisfaction; then another 10 representative buggered drawings as well as your specs / description of problem and solution.

I'll analyze 'em and see if I can come up with a practical strategy / program / batch wrapper to process the whole lot. I've done tons  of batch processing.

Complete confidentiality on everything.

Cost:

Nothing. I'm unemployed. It will give me something useful to do aside from my python course. Down the road there may be some way you can reciprocate.

No worries:

If this doesn't appeal to you for whatever reason feel no obligation to accept the offer.

Maybe:

The swamp could pioneer something along the lines of 'pragmatic bartering'.  :lol:

Just heading out now, so don't interpret my radio silence as me being non responsive.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Moving drawing to new template ...
« Reply #2 on: January 15, 2011, 11:43:15 AM »
why not use the drawing standards tools to swap out the bad text styles and dimension styles?
then run a script to replace the bad titleblocks with the good one and keep the attribute values?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

pBe

  • Bull Frog
  • Posts: 402
Re: Moving drawing to new template ...
« Reply #3 on: January 16, 2011, 12:46:51 AM »
What about after redifining Text/Dim Stlyes and the titleblock (pragmatic of course)

issue a wblock, something like this


Code: [Select]
(defun c:test ()
(setq doc (vla-get-activedocument (vlax-get-acad-object))
      nm    (strcat (substr (vla-get-fullname doc) 1 (- (strlen (vla-get-fullname doc)) 4)) "Fixed"))
  (repeat 4
  (vla-purgeall doc)
 )
(command "-wblock" nm "*")  
)

That way it will still include Layout tabs
will that work?

 :|


« Last Edit: January 16, 2011, 01:01:57 AM by pBe »

Hangman

  • Swamp Rat
  • Posts: 566
Re: Moving drawing to new template ...
« Reply #4 on: January 17, 2011, 01:57:18 PM »
why not use the drawing standards tools to swap out the bad text styles and dimension styles?
then run a script to replace the bad titleblocks with the good one and keep the attribute values?
We are pretty much using the standards tools now, it's just a slow process and I want to automate it.
The real problem is the title block, the outsourced company either dropped in a block and then added Text to the information area (meaning the info is DText objects, not part of the block), or they dropped in the title as an attribute block, but then exploded it and simply added the info to the now exploded attribute text objects that were there.  So the script idea doesn't really work.  Although I'd like to see a script where we could keep the attribute values from an old title block if you have one available.

Quote from: pBe
What about after redifining Text/Dim Stlyes and the titleblock (pragmatic of course)
issue a wblock, ...
That way it will still include Layout tabs
This is a thought, I hadn't thought of wblocks to save the Layout tabs.  I'll look into this more, Thank you.

Quote from: MP
Offer:
Send me 5+/- buggered drawings, ...
Thanks Michael, it's a very tempting offer but unfortunately I do not have the authorization to send them out.  I do appreciate the offer though.
By the way, where do you live and do you know ArcGIS ?
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #5 on: January 17, 2011, 08:13:08 PM »

Thanks Michael, it's a very tempting offer but unfortunately I do not have the authorization to send them out.  I do appreciate the offer though.
By the way, where do you live and do you know ArcGIS ?

No problem + You're welcome + About 14 hours north of Salt Lake City + Unfortunately no.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Hangman

  • Swamp Rat
  • Posts: 566
Re: Moving drawing to new template ...
« Reply #6 on: January 18, 2011, 05:47:28 PM »
... About 14 hours north of Salt Lake City ...

Well, ... hmmm, ... I can't help you much in terms of work then, Sorry.   Hang in there though, someth'n will happen.

[edited]  ...  and No, God won't smite you for choosing the wrong religion.  Although, if you ask Him, I'm sure He'll tell you which one is right.   ^-^
« Last Edit: January 18, 2011, 07:33:24 PM by Hangman »
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #7 on: January 19, 2011, 08:25:34 PM »
Well, ... hmmm, ... I can't help you much in terms of work then, Sorry.   Hang in there though, someth'n will happen.

:) Accepted a great offer today, start Monday. :)

...  and No, God won't smite you for choosing the wrong religion.  Although, if you ask Him, I'm sure He'll tell you which one is right.   ^-^

do you have his contact info?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Moving drawing to new template ...
« Reply #8 on: January 19, 2011, 08:43:23 PM »
:) Accepted a great offer today, start Monday. :)

Congrats are in order so that means MP is buying!   :-D
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #9 on: January 19, 2011, 08:52:58 PM »










Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving drawing to new template ...
« Reply #10 on: January 19, 2011, 08:57:06 PM »
< .. >
do you have his contact info?

you mean her information, yes ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #11 on: January 19, 2011, 08:58:35 PM »
lol, I swear I was going to phrase it that way and knew you would approve :D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Hangman

  • Swamp Rat
  • Posts: 566
Re: Moving drawing to new template ...
« Reply #12 on: January 21, 2011, 04:37:51 PM »
Quote from: Kerry
you mean her information, yes ?
Nope!  HIS information.
Quote
1. The words of God, which he spake unto Moses at a time when Moses was caught up into an exceedingly high mountain,

2. And he saw God face to face, and he talked with Him, and the glory of God was upon Moses; therefore Moses could endure His presence.
 < .. >
  From the Exodus


< .. >
do you have his contact info?
Ahhh, found it.  Here it is:
Quote
5. If any of you lack wisdom, let him ask of God, that giveth to all men liberally, and upbraideth not; and it shall be given him.
6. But let him ask in faith, nothing wavering. For he that wavereth is like a wave of the sea driven with the wind and tossed.
  James 1:5

And that my friends, is the way of it.

But let's not digress, I need more help with this issue.

So my LiSP routine calls the script and the script is suppose to open a new file and run another script to finish the process.
The problem I am having is the first LiSP repeats itself and the command from the script is unrecognized.
(from text window)
Quote
< .. >
Command:
Copying everything to Clipboard ... .copybase Specify base point: 0,0,0
Select objects:   9934 found

Select objects:
Command:        So, everything is copied
Resetting System Variables ...
Ending UNDO & Making an UNDO mark ... .undo Current settings: Auto = On,
Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: End
Command:
Command: .undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: Mark
Command:
Command: .undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: Auto
Enter UNDO Auto mode [ON/OFF] <On>: Off
Command:                The system variables have been reset
Command:
Running Script ... _.script
Enter script file name <K:\EFM\documents\5N15B-2_orig.scr>: K:\Stations ...\Support\LiSP\FixDWG.scr
Command:
Closing Drawing & ending function ... nil

Command:        LiSP is restarting
FIXDWG .undo Current settings: Auto = Off, Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: Mark
Command:
Command: .undo Current settings: Auto = Off, Control = All, Combine = Yes, Layer = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] <1>: BEgin
Command:
Command:
Setting Drawing Type ...
Drawing type?  'E'lectrical, 'P'iping, 'C'ivil, 'I'nstrumentation, or 'M'odel:
Delay            I have a delay at the beginning of the script file (code below)
Invalid option keyword.

Drawing type?  'E'lectrical, 'P'iping, 'C'ivil, 'I'nstrumentation, or 'M'odel:
 < .. >

Code: [Select]
;****************************************************************************
;Script Name: FixDWG.scr
;Author:      
;Created:     01/17/2011
;Description: This script automates the execution of the FixDWG LiSP routine.
;****************************************************************************
Delay
1200
Filedia
0
New
"K:\Stations & Facilities\SALT LAKE CITY\Borders\NWP.dwt"

Delay
1800
(FixDWG_Part2)


I can't figure out why the LiSP is repeating itself after the drawing closes and the script doesn't run.

Here's the code for the LiSP (well, part of it, it's 1800 lines):
Code: [Select]
< .. >
  (ChangeZeroLengthArcs)
  (CopyAll2Clipboard)
;; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
;; Reset System Variables
  (prompt "\nResetting System Variables ... ")
  (setq NWP_acadLTs nil
        LTnotePath nil
        FNnotePath nil
  )
  (setvar "autosnap" origASN)
  (setvar "osmode" origOS)
  (setvar "filedia" origFDia)
  (setvar "cmdecho" origEcho)
  (prompt "\nEnding UNDO & Making an UNDO mark ... ")
  (if (= (eq 8 (logand 8 (getvar "undoctl"))) T)
    (command ".undo" "End" ".undo" "Mark" ".undo" "Auto" "Off")
  )
  (prompt "\nRunning Script ... ")
  (command "_.script" ScriptPath)
  (princ)
  (prompt "\nClosing Drawing & ending function ... ")
;  (command ".close" "Y")  [color=red]I had to comment this out so I could catch the feedback in the text window.[/color]
) ; _function FixDWG
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LE3

  • Guest
Re: Moving drawing to new template ...
« Reply #13 on: January 21, 2011, 05:29:01 PM »
:) Accepted a great offer today, start Monday. :)

Kudos ! and good luck sir.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving drawing to new template ...
« Reply #14 on: January 21, 2011, 06:49:39 PM »
:) Accepted a great offer today, start Monday. :)

That is really great news Michael ....  well done !!
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Moving drawing to new template ...
« Reply #15 on: January 21, 2011, 06:54:20 PM »
  From the Exodus
< .. >

<.. >
But let's not digress,

good suggestion ... lets keep that sort of digression in the social forums, not the technical forums.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: Moving drawing to new template ...
« Reply #16 on: January 21, 2011, 06:56:27 PM »
  From the Exodus
< .. >

<.. >
But let's not digress,

good suggestion ... lets keep that sort of digression in the social forums, not the technical forums.

Ditto since not everyone's views are the same.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Moving drawing to new template ...
« Reply #17 on: January 22, 2011, 12:44:04 AM »
That is really great news Michael ....  well done !!

Kudos ! and good luck sir.

Thank you Kerry and Luis. Looking forward to it.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst