Jump to content

Starting VBA or VB.NET


jwkilgore

Recommended Posts

I have a fairly solid programming background (BASIC, C++, FORTRAN, PASCAL, etc.); I've even written and edited C++ and FORTRAN programs to run under AutoCAD v12. Unfortunately, this was in a previous life (15+ years ago).

 

Over the past several months I've dusted off the programming cobwebs and delved into writing VBA programs for MS Excel 2007 with quite a bit of success. This has me thinking about automating a few process in AutoCAD 2009. Unfortunately, VBA for AutoCAD appears to be a completely different animal from VBA for Excel. In Excel you know where everything is; if you want to edit a certain cell, you reference that cell {Sheet1.Cells(1,1).Value=Whatever}. In AutoCAD things float around like dust motes. Also, there are countless help sites and forums with VBA Excel tips and tricks; a simple Google search will answer almost any question. VBA for AutoCAD is too specialized, and little help exists (other than "buy my program" sites).

 

From my searching this site appears to be the best source of code snippets, and I've learned quite a bit already. But I'd like a more robust reference source, such as a book. Unfortunately, none of the ones I've found look right for me, and all are for older versions of AutoCAD.

 

Questions:

- I know VBA is going away and being replaced by .NET. Is VB.NET available for AutoCAD 2009? If it is, I'd rather just start there than bother learning VBA for AutoCAD just to have to re-learn something else in a few years.

- If .NET isn't available for AutoCAD 2009, can anyone recommend a good VBA reference manual? The latest AutoCAD version as possible, I at least want to be able to look up Table information.

 

Some of the specific VBA projects I have in mind are stripping excess formatting data from the text in an AutoCAD Table entity (see HERE for more info), and exporting the XYZ coordinates for all PLines in a drawing to either a text (.CSV) or Excel file.

Link to comment
Share on other sites

Questions:

- I know VBA is going away and being replaced by .NET. Is VB.NET available for AutoCAD 2009? If it is, I'd rather just start there than bother learning VBA for AutoCAD just to have to re-learn something else in a few years.

Then .Net it is

 

Here is a start

 

Here is a link to download 2009 ObjectArx(Has .Net info also, more detail about ObjectArx, but since .Net API is just wrappers around ObjectArx is very useful)

http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=785550

 

Link to Developer's Guide

http://docs.autodesk.com/ACD/2011/ENU/filesMDG/WS1a9193826455f5ff2566ffd511ff6f8c7ca-4875.htm

 

Look at DevTV: Introduction to AutoCAD .NET Programming and AutoCAD .NET Labs in Link

http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1911627

 

Another great resource

http://www.theswamp.org/index.php?board=27.0

 

Link to Through the Interface by Kean Walmsley blog who is "Senior Manager of Developer Technical Services (DevTech), the worldwide team of API gurus providing technical services through the Autodesk Developer Network."

http://through-the-interface.typepad.com/through_the_interface/

 

Go to Online Classes then select Customization and Programming track

http://au.autodesk.com/

Link to comment
Share on other sites

Don't know if this helps your look "here", but look up "styles" you can set your fonts styles to what ever you want size width font spacing etc and then just use them with one variable change just change "Textstyle" to the style you want. (setvar "textstye" "leroy")

 

Re the pline xy question do a bit of a search here I am pretty sure I have seen that in the last few days. may be a lisp but so what call lisps from .net

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...