How to insert an anonymous block

How to insert an anonymous block

Anonymous
Not applicable
466 Views
4 Replies
Message 1 of 5

How to insert an anonymous block

Anonymous
Not applicable
Does anyone know how to insert an anonymous block into a drawing with VB/VBA
?
(Preferrably without 3rd party add-ins)

Thanks,
Brian D.
0 Likes
467 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Do you mean "how to insert an anonymous block that already exists in the
blocks collection into modelspace" or do you mean "how to create an
anonymous block in the blocks collection"?

Brian D wrote:

> Does anyone know how to insert an anonymous block into a drawing with VB/VBA
> ?
> (Preferrably without 3rd party add-ins)
>
> Thanks,
> Brian D.
>
>
>
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
Well, I meant BlockReference, but with "anonymous" blocks (name="*ANY",
group 70 = 1),
I'm not sure the blocks collection is an issue.


"Minkwitz Design" wrote in message
news:3C88E3D1.5060007@ameritech.net...
> Do you mean "how to insert an anonymous block that already exists in the
> blocks collection into modelspace" or do you mean "how to create an
> anonymous block in the blocks collection"?
>
> Brian D wrote:
>
> > Does anyone know how to insert an anonymous block into a drawing with
VB/VBA
> > ?
> > (Preferrably without 3rd party add-ins)
> >
> > Thanks,
> > Brian D.
> >
> >
> >
> >
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi Brian,
If I remember correctly, you can create a new anonymous block in the
collection by using the add method and giving it the name "*U", but the
issue that comes into play is if you already have multiple anonymous
blocks in the collection, since the insert method uses the name to
determine which block to insert. If it's a new block altogether, you can
use the add method setting it to a variable defined as acadblock, then
set the name property to another variable defined as string and insert
by that string variable. Something to the effect of:

dim blk as acadblock
dim bref as acadblockreference
dim Str as string
set blk = thisdrawing.blocks.add ("*U")
str = blk.name
'add geometry to block
set bref = thisdrawing.modelspace.insert (point, str, 1,1,1,0)

But once you lose a reference to it or if it already exists in the
drawing and is not new, you will have to differentiate the blocks by
objectid or some other method and try to grab the name property that way.
-Josh



Brian D wrote:

> Well, I meant BlockReference, but with "anonymous" blocks (name="*ANY",
> group 70 = 1),
> I'm not sure the blocks collection is an issue.
>
>
> "Minkwitz Design" wrote in message
> news:3C88E3D1.5060007@ameritech.net...
>
>>Do you mean "how to insert an anonymous block that already exists in the
>>blocks collection into modelspace" or do you mean "how to create an
>>anonymous block in the blocks collection"?
>>
>>Brian D wrote:
>>
>>
>>>Does anyone know how to insert an anonymous block into a drawing with
>>>
> VB/VBA
>
>>>?
>>>(Preferrably without 3rd party add-ins)
>>>
>>>Thanks,
>>>Brian D.
>>>
>>>
>>>
>>>
>>>
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Great ! That worked perfect. I was missing the part of
creating the block table entry first.

Thanks,
Brian D.


"Minkwitz Design" wrote in message
news:3C88FEF1.7000103@ameritech.net...
> Hi Brian,
> If I remember correctly, you can create a new anonymous block in the
> collection by using the add method and giving it the name "*U", but the
> issue that comes into play is if you already have multiple anonymous
> blocks in the collection, since the insert method uses the name to
> determine which block to insert. If it's a new block altogether, you can
> use the add method setting it to a variable defined as acadblock, then
> set the name property to another variable defined as string and insert
> by that string variable. Something to the effect of:
>
> dim blk as acadblock
> dim bref as acadblockreference
> dim Str as string
> set blk = thisdrawing.blocks.add ("*U")
> str = blk.name
> 'add geometry to block
> set bref = thisdrawing.modelspace.insert (point, str, 1,1,1,0)
>
> But once you lose a reference to it or if it already exists in the
> drawing and is not new, you will have to differentiate the blocks by
> objectid or some other method and try to grab the name property that way.
> -Josh
>
>
>
> Brian D wrote:
>
> > Well, I meant BlockReference, but with "anonymous" blocks (name="*ANY",
> > group 70 = 1),
> > I'm not sure the blocks collection is an issue.
> >
> >
> > "Minkwitz Design" wrote in message
> > news:3C88E3D1.5060007@ameritech.net...
> >
> >>Do you mean "how to insert an anonymous block that already exists in the
> >>blocks collection into modelspace" or do you mean "how to create an
> >>anonymous block in the blocks collection"?
> >>
> >>Brian D wrote:
> >>
> >>
> >>>Does anyone know how to insert an anonymous block into a drawing with
> >>>
> > VB/VBA
> >
> >>>?
> >>>(Preferrably without 3rd party add-ins)
> >>>
> >>>Thanks,
> >>>Brian D.
> >>>
> >>>
> >>>
> >>>
> >>>
> >
> >
>
0 Likes