PDA

View Full Version : Starting Out - Comments appreciated



rjcrowther
2007-11-26, 12:44 AM
Hi All,
I am thinking about starting out with visual basic programming partly for revit and partly for autocad. As always with me, the economics of the situation is a secondary function and self development/fulfillment is primary.

Concerning revit I would initially like to whip up quick applications to solve the repetitive button clicking that sometimes happens. I would also like to implement something that imitates some of the express tools of autocad - text functions for starters.

I learnt motorola 6800 machine code programming about 25 years ago and some BASIC (before GWBASIC came along) a while back as well. Before I engauge in a fairly lengthy learning process in order to get with the times, I was hoping to run a few questions by anyone who wishes to respond.

1. Is there good access into Revit for programmers - I have read in the past that there still leaves a lot be desired.
2. If there still leaves a lot to be desired is it improving at a reasonable and consistent rate?
3. I have my hands on a Thompson course technoloy book by Shelley Cashman Quasney that is about 1000 pages with plenty of examples and questions. Is that a reasonable way to start?
4. Is the shipped Autodesk documentation good enough to get up to speed with, once a grasp of VB is obtained?
5. Is it reasonable to expect myself to put together some simple but effective utilities that will directly enhance the revit output without becoming full time at this?
6. Is Visual Studio2008 (the freebie from microsoft) going to be sufficient?
7. Working through the 'learn VB' documentation of VS2008 proved to be too difficult. Is it just me or is that documentation too superficial to get a good grasp of the concepts? (you won't offend me if the resulting answer is that I am a bit dumb)
8. Has autodesk produced some unbiased information regarding this topic that is understandable for someone in my position?

Thanks,
Rob

GuyR
2007-11-26, 02:03 AM
1.. The API is continuing to improve. RAC2009 is just around the corner, no doubt we will see further substantial improvements. Will it ever be as open as AutoCAD? No, and thank goodness for that!!
2.. Yes.
3.. I'm not familiar with Thompson, I've always found Apress books well written.
4.. It could always be better but yes it's a good start. Although many examples are in c#, so need to be converted.
5.. Yes, but you will still spend a lot of time learning .NET.
6.. Yes, and also sharpdevelop is an excellent alternative.
7.. Get a good book and read in conjunction with online tutorials.
8.. not that I know off, other than what is in the Getting started document contained in the SDK.

Also search AUGI there are a number of posts about getting started with the API, as well as a few examples.

HTH,

Guy

rjcrowther
2007-11-26, 02:45 AM
That definitely helps.

1 and 2. Nice to hear
3. I will look for Apress as well.
4. Good
5. Hoping the book and tuts help here as well.
6. Will take a look, thanks.
7. A good way to start, thanks.
8. Tried to have a read of this and was very heavy going. Might make more sense as I proceed.

Yes, AUGI filled in the gaps when learning Revit so am hoping for the same with this.

Regards,
Rob

dbaldacchino
2007-11-26, 05:47 AM
Great post. Would it be better to spend time learning C# in lieu of VB ? (when you say ".NET", are we talking of VB?) Is one better/more powerful than the other? Are they similar? I'm trying to figure out what would be the best route for someone with experience in VBA.

GuyR
2007-11-26, 07:50 AM
David,

The VB.NET vs C# debate isn't a simple one. VB.NET is quite different to VBA. If you're more familiar with the way most languages bracket code ( {}, ; etc) then c# will be more comfortable. It is possible to convert code between c# and VB.NET so the SDK written largely in C# shouldn't hold anyone back.Here's (http://www.codeproject.com/dotnet/vbnet_c__difference.asp) a link to an indepth look at the language differences.

The .NET framework is simplistically a wrapper around the underlying win32API providing a whole series of class libraries for UI, security etc.On top of that runs a virtual machine called the CLR or common language runtime. When you write programs in c# or VB.NET it compiles this code to an intermediate format called CIL or Common Intermediate Language. When you run a .NET program it compiles this IL to native code using just in time compilation.

This is why the first time you run a revit command it's much slower than subsequent times, and why .NET programs are so close in speed to c++ (for a lot of tasks). And because the CLR is language neutral any .NET language should be able to run equally fast whether it be VB.NET, c#, F#, python, ruby, etc

I think the easiest way to decide is study some code from both and see which makes more sense. If you download sharpdevelop you can try projects in either language. Personally I find VB.NET quite difficult to follow, I much prefer the terse format of C#, The beautiful thing about .NET is though, if you start of in one language and don't feel it's working for you, it's relatively simple converting existing projects to the other language.

HTH,

Guy

rjcrowther
2007-11-26, 10:03 AM
Another question from David's:
Are the class libraries equally extensive for C# and VB?

Thanks,
Rob

sfaust
2007-11-26, 04:50 PM
I'm about it your same position only about 2 or 3 weeks further along, so here's my experience so far, take it for what it's worth :).

I started out and did VB instead of C# for a couple reasons. First, I know just a small amount of Basic from a long time ago, so I was at least a little familiar with how it works. Second, when I looked at code for them it seemed like VB was more spelled out and therefore easier for a newbie to read. For example, and if/then statement in VB is something like

If x=1 Then
(code if true)
Else
(code if false)
End If

where c# would be more like :

if (x=1)
{
(Code if true);
}
else
{
(Code of False);
}

another example of declaring variables:

VB:
Dim x As Integer
Public x As Integer = 10

c#:
int x;
int x = 10;

More of it is implied in the c# example, which is fine if you know what it's doing, but VB is more spelled out as to what is what (in my opinion anyway).

As far as being able to do things, yes you can do it without becoming a professional programmer. I have been messing with it in my off times for a few weeks now and have been able to write two basic utilities (both of which are posted on the forum). One finds all the objects on a certain level, the other saves selection sets to a text file and retrieves them later. Nothing earth-shattering, but they're useful and I was able to come up with them relatively quickly. Don't expect it to be easy, but it's doable.

There is also a lot of help to be had on this forum. Try out the code and if you just cant figure it out, post here and I'm sure someone will help out (I will too if it's basic enough for me to understand ;))

