VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Insertoin Point from block

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
195 Views, 5 Replies

Get Insertoin Point from block

I need to get the insertion point of a block
that is already in the drawing. I'm looping
through to add a hyperlink and it needs a point
to reference.

How do I get the insertion point? some code is
below:

For Each element In ThisDrawing.ModelSpace

'Check for attributes within blocks

If element.EntityType = 7 Then 'Test if it is a block

If element.HasAttributes = True Then 'Test if block has attributes

ArrayAttributes = element.GetAttributes
For I = LBound(ArrayAttributes) To UBound(ArrayAttributes)

MsgBox "Attribute Text String : " & ArrayAttributes(I).TextString

The ".TextString" will give me the value of the
block, I need the insertion point. Is there a
way to get a list of the commands associated
with variants?
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

You can tighten your code significantly by using a
filtered selection set rather than checking every object in a single
space.

 

As for the insertion point, use the InsertionPoint
property of the AcadBlockReference class.


--
There are 10 kinds of people. Those who understand binary and
those who don't.

 

http://code.acadx.com
(Pull the pin
to reply)


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
need to get the insertion point of a block
that is already in the drawing.
I'm looping
through to add a hyperlink and it needs a point
to
reference.

How do I get the insertion point? some code is
below:

For Each element In ThisDrawing.ModelSpace

'Check for attributes within blocks

If element.EntityType = 7 Then 'Test if it is a block

If element.HasAttributes = True Then 'Test if block has attributes

ArrayAttributes = element.GetAttributes
For I = LBound(ArrayAttributes)
To UBound(ArrayAttributes)

MsgBox "Attribute Text String : " & ArrayAttributes(I).TextString

The ".TextString" will give me the value of the
block, I need the
insertion point. Is there a
way to get a list of the commands associated

with variants?

Message 3 of 6
Anonymous
in reply to: Anonymous

"lilshoob" wrote in message news:f19da2d.-1@WebX.maYIadrTaRb...
> I need to get the insertion point of a block
> that is already in the drawing. I'm looping
> For Each element In ThisDrawing.ModelSpace
> If element.EntityType = 7 Then 'Test if it is a block
cast to blockreference object
set oblkRef = element
>
> If oBlkRef.HasAttributes = True Then 'Test if block has attributes
> ArrayAttributes = element.GetAttributes
> For I = LBound(ArrayAttributes) To UBound(ArrayAttributes)
if ArrayAttributes(I).TextString = searchmatch then
thisInsPoint = oblkref.InsertionPoint
hth
Mark
Message 4 of 6
Anonymous
in reply to: Anonymous

disregard my answer, Frank's way is better!
Message 5 of 6
Anonymous
in reply to: Anonymous

I'm not sure how to do that. I don't have a
clue about VBA. How would I associate the
variable defined as an AcadBlockReference to
the block that is currently active in the loop?
Message 6 of 6
Anonymous
in reply to: Anonymous

I'd suggest looking at frank's site
everything you need (for what you described) and more is explained there and
you'll also get a clue about vba!

"lilshoob" wrote in message news:f19da2d.3@WebX.maYIadrTaRb...
> I'm not sure how to do that. I don't have a
> clue about VBA. How would I associate the
> variable defined as an AcadBlockReference to
> the block that is currently active in the loop?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost