Attribute Extraction Wizard and VBA
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
Attribute Extraction Wizard and VBA

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





Posted: Sat Dec 18, 2004 2:05 am    Post subject: Attribute Extraction Wizard and VBA Reply with quote

Hopefully someone can help me. I am new to programming in AutoCAD and having some difficulty.

Starting with an open drawing in AutoCad2005, I want to perform the same task as the Attribute Extraction Wizard, only in VB. I don't change any of the options in the wizard until the output file type. I also do not want to see the Wizard during this process. What I would like to automate is this:

Tools/Attribute Extraction...
Current Drawing (Next>)
Include xrefs, include nested blocks (Next>)
No Template (Next>)
Everything "Checked" (Next>)
View output (Next>)
Save template (Next>)
Export C:\drawing01.txt (Tab delimited)

The reason for not just using the Wizard is because I would like to process multiple files, but I am not at that point yet. Any help would be greatly appreciated. I hope I included all the info necessary to help with my problem.

Back to top
Oberer
Guest





Posted: Sat Dec 18, 2004 2:16 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

"I am new to programming in AutoCAD and having some difficulty"
are you proficient with vb(a)? do you need help with the code itself? if so, is there a particular part?
Back to top
Mrhault
Guest





Posted: Sat Dec 18, 2004 2:23 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

Thanks for the reply!
I am fairly familar using vb for excel, thats about it. I would say that I would need code to get me started. If you said to x, y, and z, its doubtful that I would be able to code it. I can follow code I see for the most part, the "DIM" statements give me the most trouble because I dont know where and when to use them.

Back to top
Oberer
Guest





Posted: Sat Dec 18, 2004 2:28 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

are you planning on doing the dialogues as well?
have you written and pseudo code yet?

as for the 'dim' statements, i'm sure you know you always want "option explicit" at the top of your module (forcing you to declare every var, instead of letting vba create variants for undeclareds)

you have to "dim" all variables (and objects)

do you have some 'basic cad code' for creating selection sets, etc?

are you planning on dumping to a text file, to a table? a spreadsheet? i know you orignally mentioned a text file, but the later two are much more flexible, if you need it...
Back to top
Oberer
Guest





Posted: Sat Dec 18, 2004 2:30 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

are you planning on doing the dialogues as well?
have you written and pseudo code yet?

as for the 'dim' statements, i'm sure you know you always want "option explicit" at the top of your module (forcing you to declare every var, instead of letting vba create variants for undeclareds)

you have to "dim" all variables (and objects)

do you have some 'basic cad code' for creating selection sets, etc?

are you planning on dumping to a text file, to a table? a spreadsheet? i know you orignally mentioned a text file, but the later two are much more flexible, if you need it...

i'm sure you've already search the NG, but if you have not, please check:
http://discussion.autodesk.com/search!execute.jspa?numResults=25&source=thread-threaded%7C33&q=extract+attributes&objID=f33
Back to top
Mrhault
Guest





Posted: Sat Dec 18, 2004 2:40 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

No dialogues, I just want to run the macro and end up with an output file. The only code I have is to open a drawing (which works):

Sub ExportData()
dwgName = "C:\Drawing01.dwg"
ThisDrawing.Application.Documents.Open dwgName
End Sub

Thats about it.

Having the output file be tab delimited text is ideal.

I have searched the discussion boards at length, with no avail.
Back to top
Dan
Guest





Posted: Sat Dec 18, 2004 4:14 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

I am new and learning as well.

Did you look at the Sample for Extracting Attributes? In 2002,2004,2005 it
was located
in this folder:
c:\\<AcadainstallFolder>\Sample\ActiveX\ExtAttr

The VBA macro is embedded in the sample Excel workbook.
I modified the code to run from autocad, and push it to Excel instead of
Excel pulling the attributes.

This might help you get started.
Good Luck,
Dan
"Mrhault" <nospam@address.withheld> wrote in message
news:17219111.1103317563269.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Hopefully someone can help me. I am new to programming in AutoCAD and
having some difficulty.

Starting with an open drawing in AutoCad2005, I want to perform the same
task as the Attribute Extraction Wizard, only in VB. I don't change any of

the options in the wizard until the output file type. I also do not want to
see the Wizard during this process. What I would like to automate is this:
Quote:

Tools/Attribute Extraction...
Current Drawing (Next>)
Include xrefs, include nested blocks (Next>)
No Template (Next>)
Everything "Checked" (Next>)
View output (Next>)
Save template (Next>)
Export C:\drawing01.txt (Tab delimited)

The reason for not just using the Wizard is because I would like to
process multiple files, but I am not at that point yet. Any help would be

greatly appreciated. I hope I included all the info necessary to help with
my problem.
Back to top
Mike Tuersley
Guest





Posted: Sat Dec 18, 2004 11:55 am    Post subject: Re: Attribute Extraction Wizard and VBA Reply with quote

How can you be "fairly familar using vb for excel" and not know about a DIM
statement? VB is VB the only difference is the object model you are using.

I'd recommend going to the library and getting a primer on VB or VBA before
you start because you're going to hit a lot of hurdles if DIM has got you
confused.

As for the rest of your problems, do a google. There a hundreds of articles
on writing to a text file [as well as a complete exampe in the VBA help
file] and there is almost one question a week here on attributes.

-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...
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