| Author |
Message |
ashokp
Guest
|
Posted:
Thu Mar 24, 2005 4:29 pm Post subject:
Attribute Extraction |
|
|
Hi, I am a AutoCAD user, since 1992, I have done some small programs in autolisp, now I am trying to do one program in VBA since I know VB6. I am facing problem in getting started with this program.
My aim is - I have a drawing with number of blocks with one attributes in the block, I just want to select one block at a time and want to see the tag name and tagvalue of each block one by one(as soon as i select one block i should get the tagvalue) and once I pick OK in message box again I should be able to selct next block whichever i Need to knwo the tag value, give me some VBA code for this I am using AutoCAD2005. so that later I can put the tagvalue and total the tagvalue.
Please help me in doing this.
|
|
| Back to top |
|
 |
juno
Guest
|
Posted:
Thu Mar 24, 2005 10:56 pm Post subject:
Re: Attribute Extraction |
|
|
Couple of questions before I start coding
1. Will each block have only one attribute (one tag and one value)?
2 .Do you know the name of the block? |
|
| Back to top |
|
 |
Jeff Mishler
Guest
|
Posted:
Thu Mar 24, 2005 11:25 pm Post subject:
Re: Attribute Extraction |
|
|
This should give you an idea:
Option Explicit
Sub Att_List()
Dim objEnt As AcadEntity
Dim vPick As Variant
Dim objBlock As AcadBlockReference
Dim vAtts As Variant
Dim objAtt As AcadAttributeReference
Dim I As Long
Dim strAttlist As String
On Error GoTo Err_Control
Pick_Here:
ThisDrawing.Utility.GetEntity objEnt, vPick
If TypeOf objEnt Is AcadBlockReference Then
Set objBlock = objEnt
If objBlock.HasAttributes Then
vAtts = objBlock.GetAttributes
For I = 0 To UBound(vAtts)
Set objAtt = vAtts(I)
If strAttlist = "" Then
strAttlist = "Tag: " & objAtt.TagString & ", Value: " &
objAtt.TextString
Else
strAttlist = strAttlist & vbCr & "Tag: " &
objAtt.TagString & ", Value: " & objAtt.TextString
End If
Next I
MsgBox strAttlist, , "Attribute Listing for Block: " &
objBlock.Name
strAttlist = ""
End If
End If
GoTo Pick_Here
Err_Control:
Select Case Err.Number
Case Else
Err.Clear
End Select
End Sub
--
Jeff
check out www.cadvault.com
"ashokp" <nospam@address.withheld> wrote in message
news:27907366.1111663771056.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Hi, I am a AutoCAD user, since 1992, I have done some small programs in
autolisp, now I am trying to do one program in VBA since I know VB6. I am
facing problem in getting started with this program.
My aim is - I have a drawing with number of blocks with one attributes in
the block, I just want to select one block at a time and want to see the
tag name and tagvalue of each block one by one(as soon as i select one
block i should get the tagvalue) and once I pick OK in message box again I
should be able to selct next block whichever i Need to knwo the tag value,
give me some VBA code for this I am using AutoCAD2005. so that later I can
put the tagvalue and total the tagvalue.
Please help me in doing this. |
|
|
| Back to top |
|
 |
ashokp
Guest
|
Posted:
Mon Mar 28, 2005 10:02 am Post subject:
Re: Attribute Extraction |
|
|
Hi,
1) Block name is Seats.
2)Yes it has only one attribute and the tag is SEAT# Promt is Enter Seat Number and the Value is Varifying type.
Regards
ashokp |
|
| Back to top |
|
 |
ashokp
Guest
|
Posted:
Mon Mar 28, 2005 10:02 am Post subject:
Re: Attribute Extraction |
|
|
Hi Jeff.
This code is working fine and I am sure this will help me a lot in further development.
Thank you very much.
Regards
Ashokp |
|
| Back to top |
|
 |
|
|
|
|