anyway, good luck and hope that helps.

GuyR
2007-11-26, 05:12 PM
Are the class libraries equally extensive for C# and VB?

Yes. There are a few unique language features C# has that are nice, VB.NET has a few as well. They both can access the same underlying class libraries. Don't worry about this when selecting a language, as I said you can always convert.

Guy

rjcrowther
2007-11-26, 11:50 PM
Thanks Guy.

Like Steve I am leaning towards VB as basic is something I have done in the past and so hoping some of that knowledge comes flooding back so it is a easier learning curve.

Steve, it is also encouraging to me that you can produce something after only a few weeks - I was thinking months before being able to do anything of use.

Thanks,
Rob

r.howarth
2007-11-27, 06:27 AM
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx this might help if you find examples in C# and you do VB or visa versa.

MRV
2007-11-27, 01:35 PM
I just noticed in the Revit 2008 SDK readme that it requires Visual Studio Express 2005... does that mean Visual Studio Express 2008 is not compatible?

sfaust
2007-11-27, 03:29 PM
http://www.carlosag.net/Tools/CodeTranslator/Default.aspx this might help if you find examples in C# and you do VB or visa versa.

GuyR also pointed me to http://codeconverter.sharpdevelop.net/Default.aspx which works pretty well too...

GuyR
2007-11-27, 06:14 PM
I just noticed in the Revit 2008 SDK readme that it requires Visual Studio Express 2005... does that mean Visual Studio Express 2008 is not compatible?

I explain this here. (http://forums.augi.com/showthread.php?t=70558)

Guy

truevis
2007-12-02, 05:14 AM
I explain this here. (http://forums.augi.com/showthread.php?t=70558)

So, can we use Visual C# 2008 Express Edition (http://go.microsoft.com/?linkid=7653518)to start programing Revit API now or what? It came out this month, apparently.

I see also that there are 90-Day Trial Downloads of Visual Studio 2008 (http://msdn2.microsoft.com/en-us/vstudio/products/aa700831.aspx). Is it really worth paying vs free? There were several mentions of how to get the express editions to debug like the paid ones at AU.

There were also many API utilites shown at AU with the promise of posting them for us to use their code.

GuyR
2007-12-02, 08:40 PM
There is nothing stopping you using VS2008. By default all projects will target .NET3.5.

It's worth paying for VS if :
1.. You need to program in teams.
2.. To use some of the VS plugins available.
3.. Use the enhanced database tools in VS Professional.
4.. You get seriously into ASP.NET.
5.. Multiple solutions in one project.
6.. Debug/Release builds.
7.. Increased application installation options .

FWIW, 1,5,6,7 can be met by using sharpdevelop.

What utilities did they demo? For those of us not at AU...

Guy

truevis
2007-12-02, 10:49 PM
FWIW, 1,5,6,7 can be met by using sharpdevelop. ...

Is all the setup and code the same as with the MS products? I didn't see any sharpdevelop in the AU demos.


What utilities did they demo? For those of us not at AU...

There was a bunch of code for going though the database, a revit.ini maker, a front end to run many apps without having to change revit.ini, code to get parameters from some elements and put those parameters into other elements, something to snoop into all the revit DB, ...

We look forward to seeing these on the AU site; hope they do get posted.

GuyR
2007-12-03, 01:27 AM
Is all the setup and code the same as with the MS products? I didn't see any sharpdevelop in the AU demos.

Sharpdevelop is an opensource VStudio IDE alternative. Some aspects aren't quite so polished as VS but it also does quite a lot that the express versions don't. A good alternative for .NET2 .0 development. ADesk will never mention it, they only support VS as this is the official development environment for .NET . And most Revit.API developers will be using VS Porfessional or above.


There was a bunch of code for going though the database, a revit.ini maker, a front end to run many apps without having to change revit.ini, code to get parameters from some elements and put those parameters into other elements, something to snoop into all the revit DB,

Even if the snoop tool is the only one they release that'll be very useful for you all. We have this tool available on ADN and it's great for quickly checking an elements properties.

Guy

truevis
2007-12-03, 02:22 AM
...Even if the snoop tool is the only one they release that'll be very useful for you all. We have this tool available on ADN and it's great for quickly checking an elements properties....
When I saw it, I was imagining if it could also change parameters, it could be a super floating properties dialog. Just a dream for now, I reckon.

mmason.65315
2007-12-05, 03:11 PM
It's possible to do what you're talking about for any parameter/property which is not read-only. We made a family editor grid tool for internal use which did something like what you're referring to...

Best Regards,
Matt