Author Topic: Insert every time  (Read 4755 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
Insert every time
« on: April 25, 2008, 11:18:40 AM »
Is there a way to automagically load a drawing or template every time i open a drawing?


Edit: Inert -> Insert
M-dub
« Last Edit: April 25, 2008, 11:35:08 AM by M-dub »

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Inert every time
« Reply #1 on: April 25, 2008, 11:28:06 AM »
Yes.

Checkout: files that automatically load when a drawing is opened
acaddoc.lsp
custom.mnl
startup suite

Add code in one of these drawing to:
check to see if the block exists.
insert if not.

see?
James Buzbee
Windows 8

Crank

  • Water Moccasin
  • Posts: 1503
Re: Insert every time
« Reply #2 on: April 25, 2008, 01:03:14 PM »
If you want to do this to update blocks: That doesn't work, because the blocks are already defined.
If you want to redefine blocks you need to make wblocks and insert them one by one.
Code: [Select]
(command ".insert" "your_block=" (command))
Vault Professional 2023     +     AEC Collection

Luke

  • Guest
Re: Insert every time
« Reply #3 on: April 25, 2008, 01:10:12 PM »
We have created a new drawing template.  I want my guys to use it.  If they start a new drawing they start with the template. Easy enough.

But if they go into an old drawing they continue using all the old crap that is in there and forget about the new template.  I could easily enough creat a button that they can click to load the new template into the old drawings.  They problem is they won't do it.

So what I am trying to do is figure out a way that regardless of brand new, 1 week old, 2 years old or sent to us by an outside source, when they open a drawing it will have all the layers, line types, blocks, etc, etc as what they will see and use in our typical drawing template.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Insert every time
« Reply #4 on: April 25, 2008, 01:54:13 PM »
Why not take advantage of 2006's Standards plug-in?  You can set it to automatically run when a drawing is opened and fix table stuff like Layers, Textstyles, Dimstyles, etc.
James Buzbee
Windows 8

Luke

  • Guest
Re: Insert every time
« Reply #5 on: April 25, 2008, 02:06:48 PM »
I don't want the warning, prompts, questions, notifications, etc etc.  If they realize it is happening they'll turn it off and back to the original problem.

deegeecees

  • Guest
Re: Insert every time
« Reply #6 on: April 25, 2008, 02:19:03 PM »
Locate your acaddoc.lsp, and append this to it. You'll have to change the "name_of_your_template" to what ever your templates name is.

Code: [Select]
(setq template_setup (ssget "X" '((2 . "name_of_your_template"))))
    (if is4lnatt
        (princ)
        (command "-insert" "name_of_your_template" "0,0" "1" "" "")
    )
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Insert every time
« Reply #7 on: April 25, 2008, 03:25:38 PM »
Maybe this
Code: [Select]
(if (null (ssget "X" '((2 . "name_of_your_template"))))
  (command "-insert" "name_of_your_template" "0,0" "1" "" "")
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

deegeecees

  • Guest
Re: Insert every time
« Reply #8 on: April 26, 2008, 09:54:38 AM »
Fixed a variable I overlooked...

Code: [Select]
(setq template_setup (ssget "X" '((2 . "name_of_your_template"))))
    (if [color=red]template_setup[/color]
        (princ)
        (command "-insert" "name_of_your_template" "0,0" "1" "" "")
    )
)

Luke

  • Guest
Re: Insert every time
« Reply #9 on: April 28, 2008, 08:20:47 AM »
I don't like modifying the out of the box acad items.  Then I have to do it on every machine, and if we have to reinstall than I have to remember to re-do it on that machine.  So we have our lisp and other custom files that we run off the server.  I want to run this off the server with one of our other lisps that currently load on startup.

I have added it to such file but no luck.  Is there additional cod that needs to come before this to help make it work?

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Insert every time
« Reply #10 on: April 28, 2008, 08:26:28 AM »
I don't think you can change the template of a drawing when you load an existing drawing, however, you can do it on new drawings.
Now, if you want to make the settings in the new drawing fit a specified setting in a particular template, you can set each of the variables, load specific linetypes, setup textstyles, and adjust layers to fit your needs, however it isn't as simple as inserting an existing template.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Luke

  • Guest
Re: Insert every time
« Reply #11 on: April 28, 2008, 08:31:15 AM »
to create a template I have to first create a drawing.  I have a dwg file saved and a dwt file saved.  Can I not just insert that dwg file?

deegeecees

  • Guest
Re: Insert every time
« Reply #12 on: April 28, 2008, 08:55:04 AM »
I want to run this off the server with one of our other lisps that currently load on startup.

I have added it to such file but no luck.  Is there additional cod that needs to come before this to help make it work?

Take a look at your support file structure, and see if the file that you put the code into is loading first. You may want to move the path of the to the top of the list in Options/Files/Support File Search Path. Or am I not getting your intent?

Luke

  • Guest
Re: Insert every time
« Reply #13 on: April 28, 2008, 09:09:29 AM »
I think you are totally getting my intent. 

Here is what I'm getting when I try what you have suggested...

AutoCAD menu utilities loaded.-insert
Enter name of customization file to load: LCC_ANNOTATION
Enter name of customization file to load: 0,0
Enter name of customization file to load: 1
Enter name of customization file to load:
Enter name of customization file to load:
Enter name of customization file to load:
Enter name of customization file to load:
Command: *Cancel*

deegeecees

  • Guest
Re: Insert every time
« Reply #14 on: April 28, 2008, 09:12:41 AM »
Some questions that will clear things up:

1. What file did you insert the code?
2. How is this file being loaded?