TheSwamp

CAD Forums => CAD General => Topic started by: ML on November 10, 2004, 08:53:57 AM

Title: Redefining Blocks
Post by: ML on November 10, 2004, 08:53:57 AM
I have a blocked out drawing (Dim Styles to be exact). If I purge out the dim styles, then re insert this drawing  via the insert command, it asks me
if I want to redefine the block, I say yes, all is well.

Now, I have a macro that is started ^C^C-insert etc. etc.

The macro works fine, the drawing inserts "but" my dimstyles are not there. This is the problem.

So, is there a way to redefine the block via command line. Is it even necessary? Or, is there another problem that I don't know about?

Thank you

Mark
Title: Redefining Blocks
Post by: CAB on November 10, 2004, 09:07:57 AM
Look here
http://theswamp.org/phpBB2/viewtopic.php?t=977&highlight=insert+replace
Title: Re: Redefining Blocks
Post by: MikePerry on November 10, 2004, 09:09:25 AM
Hi

What exactly do you mean by "my dimstyles are not there" -

New Dimstyles simply don't load

New Dimstyles don't overwrite existing Dimstyles that share the same names

Something else


Maybe take a look at the system variable Expert when running your command macro.

Have a good one, Mike
Title: Redefining Blocks
Post by: ML on November 10, 2004, 01:57:49 PM
I have a drawing that contains The DIMstyles only.
We Insert if we need the DimStyles
Title: Redefining Blocks
Post by: CADaver on November 10, 2004, 04:14:29 PM
If you insert a block that already exisits in the drawing it will prompt you to redefine and you need to answer YES to get the dimstyles.  Check the command syntax and adjust your code accordingly.
Title: Redefining Blocks
Post by: ML on November 10, 2004, 07:08:02 PM
Yes, I am aware of that CAD but I am inserting the wblocked (Dim Styles drawing) via a macro

It appears to be inserting just fine but the Dim Styles are not

What do you think?

Mark
Title: Redefining Blocks
Post by: MikePerry on November 10, 2004, 07:30:57 PM
Hi

Could you please post your DimStyle drawing file and Macro for Inserting the DimStyle drawing file.

Does the Insertion of the DimStyles always fail, doesn't matter if you -

Insert into an existing drawing file

Insert into a new drawing file

Have a good one, Mike
Title: Redefining Blocks
Post by: ML on November 10, 2004, 07:36:32 PM
Hey Mike

If I insert into a new drawing, it is fine. It is if the Dim Styles are not used, then purged out

Then, I re insert the Dims drawing and that is where they are not showing up

Mark
Title: Redefining Blocks
Post by: MikePerry on November 10, 2004, 07:51:40 PM
Hi

Are you bringing in the DimStyle drawing file as a Block (ie Not Exploding on insertion) OR Exploding on insertion?

If as a Block, maybe look at setting system variable Expert = 2 before bringing in.

OR

Try bringing it in Pre Exploded instead.

Have a good one, Mike
Title: Redefining Blocks
Post by: ML on November 10, 2004, 08:06:02 PM
No, I am not exploding it because there are no objects to explode but someone else recommended the expert variable, or may be you did earlier


Doesn't this expert variable do more then what we may want?
May be I will build (setvar "expert" 2) insert my block then (setvar "expert" 0)


here is how it effects blocks  --->


Suppresses the preceding prompts and "Block already defined. Redefine it?" (BLOCK) and "A drawing with this name already exists. Overwrite it?" (SAVE or WBLOCK).
Title: Redefining Blocks
Post by: CAB on November 10, 2004, 08:28:29 PM
You can use this it will purge the block but leave the dims in the drawing.
This is one line so when you paste it into a botton make sure ther are no ^M; added by ACAD.
If your block dwg is in the ACAD path you don't need the path.
Code: [Select]
^C^C(COMMAND "INSERT" "DimBlock=Dim-Style.DWG" "0,0" "1" "1" "0" "._erase" (entlast) "" "._purge" "B" "DimBlock" "N")
Title: Redefining Blocks
Post by: Keith™ on November 10, 2004, 09:39:02 PM
Mark, your latest post provides a bit more info, the block is not exploded, does not contain graphical objects and as such cannot be purged UNLESS you delete the block, which you can only do with code.

You CAN redefine the block, but only if you insert it from the hard drive file, not by simply re-inserting it. You have to provide the entire path to the file on the HD in order to redefine it.
Title: Redefining Blocks
Post by: Dent Cermak on November 10, 2004, 09:45:55 PM
INSERT
BLOCK A= BLOCK B
ENTER
ENTER
????????????
Title: Redefining Blocks
Post by: ML on November 10, 2004, 10:58:59 PM
Hey Keith

Thank you for the reply.

I am actually able to purge the dim styles out of the drawing but according to what you are saying, I will need to enter the entire path into the menu macro, is that correct?

Thank you

Mark
Title: Redefining Blocks
Post by: ML on November 10, 2004, 11:00:11 PM
In other words

^C^C-insert;entire path including filename;
Title: Redefining Blocks
Post by: MikePerry on November 11, 2004, 02:50:25 AM
Quote from: ML
No, I am not exploding it because there are no objects to explode but someone else recommended the expert variable, or may be you did earlier

Hi

Therefore you're creating a Block (with the same name as your DimStyle drawing file) within the drawing file when Inserting.

