Get block attributes from a block inside an xref
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Get block attributes from a block inside an xref

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
mgrigoriev
Guest





Posted: Wed Dec 15, 2004 10:25 pm    Post subject: Get block attributes from a block inside an xref Reply with quote

Hi,
I am picking an entity with GetSubEntity. This entity is part of a block that is inside an xref. The block has attributes. How can I get these attributes?

Here's what I do:

objUtil.GetSubEntity Object, basePnt, varMatrix, varData, strPrmt
Set objOwner = ThisDrawing.ObjectIdToObject(Object.OwnerID)

I can't get attributes from objOwner.

Thanks,
Mike

Back to top
Alfred NESWADBA
Guest





Posted: Thu Dec 16, 2004 1:26 pm    Post subject: Re: Get block attributes from a block inside an xref Reply with quote

In article <11125235.1103131567909.JavaMail.jive@jiveforum1.autodesk.com>, nospam@address.withheld says...
Quote:
Hi,
I am picking an entity with GetSubEntity. This entity is part of a block that is inside an xref. The block has attributes. How can I get these attributes?

Here's what I do:

objUtil.GetSubEntity Object, basePnt, varMatrix, varData, strPrmt
Set objOwner = ThisDrawing.ObjectIdToObject(Object.OwnerID)

I can't get attributes from objOwner.

Thanks,
Mike

hi mike,


the ownerid of an object within an xref is the xref itself, so you have to go through the nested-elements in contextdata of 'GetSubEntity'


Public Sub test()
Dim tEnt As AcadEntity
Dim tPnt As Variant
Dim tMat As Variant
Dim tCont As Variant

On Error Resume Next
Call ThisDrawing.Utility.GetSubEntity(tEnt, tPnt, tMat, tCont, "Select Block in XRef: ")

If (Not (tEnt Is Nothing)) Then
If TypeOf ThisDrawing.ObjectIdToObject(tCont(0)) Is AcadBlockReference Then
Dim tBlRef As AcadBlockReference
Set tBlRef = ThisDrawing.ObjectIdToObject(tCont(0))
If tBlRef.HasAttributes Then
Dim tAtts As Variant
'here we are
tAtts = ThisDrawing.ObjectIdToObject(tCont(0)).GetAttributes
End If
End If
End If
On Error GoTo 0
End Sub

- alfred -
Back to top
mgrigoriev
Guest





Posted: Thu Dec 16, 2004 9:27 pm    Post subject: Re: Get block attributes from a block inside an xref Reply with quote

Alfred, you are a genius. Thanks a lot, man.

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB