Your talking com interop... That's not going to be very wise. Because ... Microsoft to Autodesk said no more 32bit api's. So Autodesk to the rest of us said no more VBA (6.0). That effectively kills Com interop, unless you want to wrap your own in a sweet little DLL.
Enough of that. Let's back up. Who is using this program? Will it run inside or outside of AutoCAD (primarilly)? If you are a savvy .Net developer, then I fully recommend getting into it via the .net dlls (acmgd.dll, acdbmdg.dll) found in the root folder of AutoCAD with the acad.exe file. Much more support for that path, and a longer life time too. Goto Autodesk website and look for developers section ("Partner with Autodesk") and look at AutoCAD product, then get your hands on ObjectARX developer's guide. It has all the stuff for ObjectARX (lowest level C++) and its .Net wrapper (C#, and VB.net).
Also there is an online .Net guide for beginning with AutoCAD development.
http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html
To sum up your code you must learn to:
<
CommandMethod("MyDocumentScruitinizer")>
public sub:
Get the application (MDIActiveDocument, had to rename my namespace to AApplication)
Get the document
doc As Document = AApplication.DocumentManager.MdiActiveDocument
get the database
Dim
Dim db As Database = doc.Database
start a transaction (Using trans as transaction = db.transactionmanager.starttransaction)
get youre entity from the database:
block table to
block table record to
list of object ids through
entity = transaction.getobject(objectid,open for read)
do your math here.
trans.commit (IF YOU WANT TO CHANGE SOMETHING)
END USING (trans)(unless you want to crash AutoCAD)
end sub.
good luck with all that!
jvj
check my posts out, I tend to give out fully functional code bits. (also check out "JamieVJohnson")