redefine block

redefine block

Anonymous
Not applicable
500 Views
6 Replies
Message 1 of 7

redefine block

Anonymous
Not applicable
Is there any way to redefine inserted blocks? Unfortunately I didn't use Xref. Thanks in advance.
0 Likes
501 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
The drawing has an instance of a block called elayers
I want to redefine the block.
I have a drawing on the network called elayers.dwg
(this is how the first elayers block got there as well)

what is the easiest way to redefine the block and have the
existing instance of the block take on this new definition?
0 Likes
Message 3 of 7

Anonymous
Not applicable
Insert a block called elayers2 at the insertion point of all instances
of the block called elayers, then delete all instances of elayers,
delete the definition of elayers, then rename the definition of elayers2
to elayers.
-Josh

Mike Daugird wrote:

> The drawing has an instance of a block called elayers
> I want to redefine the block.
> I have a drawing on the network called elayers.dwg
> (this is how the first elayers block got there as well)
>
> what is the easiest way to redefine the block and have the
> existing instance of the block take on this new definition?
>
>
>
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
INSERT
Browse... to the elayers.dwg
make sure Insertion Point is set to pick in drawing.
Answer YES to redfine?
Cancel block insertion.

"Mike Daugird" wrote in message
news:1B97FAF1CEEF13F40B1C852E1FCA352D@in.WebX.maYIadrTaRb...
> The drawing has an instance of a block called elayers
> I want to redefine the block.
> I have a drawing on the network called elayers.dwg
> (this is how the first elayers block got there as well)
>
> what is the easiest way to redefine the block and have the
> existing instance of the block take on this new definition?
>
>
>
0 Likes
Message 5 of 7

Anonymous
Not applicable
Hi Adam,
That's all ducky and is the easiest way if we're talking about one or two
drawings, but since this is a vba forum and the block is on a server
(available to whoever is on his network), I'd guess he's looking to
automate the process of iterating possibly hundreds or even thousands of
drawings, checking for the existance of the block and replacing it when
found. Unfortunately, VBA doesn't support the redefine.
-Josh

Adam Wuellner wrote:

> INSERT
> Browse... to the elayers.dwg
> make sure Insertion Point is set to pick in drawing.
> Answer YES to redfine?
> Cancel block insertion.
>
> "Mike Daugird" wrote in message
> news:1B97FAF1CEEF13F40B1C852E1FCA352D@in.WebX.maYIadrTaRb...
>
>>The drawing has an instance of a block called elayers
>>I want to redefine the block.
>>I have a drawing on the network called elayers.dwg
>>(this is how the first elayers block got there as well)
>>
>>what is the easiest way to redefine the block and have the
>>existing instance of the block take on this new definition?
>>
>>
>>
>>
>
>
0 Likes
Message 6 of 7

Anonymous
Not applicable
thanks all
Here is what I am doing.


'now check to see if the block exists in the drawing.
'I will need to redefine the block if it already exists

CurDwg.ActiveSpace = acModelSpace 'change to model space
For j = 0 To (CurDwg.Blocks.Count - 1) 'iterate all blocks in the
drawing
'first I will check to see if the block already exists in the
drawing.
If UCase(CurDwg.Blocks(j).Name) = UCase(Left(File1.List(i), 1) &
"layers") Then
'the block exists, I must first find and delete all instances of
the block
Set Sset = ObjAc.ActiveDocument.SelectionSets.Add("Sset")
If Err Then
Err.Clear
Set Sset = ObjAc.ActiveDocument.SelectionSets.Item("Sset")
End If
Sset.Clear
intCode(0) = 0: varValue(0) = "INSERT" 'filter for a block
intCode(1) = 2: varValue(1) = LCase(CurDwg.Blocks(j).Name)
'filter for block name
Sset.Select acSelectionSetAll, , , intCode, varValue 'make
selection set

For x = 0 To Sset.Count - 1 'delete all instances of the block
Sset(x).Delete
Next x

CurDwg.Blocks(j).Delete 'delete block definition
CurDwg.PurgeAll 'clear out block
GoTo JumpOut ' I can stop checking I have deleted and purged the
drawing
End If
Next j
JumpOut:
"Minkwitz Design" wrote in message
news:3D0782F2.2010701@ameritech.net...
> Hi Adam,
> That's all ducky and is the easiest way if we're talking about one or two
> drawings, but since this is a vba forum and the block is on a server
> (available to whoever is on his network), I'd guess he's looking to
> automate the process of iterating possibly hundreds or even thousands of
> drawings, checking for the existance of the block and replacing it when
> found. Unfortunately, VBA doesn't support the redefine.
> -Josh
>
> Adam Wuellner wrote:
>
> > INSERT
> > Browse... to the elayers.dwg
> > make sure Insertion Point is set to pick in drawing.
> > Answer YES to redfine?
> > Cancel block insertion.
> >
> > "Mike Daugird" wrote in message
> > news:1B97FAF1CEEF13F40B1C852E1FCA352D@in.WebX.maYIadrTaRb...
> >
> >>The drawing has an instance of a block called elayers
> >>I want to redefine the block.
> >>I have a drawing on the network called elayers.dwg
> >>(this is how the first elayers block got there as well)
> >>
> >>what is the easiest way to redefine the block and have the
> >>existing instance of the block take on this new definition?
> >>
> >>
> >>
> >>
> >
> >
>
0 Likes
Message 7 of 7

Anonymous
Not applicable
Hi Mike,
You shouldn't have to delete the definition and purge, either one or the
other will do. I mentioned deleting the definition because of other
items in your drawing that you may not want purged, layers, linetypes,
ect. But that's trivial, the big thing is that you will want to either
make your inserts first before deleting or save the insertion points of
the existing references to an array. Otherwise you will not know where
the new refs need to be placed. You may already be doing that, but I
just didn't see it in the code you posted.


Mike Daugird wrote:

> thanks all
> Here is what I am doing.
>
>
> 'now check to see if the block exists in the drawing.
> 'I will need to redefine the block if it already exists
>
> CurDwg.ActiveSpace = acModelSpace 'change to model space
> For j = 0 To (CurDwg.Blocks.Count - 1) 'iterate all blocks in the
> drawing
> 'first I will check to see if the block already exists in the
> drawing.
> If UCase(CurDwg.Blocks(j).Name) = UCase(Left(File1.List(i), 1) &
> "layers") Then
> 'the block exists, I must first find and delete all instances of
> the block
> Set Sset = ObjAc.ActiveDocument.SelectionSets.Add("Sset")
> If Err Then
> Err.Clear
> Set Sset = ObjAc.ActiveDocument.SelectionSets.Item("Sset")
> End If
> Sset.Clear
> intCode(0) = 0: varValue(0) = "INSERT" 'filter for a block
> intCode(1) = 2: varValue(1) = LCase(CurDwg.Blocks(j).Name)
> 'filter for block name
> Sset.Select acSelectionSetAll, , , intCode, varValue 'make
> selection set
>
> For x = 0 To Sset.Count - 1 'delete all instances of the block
> Sset(x).Delete
> Next x
>
> CurDwg.Blocks(j).Delete 'delete block definition
> CurDwg.PurgeAll 'clear out block
> GoTo JumpOut ' I can stop checking I have deleted and purged the
> drawing
> End If
> Next j
> JumpOut:
> "Minkwitz Design" wrote in message
> news:3D0782F2.2010701@ameritech.net...
>
>>Hi Adam,
>>That's all ducky and is the easiest way if we're talking about one or two
>>drawings, but since this is a vba forum and the block is on a server
>>(available to whoever is on his network), I'd guess he's looking to
>>automate the process of iterating possibly hundreds or even thousands of
>>drawings, checking for the existance of the block and replacing it when
>>found. Unfortunately, VBA doesn't support the redefine.
>>-Josh
>>
>>Adam Wuellner wrote:
>>
>>
>>>INSERT
>>>Browse... to the elayers.dwg
>>>make sure Insertion Point is set to pick in drawing.
>>>Answer YES to redfine?
>>>Cancel block insertion.
>>>
>>>"Mike Daugird" wrote in message
>>>news:1B97FAF1CEEF13F40B1C852E1FCA352D@in.WebX.maYIadrTaRb...
>>>
>>>
>>>>The drawing has an instance of a block called elayers
>>>>I want to redefine the block.
>>>>I have a drawing on the network called elayers.dwg
>>>>(this is how the first elayers block got there as well)
>>>>
>>>>what is the easiest way to redefine the block and have the
>>>>existing instance of the block take on this new definition?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>
>
0 Likes