Author Topic: Insert every time  (Read 4756 times)

0 Members and 1 Guest are viewing this topic.

Luke

  • Guest
Re: Insert every time
« Reply #15 on: April 28, 2008, 09:14:57 AM »
1. I inserted the code through a file called Luke.lsp
2. It is inserting through the startup suite, with the path for it being the very first thing in the support path.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Insert every time
« Reply #16 on: April 28, 2008, 09:21:10 AM »
This will add some error checking.
Code: [Select]
(cond
   ((ssget "X" '((2 . "LCC_ANNOTATION")))
     (prompt "\nFile exist in drawing.))
   ((setq file (findfile "LCC_ANNOTATION"))
     (command "-insert" file "0,0" "1" "" ""))
   ((princ "\nError - Could not find file LCC_ANNOTATION"))
)
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.

CADaver

  • Guest
Re: Insert every time
« Reply #17 on: April 28, 2008, 09:26:24 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.
Looks like it's not finding the file to insert, check the path and name.

You know the files you're talking about above can be located on the network (and read from there) so you need only change it once for everyone?  Makes life a whole lot easier for me.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: Insert every time
« Reply #18 on: April 28, 2008, 09:28:20 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?
Yes you can, however, any settings in the current drawing will not be overridden. i.e. lets presume you have a layer called "stuff" this is what it might look like in the current drawing:
Quote
layer = stuff - linetype = dashed - lineweight = 0.01 - color = yellow - plot = true
then you decide that it no longer suits your purposes, so you change the template to:
Quote
layer = stuff - linetype = dashed2 - lineweight = 0.02 - color = green - plot = true
If you insert the template (or other drawing) it will have no effect on the current settings. The same holds true for textstyles, dimension styles, and system variables. i.e. inserting a drawing will have no effect on the current drawing as the inserted drawing will take on the properties already existing in the open drawing.

You will have to programmatically change the settings by loading a lisp in the acaddoc.lsp or other startup mechanism.
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

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Insert every time
« Reply #19 on: April 28, 2008, 09:29:13 AM »
we added this to the company startup lsp. it creates all of our dimension settings, etc.

Code: [Select]
(defun imdim ()
(progn
(command "-insert" "mbc-dimsetup.DWG" nil)
(command "-purge" "b" "mbc-DIMSETUP" "n")
(prompt "\nMBC DimStyles Successfully Loaded!")
)
)
(imdim)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

deegeecees

  • Guest
Re: Insert every time
« Reply #20 on: April 28, 2008, 09:32:34 AM »
This will throw a status to the command line for checking purposes:

Code: [Select]
(defun luke_temp_ins ()
(if (null (ssget "X" '((2 . "name_of_your_template"))))
  (progn
    (command "-insert" "name_of_your_template" "0,0" "1" "" "")
    (princ "\nTemplate loaded.")
  )
    (princ "\nTemplate already resides in dwg.")
))
(luke_temp_ins)

Luke

  • Guest
Re: Insert every time
« Reply #21 on: April 28, 2008, 09:49:07 AM »
Yes my file is on the server.  I just don't like the idea of messing with anything from the box.  All my custom files have a prefix so they can be easily recognized as ours.

I have tried all the suggestions below, they all seem to not put the file into my drawing.

This is what they all result in in the F2 text box...
Quote
Enter name of customization file to load: LCC_ANNOTATION.dwg

I'm not putting in a customization file, i'm inserting a drawing??

deegeecees

  • Guest
Re: Insert every time
« Reply #22 on: April 28, 2008, 10:01:40 AM »
Put the code in one of the files that you KNOW are loading.

BTW, there are better ways to achieve what you are trying to do.

Luke

  • Guest
Re: Insert every time
« Reply #23 on: April 28, 2008, 10:04:28 AM »
As I try to debug here is what I'm getting...

If I put the lisp and path in my startup suite it does not load the drawing, even though it shows up in the loaded applications tab.

If I manually load the appliaction it does insert the drawing.

I am interested in the better way, I'm just limited in my ability.

Luke

  • Guest
Re: Insert every time
« Reply #24 on: April 28, 2008, 10:11:15 AM »
Saying I am limited in my abilities is an accurate statement, but not applicable.  I guess I was just thinking it would be easy to write a quick little lisp," _Insert" "LCC_ANNOTATION.dwg" "0,0" "1" "" "" , add it to the startup and make sure my support path was correct and poof there you go all good.

Better to say at this point in addition to my limited abilities, my knowledge types of customization and ways to do the customization are significantly lacking.

deegeecees

  • Guest
Re: Insert every time
« Reply #25 on: April 28, 2008, 10:24:33 AM »
If you don't want to modify anything from AC's original state, you are a bit limited to what you can do, however if you feel you can think outside the box *yes, I said it, and all puns are intended*, then you'll be able to achieve a more rigid set of standards.


Luke

  • Guest
Re: Insert every time
« Reply #26 on: April 28, 2008, 10:40:00 AM »
I'm willing to give it a try.

I'm typically pretty head strong and stubborn as to what I want to achieve but I'm flexible on how to get there.

deegeecees

  • Guest
Re: Insert every time
« Reply #27 on: April 28, 2008, 11:13:20 AM »
Here's something to muck around with:

http://www.theswamp.org/index.php?topic=19044.msg232055#msg232055

Using the method mentioned in the link, combined with the Acad.dvb (VBA) and some logical directory structuring, you can enforce most standards programatically. You may want to have an outlined plan before attempting to set things up in this manner. If your programming skills are limited, then I'd suggest doing some research/learning as well.

There are other methods of doing this, as individual ways of thinking provide individualized results, and newer versions of AC provide different solutions too. I just don't want to open up a can of worms here when all you wanted to do was insert a drawing containing your standards.

CADaver

  • Guest
Re: Insert every time
« Reply #28 on: April 28, 2008, 11:30:00 AM »
The modification to the OOTB function like acad2006doc.lsp would be the addition of a loading function to load specific routines like:
Code: [Select]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (if (not (load "e:/programs/ac2002/menus/csa/CSA-SETUP.lsp" nil))
  (progn
    (princ "loading error.")
    (princ "\nCSA-SETUP.lsp not found.  CSA Shorthand Commands are not enabled.  ")
  )
)
(princ)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If you point all installations to a network drive for the acad2006doc.lsp and the custom functions, you only have one place to modify to impact all installations.

And has been pointed out, the insertion of a “template” will not change many settings in the current file.  To do that you need a function to programmatically reset them.