There's nothing wrong with that, but you need to be aware that if you then ReInsert DimStyle drawing file without first Purging the Block (with the same name as the DimStyle drawing file) from the drawing file you will have to deal with the "Block already defined. Redefine it?" (BLOCK) and "A drawing with this name already exists. Overwrite it?" prompt.

That is why I suggested maybe looking at the system variable Expert.

Personally I would go with Pre Exploding DimStyle drawing file when Inserting.

If it's still not working can you please post your DimStyle drawing file and Macro for Inserting the DimStyle drawing file so we (I) can see exactly what is going on; without seeing these I'm really struggling to see what could be causing your problem.

Have a good one, Mike
Title: Redefining Blocks
Post by: ML on November 11, 2004, 06:46:25 AM
Hi Mike,

The maco is real simple, it ^C^C-insert;filename;0,0;;;;z;e;

I am going to try that Expert Variable :

 ^C^C(setvar "expert" 2)-insert;filename;0,0;;;;z;e;(setvar "expert" 0)

and Keith also offered a very good suggestion if you read back a few posts about needeing the whole path in tthe macro in order to redefine

I will try both ideas and see what happens

Thanks again

Mark
Title: Redefining Blocks
Post by: CADaver on November 11, 2004, 08:38:30 AM
Quote from: ML
Hi Mike,

The maco is real simple, it ^C^C-insert;filename;0,0;;;;z;e;

I am going to try that Expert Variable :

 ^C^C(setvar "expert" 2)-insert;filename;0,0;;;;z;e;(setvar "expert" 0)

and Keith also offered a very good suggestion if you read back a few posts about needeing the whole path in tthe macro in order to redefine

I will try both ideas and see what happens

Thanks again

Mark



Okay, one last time.

Code: [Select]
-insert;filename;0,0;;;;z;e;

The above code works if AND ONLY IF, the block <filename> does not already exist in your drawing.  If the block <filename> is already in your drawing IT WILL NOT INSERT THE REDEFINED DIMSTYLES, it will merely insert the definition that already exists in the drawing, and that definition has no dimstyles associated with it.  

Try:
Code: [Select]

^c^c(command "-insert" "<BLOCKNAME>=<FILENAME>" "y" (command))


Where <BLOCKNAME> is the name of the block in the drawing, and <FILENAME> is the name of the file yopu're attempting to insert.
Title: Redefining Blocks
Post by: Keith™ on November 11, 2004, 08:48:48 AM
also it makes absolutely no difference if the block has anything drawn in it or not. If you insert it as a block it will always be a block in that drawing. Therefore it is advisable to insert it as an exploded block.
Title: Redefining Blocks
Post by: CADaver on November 11, 2004, 08:52:30 AM
Quote from: Keith
also it makes absolutely no difference if the block has anything drawn in it or not. If you insert it as a block it will always be a block in that drawing. Therefore it is advisable to insert it as an exploded block.
Flogging expired equine, methinks.
Title: Redefining Blocks
Post by: CAB on November 11, 2004, 08:55:06 AM
Ok, This code works like this:
Code: [Select]
^C^C(COMMAND "INSERT" "DimStyles=DimStyles.DWG" "0,0" "1" "1" "0" "._erase" (entlast) "" "._purge" "B" "DimStyles" "N")

Inserts DimStyles.DWG as a block, if the block exist it replaces it.
The path is not needed IF DimStyles.DWG is in the ACAD search path.
"._erase" erases the last entity added to the data base
"._purge" removes th block just inserted.

All the dimensions styles are left in the drawing.
 IF the style already exist it is NOT over written.


Quote

Command: _vlide INSERT Enter block name or [?]: DimStyles=DimStyles.DWG
Duplicate definition of block _ArchTick  ignored.
Specify insertion point or [Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]: 0,0
Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>: 1 Enter Y
scale factor <use X scale factor>: 1 Specify rotation angle <0.0000>: 0
Command: ._erase
Select objects:   1 found

Select objects:
Command: ._purge
Enter type of unused objects to purge
[Blocks/Dimstyles/LAyers/LTypes/Plotstyles/SHapes/textSTyles/Mlinestyles/All]:
B Enter name(s) to purge <*>: DimStyles Verify each name to be purged? [Yes/No]
<Y>: N Deleting block "DimStyles".
1 block deleted.

Command:
Title: Redefining Blocks
Post by: ML on November 11, 2004, 10:20:29 AM
Code: [Select]

^C^C(COMMAND "INSERT" "DimStyles=DimStyles.DWG" "0,0" "1" "1" "0" "._erase" (entlast) "" "._purge" "B" "DimStyles" "N")



And CAB Wins! What do we have for him Johnny?  :D

That was the answer, thank you very much!

Any blocks that I insert, titleblocks and all are always in a Support Path. I do not like typing whole paths into a menu file if necessary.

One last thing, after the DimStyles.dwg drawing is inserted, it opens The Dim Styles dialog box and it takes 4 Manual Escapes to supress it. I need to supress it via code

Thank you

Mark
Title: Redefining Blocks
Post by: ML on November 11, 2004, 11:21:52 AM
Ok, Thanks again CAB, it works perfect!!

I had a few Esc (^C) returns at the end of the macro which is why the dialog was coming up.

Now, it is great!


Mark
Title: Redefining Blocks
Post by: ML on November 11, 2004, 11:47:46 AM
Sorry, I meant enter, enter ;;