TheSwamp

CAD Forums => CAD General => Topic started by: Dommy2Hotty on April 06, 2004, 05:07:50 PM

Title: Default AutoCAD blocks...can they be changed?
Post by: Dommy2Hotty on April 06, 2004, 05:07:50 PM
We change our "_archtick" block so that it shows up a little thicker.  Is there a way to change the default "_archtick" block so that we won't have to do this manually?  Same thing for leader arrowheads.  I know I can choose a user defined one, but that block must already be present in the current drawing in order to use it.  So I have to insert it into the drawing first, then change the leader settings.  I was going to make a lisp to do this crap, but I don't want to have to run it in each new drawing.   Thanks... :twisted:
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 06, 2004, 06:28:27 PM
archtick is prety thick already......

Anyway, you could do this.....

create an archtick block called _archtick with the line weight you want set the object on layer 0 with linetype and color as "byblock" ...save it in the support path as _archtick.dwg

create a lisp called archtick.lsp with the following code:

Code: [Select]

(command "-insert" "_archtick=_archtick" "y" (getvar "viewctr") "" "" "" )
(command "erase" (entlast))


Now put the archtick.lsp in the startup suite.

Problem solved.
Title: Default AutoCAD blocks...can they be changed?
Post by: CAB on April 06, 2004, 09:31:56 PM
It is my understanding that all dimension blocks are created with code if
they don't exist in the drawing. So there is no _archtick block outside of
ACAD that you can modify. Your only hope is a lisp.
I like Keith's suggestion. I also would create an auto run lisp that would
run when you opened the drawing looking for the _archtick block. If it does
not exist yet, then insert the one in you directory before ACAD creates one.
ACAD will create it the first time you use a dimension that needs it if you
don't create it first.

CAB
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 06, 2004, 10:01:43 PM
CAB, that does remind me, will the code above generate an error if the tick is not already defined in the drawing?

Just to be sure...
Code: [Select]

(if (tblsearch "block" "_archtick")
 (command "-insert" "_archtick=_archtick" "y" (getvar "viewctr") "" "" "" )
 (command "-insert" "_archtick" (getvar "viewctr") "" "" "" )
)
(command "erase" (entlast))
Title: Default AutoCAD blocks...can they be changed?
Post by: CAB on April 06, 2004, 10:28:04 PM
So, is it safe to add this bit of code to ACADDOC.LSP so it runs every
time a drawing is loaded?

Code: [Select]
(if (findfile "_archtick.dwg")
  (progn
    (if (tblsearch "block" "_archtick")
      (command "-insert" "_archtick=_archtick" "y"
               (getvar "viewctr") "" "" "")
      (command "-insert" "_archtick" (getvar "viewctr") "" "" "")
    )
    (command "erase" (entlast))
  )
  (prompt "\nMissing file, \"_archtick.dwg\"")
)
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 06, 2004, 10:46:01 PM
It should be ... although if the user ever has to reinstall AutoCAD it will wipe out changes made to the acaddoc.lsp file.

It could be done either way, personally I would put it in the startup suite so if I change profiles the archtick update would not follow. unless that is what you want it to do...but then again you could test for the current profile and only execute if the profile was set to the particular one you wanted.
Title: Default AutoCAD blocks...can they be changed?
Post by: CADaver on April 06, 2004, 11:08:14 PM
Just curious, but instead of inserting and erasing ENTLAST, couldn't you follow the "Y" with a (command) to cancel the insertion after the redefinition??
Title: Default AutoCAD blocks...can they be changed?
Post by: CAB on April 06, 2004, 11:45:59 PM
You know I can't get the routine to work.
I get the following error.

Quote
Command: -insert
Enter block name or [?] <cab>: _archtick=archtick2
Block _archtick references itself
Regenerating model.
*Invalid*


I changes the file name to see if that might be it.

I think ACAD protects the tick blocks some how.
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 07, 2004, 08:09:01 AM
Quote from: CADaver
Just curious, but instead of inserting and erasing ENTLAST, couldn't you follow the "Y" with a (command) to cancel the insertion after the redefinition??


You could, but quite honestly I did not consider it....

Quote from: CAB
You know I can't get the routine to work.
I get the following error.

Quote
Command: -insert
Enter block name or [?] <cab>: _archtick=archtick2
Block _archtick references itself
Regenerating model.
*Invalid*


I changes the file name to see if that might be it.

I think ACAD protects the tick blocks some how.


Actually, what you will need to do, and perhaps I should have made this distinction before.

If you open a new drawing then draw a tickmark and save it, you will likely already have the tickmark defined as part of the default dimstyle.

Follow this procedure:
open a new drawing
make sure that "archtick" is not the default tick mark for any default dimension style
draw the tick mark centered on 0,0,0
set the line thickness
set color to byblock
set linetype to byblock
set layer to 0
purge the drawing until there are no layers other than 0 and no dimension or text styles other than standard
wblock the new archtick using 0,0,0 as the base point
now you should have no problem.
Title: Default AutoCAD blocks...can they be changed?
Post by: Dommy2Hotty on April 07, 2004, 08:20:59 AM
wow...that's a lot to wake up to...thanks again guys...I'll test it out when I get to work...:twisted:
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 07, 2004, 08:42:44 AM
Well, heck, you should stay up later....
Title: Default AutoCAD blocks...can they be changed?
Post by: CAB on April 07, 2004, 08:53:10 AM
Thanks Keith,

You would make quite a detective.
The _ArchTick.DWG did have a _ArchTick block in it which was causing the problem.

CAB
Title: Default AutoCAD blocks...can they be changed?
Post by: Keith™ on April 07, 2004, 09:21:00 AM
I guess that is why I am good at problem solving...