View Full Version : Using VBA to create AutoCAD layouts
dtownsend
2006-10-13, 03:16 PM
I would like to automate a process that I go threw when doing pile cap as-builts.
For each pile cap I create a layout that has a view of the pile cap and is labeled with the grid line intersect that the cap is on..I also sometime will add a table with the asbuilt coordinates to the layout as well.
This is a very long process when you have hundreds or caps to create sheets for!
Any ideas of if I can do this with VBA? I am getting better with VB 2005 express and have made a few apps, but I havent messed with using it with autocad.
Ed Jobe
2006-10-13, 04:44 PM
Suggestion...If you're trying to automate a process, you first need to obtain a detailed list of the current process. Then trim out any unnecessary steps (usually some "that's the way we've always done it" that no longer has any value). Then, before you can start coding, figure out how you might do that manually in acad. Then reproduce it programatically. We can only help you with the last part. I have no idea what a pile cap is. ;-)
dtownsend
2006-10-18, 03:16 PM
when you say do it manually do you mean the commands that are needed to do this?
Most of it is done with a plugin (CG-Survey for AutoCAD), but it does have it own commands that can be typed in like autocad commands.
Thanks for you help
Ed Jobe
2006-10-18, 04:24 PM
That's just a matter of how detailed you need to be for your purposes. If you need to communicate to us when asking for help, you may need to be more explicit so that we understand. But what I said earlier was a general statement. Think of programming as a recipe. Eventually, you need to write down every step in code, like a recipe. If you are really familiar with a process, you might be able to sit down and just start writing code. But if the process is unfamiliar to you, or you are open to the possibility of redesigning it, then its best to document the basics of what you want to accomplish. So when I say 'do it manually', I mean from the user's point of view, what does the user need to accomplish and how would he do it. Then, you figure out how to to that programatically, looking for ways to cut out unnessary steps or steps you can do without user intervention. In the case commands performed by other apps, it may be necessary (or you might be better off, what happens if they go out of business) to replicate what they do, rather than rely on them.
dtownsend
2006-10-20, 12:13 PM
That's just a matter of how detailed you need to be for your purposes. If you need to communicate to us when asking for help, you may need to be more explicit so that we understand. But what I said earlier was a general statement. Think of programming as a recipe. Eventually, you need to write down every step in code, like a recipe. If you are really familiar with a process, you might be able to sit down and just start writing code. But if the process is unfamiliar to you, or you are open to the possibility of redesigning it, then its best to document the basics of what you want to accomplish. So when I say 'do it manually', I mean from the user's point of view, what does the user need to accomplish and how would he do it. Then, you figure out how to to that programatically, looking for ways to cut out unnessary steps or steps you can do without user intervention. In the case commands performed by other apps, it may be necessary (or you might be better off, what happens if they go out of business) to replicate what they do, rather than rely on them.
Thats for clearing that up. I have done programming for a few years but nothing big so I understand basic processes of programming and I typically always get a fresh notepad before I start anything so I can map out what I want the program to do. As far as for my first post...looks like I still have some work to do.
Also I would love to replicate what they do since their software is about $2000 a copy and the company I work for has around 10 or so copies. I'm not sure my skills as a programmer are at that point yet, but who knows.
On another note do you know anything about using VBA for Revit? Ideally I would like to switch this whole process over to revit one day. The problem I am running into is coordinate system for revit is so different from autocad, so I'm not sure it would work but I'm sure that question is for another thread :) .
My bonus question is do you know of any good resources for VBA for Revit books, internet, blogs, etc.?
Thanks again
Ed Jobe
2006-10-20, 02:11 PM
Sorry I don't know anything about Revit's object model, or if it even has an api exposed to vba. All I know about Revit is what I've heard argued about on the ADT ng's.
Mike.Perry
2006-10-21, 06:03 AM
<SNIP>
My bonus question is do you know of any good resources for VBA for Revit books, internet, blogs, etc.?Hi
I believe the only exposed API in Revit is via Dot Net.
For starters, head over HERE (http://forums.augi.com/forumdisplay.php?f=93) and HERE (http://forums.augi.com/forumdisplay.php?f=218).
Have a good one, Mike
Hi, dtownsend
Your task is very interesting for me
Let you send me sample drawing with 1-2 layouts you
need, maybe I could be to solve this problem I hope
my e-mail: fixo@yandex.ru
~'J'~
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.