PDA

View Full Version : Programming in Revit



spencer.67965
2004-11-30, 05:37 PM
Hello All,

I have never used Revit before and was wondering if there is any way to program within Revit like you can with AutoCAD, such as AutoLISP, VLISP, or VBA.

Thanks,

MikeJarosz
2004-11-30, 07:26 PM
Well, we've been told that 7.0 has an API for developers. The API I know a little about (MS Windows), is really a professional programmer's interface meant to be accessed from a programmimg language like C. It is definitely not like VBA.

Has anyone out there looked at 7.0 API yet?

By the way, the journal every Revit session creates is executable. Haven't had time to figure it out yet.

C'mon Waltham, help us out here.

PeterJ
2004-11-30, 08:49 PM
What do you want to do?

FK
2004-11-30, 09:07 PM
Note that the parametric control of families can get you a lot of what you'd need to code in other products. Granted, it's not scriptability or analysis, but it's still powerful.

Jit
2004-11-30, 09:07 PM
I hope we have no programming capabilities

Revit is pretty much a very good architectural programme straight out of a box. This suits me just fine as I dont want to do programming, I just want to design and doc

you might be thinking of ADT or vanilla acad

One thing I have learnt is that you have to think not in acad terms but in Revit terms
now I know this is hard especially if you have been a veteran user
but life wasn't meant to be hard at least in Revit world



example for chaos: look at layers in acad, you can create your own, name it your own, even have your own standard but when it come to getting staff, sharing files, it is a mess

when I have someone help with docs, in Revit they just do that, I DONT have to sit there or write a manual on how my office works

So for what its worth, I hope they never open Revit for plug ins

ariasdelcid
2004-12-01, 03:24 AM
Very good JIT ...same here!!!

mmodernc
2004-12-01, 05:33 AM
And you control family behaviour with logical operators including yes/no, nested if statements etc. Some people are setting up so they need only one basic door and window. Any programming should come out of the factory - and the same goes for bundled families

Steve_Stafford
2004-12-01, 08:36 AM
Today's General Session and Building Industry Session at AU 2004 told us an API is definitely in our future. The API we will see first will provide a way to look inside at the data model of Revit projects, to allow external applications to act on this data. Further, to even to allow collaboration between ADT and Building Systems for example.

In short, this first iteration of an API is meant to enable opportunities for collaboration and analysis of projects.

davidwlight
2004-12-01, 09:19 AM
It should also be noted, that Autodesk will probably only allow selected developers (partners) to have access to the API. This is actually a good thing, because it will ensure quality control.

dazza163968596
2004-12-01, 11:05 AM
I think an API could become a bad thing. Autodesk might stop developing things that are in Revit but need more development like the site tools, they may start to rely on third party plug ins to do these jobs. That means we will have to buy more things to get the most out of Revit, look at Archicad out of the box you can't do much unless you pay for all the add-ins. Similarly in AutoCAD you can do lots of things with it but to speed up the process you need add-ons which cost. An API will only be a good thing if Revit incorporate the developed add-ons into the new releases or make the available to subscription members. We already pay to much.

Steve_Stafford
2004-12-01, 03:13 PM
...I think an API could become a bad thing.... Autodesk might stop developing things that are in Revit but need more development like the site tools, they may start to rely on third party plug ins to do these jobs...We'll have to hope that our feedback in these forums and through Revit Support continues to affect corporate decisions about priorities and features. My sense of the attitude regarding an API is that it will make projects that are too task or region specific viable.

I take comfort in the fact that the Revit team is completely aware of the negative aspect of appearing to rely on 3rd parties to finish the product.

spencer.67965
2004-12-01, 03:39 PM
What do you want to do?
Currently our Engineering Firm works with mostly all AutoCAD clients, we offer to our clients the services of putting the structural marks on the drawings (i.e. Schedules, Footing @ Foundation Marks, Beams & Beam Schedules, Shear-Wall Marks and Schedules, etc). I have created in AutoCAD a number of AutoLisp and VBA Routines that help me create all of these marks and schedules quite rapidly.

More recently some new clients have expressed that would like us to engineer there plans and implement the structural marks, but they are using Revit instead of AutoCAD. I would like to use the same tools that I have created in AutoCAD, but from what I gather that doesn't seam likely.

How difficult is it to make those kinds of things Revit, and what do you think the learning curve would be?

Thanks for all of your input,

hand471037
2004-12-01, 04:34 PM
Currently our Engineering Firm works with mostly all AutoCAD clients, we offer to our clients the services of putting the structural marks on the drawings (i.e. Schedules, Footing @ Foundation Marks, Beams & Beam Schedules, Shear-Wall Marks and Schedules, etc). I have created in AutoCAD a number of AutoLisp and VBA Routines that help me create all of these marks and schedules quite rapidly.

I would like to use the same tools that I have created in AutoCAD, but from what I gather that doesn't seam likely.

How difficult is it to make those kinds of things Revit, and what do you think the learning curve would be?

Revit already automatically does the things you list, it has Marks and Schedules built-in, and so all you'll have to do is learn how to create annotation families that look the way you want, and schedules that report the information you want- both very basic things that are covered in any decent beginning Revit class. I'd imagine that once you learn how you'll find it to be faster than your current way of doing things, for the Schedules will be generated as you draw (no separate 'generation' script step), the Marks can be globally applied to a view (the 'Tag all not Tagged' tool), and both will remain live so that any changes are instantly reported (so there won't be any re-running of scripts post-edit).

Now, the approach and the execution of these task will be totally different, mind you, but I can't see it taking very long at all to learn how, for this kind of thing (automation and coordination of information) is what Revit was *built* for. :)

PeterJ
2004-12-01, 05:07 PM
It's because of Jeffrey's reply that I was ineterested to see what you were aiming at. The working method in Revit is sufficiently different from many other tools you might have that assumptions based on them will be irrelevant.

If you are clever with the way you set up your working approach you could have a template with a series of predetermined schedules in it. If your clients send you a Revit model and you change out their stock steel work for your specialist types with built annotation etc you will have a marked up drawing very quickly. If you then copy and paste your standard schedules into the new project you should see be able to apply them straight onto a sheet and you will have completed your steel design work, same will be true for shear walls, foundations etc. You should see an improvement in productivity.

spencer.67965
2004-12-01, 10:03 PM
Thanks for all of your input, I guess I have a few things to learn.

Does anyone recommend any books on learning Revit?

Thanks again

Scott D Davis
2004-12-01, 10:35 PM
It was said today at AU that the API is based on Microsoft's .NET technology....Word, Excel, and Access where specifically shown in the slide.

MikeJarosz
2004-12-01, 11:08 PM
I think an API could become a bad thing. Autodesk might stop developing things that are in Revit ....

There are many reasons why one would program a CAD system. Making up for missing features is the least of them.

Microsoft includes a VBA module in all of it's Office products. That has not stopped MS from continuously releasing new features. But the fact that it is there don't stop the majority of Office users from going about their everyday business. I bet that the majority of users don't even know how to find VBA in Excel.

Revit out of the box is an architect's dream. However, many of it's features are hard coded around a method that may or may not be valid in a given situation. For example, batch plotting. Revit allows the user to create a list of drawings to plot. Press the button, and relax.... Revit plots them all while you got your coffee. Or does it?

Revit sorts that list according to an inflexible rule: alphabetically. Trouble with that is you may not want it in that order. You may want Civil, architectural, mechanical, fire protection etc etc. You get the idea. And that's only if your plotter is a face down model. With a face up model you want reverse sorting. Does it matter? When you have 2000 sheets in your set it does.

A better way to do it is actually simple to implement with a scripting language. Just make a text file with the sheet names in the sort order you need, and have a plot routine read that file and plot the sheets in the order it reads them.

You might say send your idea to the wishlist. But sometimes the developers have a good reason for not doing things your way. "we're not going to do that". Should we walk away? Of course not. Just let me write my own script.

By the way, a good example of a missing feature is in Excel. Excel cannot do feet/inches arithmetic. But every architect needs that (at least in the US and Vanuatu). I wrote a ft-in function in a few minutes that I have used for years now.

One thing I have learned after mastering four different CAD systems is that no one system has a monopoly on features. Be careful when you say "why would you want that?"

What if Acad had a snap to 0,0,0? How about a count command? (count block name door90)?

There is definitely a place for a scripting facility in Revit.

hand471037
2004-12-02, 01:42 AM
You might say send your idea to the wishlist. But sometimes the developers have a good reason for not doing things your way. "we're not going to do that". Should we walk away? Of course not. Just let me write my own script.

Mike, a very good and thoughtful post.

I, for one, want an API just so that I could write a few desired small tools that don't have enough demand to realistically expect Revit to include. Also if Revit, via .net, can jive with external databases, it opens up a vast new world of abilities...

I think the worry in regards to an API comes from the fact of how it was done in AutoCAD. Most people work with MS Office products, but you never hear them complain about VBA ;) .

It's just how it was done in AutoCAD, and what was commonly done with it, that I think is the huge issue, and what many were hoping that Revit would be spared of. And it sounds like it will be, for the most part. However, if the rumored .NET API is going to allow for any additional data to be saved within the Revit file itself, or allow for basic built-in functions of Revit to be over-ridden, then I think we're in for the same level of pain that came with AutoCAD's API problems. But thank god it's going to be based on something modern, like .NET, rather than something esoteric or old.

Also, with the inclusion of .NET, we certainly won't be seeing Revit for anything but Windows for a long time I'm guessing. :)

(guess I better order a .NET book or two...)

FK
2004-12-02, 06:24 PM
But thank god it's going to be based on something modern, like .NET, rather than something esoteric or old.
.net is so not old that it is way too esoteric. ;-)


Also, with the inclusion of .NET, we certainly won't be seeing Revit for anything but Windows for a long time I'm guessing.
Heard of mono?

Wes Macaulay
2004-12-02, 06:47 PM
I'm not worried about the API making the developers lazy, or turning Revit into crapware. Vanilla Revit will be used by the majority, and people who need some unique or special features might be able to build them in with the API. APIs are about extensibility and communicating with other platforms. With Revit becoming the hub of building information, an API needed to happen.

hand471037
2004-12-02, 09:26 PM
Heard of mono?

yeah, I certainly have. But that's all, I've never worked with it. Don't know what level of functionality Mono has at this point, and what kind of future it really has, espcially in recent light of Microsoft's legal and patent endevors. I'm hoping that once I learn some Python and Squeak, enough to be dangerous anyway, that I might have some time to learn some .net and mono things in light of the recent API news...

Or is this a hint of future things to come? ;)

The 'old and esoteric' jab was at LISP. A cousin of mine is a Java devleper for EA Games, and when I told him that AutoCAD used LISP as an API, he laughed and laughed and laughed... :)

GuyR
2004-12-02, 09:43 PM
I learn some Python and Squeak

Pity Python wasn't called Bubble. Some of the Brit's might have been keen then :-)

I'm interested to know why you're learning both Python and Squeak? What's the advantage of each? I struggle to find the bandwidth to spend on python as it is, let alone another language as well. Good effort.

Guy

ps: Mono is usable unless you want to use passport etc. Forms are on the way and there is always GTK#.

FK
2004-12-02, 10:31 PM
Or is this a hint of future things to come? ;)
No. It's just that jumping ship shouldn't be impossible.


The 'old and esoteric' jab was at LISP. A cousin of mine is a Java devleper for EA Games, and when I told him that AutoCAD used LISP as an API, he laughed and laughed and laughed... :)
I know what the jab was at. The comeback is, those who don't understand LISP are bound to reimplement it, poorly. Apparently your cousin does not know just how much Java inherits from LISP, and you better find out just how much Python owes to LISP, and .net to Java.

Unfortunately, I don't have much experience with LISP. I only wrote one program. It was a one-liner (OK, it spilled over seven lines, but could have been much shorter had I known the LISP library) that proved theorems. It was equivalent to a couple of screens of C.

I have a little more experience with ML, similar to LISP, but with strong type checking. I once wrote a checkers program (that could beat me) in it in about a half of a day. The compiler forced me to remove all bugs before I could run the program.

To throw in another domain-specific metaphor, imperative languages are like lumber and functional languages are like concrete. People look at the grey powder (lots of silly parentheses) and can't imagine how it transforms into high-rise buildings.

So, you may dislike the LISP syntax (I do), you may write your code in something else (I do), but you must respect it (I, obviously, do).

MikeJarosz
2004-12-02, 11:00 PM
I should have expected you Massachusetts types to like LISP. It was invented at MIT to do artificial intelligence research, which is what it takes to apply it to CAD data.

I have a program for cataloging home libraries that has a Python module. I refuse to learn yet another programming language just because some programmer thinks it's really neat. Besides I have so many O'Reilly manuals, I need a program to keep track of them all.

How about COBOL, or APL or JOVIAL.

ADA, anyone?

hand471037
2004-12-02, 11:55 PM
I know what the jab was at. The comeback is, those who don't understand LISP are bound to reimplement it, poorly. Apparently your cousin does not know just how much Java inherits from LISP, and you better find out just how much Python owes to LISP, and .net to Java.

His laughing wasn't from a lack of respect at all, for when in school he too had to learn LISP. Just like everyone else doing a CS degree. His point was just that, these days, for something to make heavy use of LISP is a little odd, that's all. It would be as if Photoshop's plug-ins all had to be written in COBOL. it's just wierd, and that's what he was laughing at- not at LISP itself or any disrespect therein.

I wasn't even saying that LISP was 'bad'. sheesh. Just that as an API, it's strange, and something left over from Autocad's past; and that I was happy that something more modern was being used for Revit. That's all. Heck, I'm learning Squeak, which is very simluar in concept to a LISP machine, after all.

Guy: I'm learning Python because of Blender. It uses it as an API. I'd like to add some simple tools to Blender, for I plan on using it as a major part of my new business. Plus, Python would be useful for non-Blender things too, like things that a shell script might not be enough for. I'm learning Squeak because of Croquet and it's collabrative abilities, as well as just how cool it is in general. I could go on and on, but it's rather off-topic. But I can see a definate Architectural application for Squeak and Croquet, and hope to be able to use it to generate some ideas I've got to show to other folks.

hugh.69031
2004-12-03, 12:40 AM
I'd like to see both a scripting language within Revit and external access to Revit data - scripting similar to AutoCAD VBA macros, external access via .NET's CLR providing access to a Revit API from a variety of languages (but probably all called C#).

I had hoped V7 had more than what actually emerged, but it looks like there is an intention to add more scripting functionality and to open Revit up to the outside world when things are ready.

Thanks to everyone contributing this news.


Hugh Adamson
www.cadro.com.au (http://www.cadro.com.au)

PS: LISP was an excellent choice as AutoCAD's scripting language way back in 1986, gven the alternatives available under MS-DOS. APIs for C and VBA came along later.

hand471037
2004-12-03, 12:49 AM
PS: LISP was an excellent choice as AutoCAD's scripting language way back in 1986, gven the alternatives available under MS-DOS. APIs for C and VBA came along later.

That's what I was getting at. It made sense at the time, but now it seems almost funny that it uses it. That's why my cousin thought it funny, for, to him, a very experanced developer (he's a lot older than I and been programming for a very long time), LISP is really just an esoteric and academic programming language, and for something as big and mainstream as AutoCAD to still be using it he found hilarious. Like I said before, as if Photoshop used COBOL for it's plug-ins. :)

FK
2004-12-03, 01:24 AM
Some background (http://www.fourmilab.ch/autofile/www/chapter2_35.html) on AutoLISP.

Frankly, Mike has more authority than me here because I never touched AutoLISP. I agree that it takes stretching of one's brain to make good use of LISP, especially if one comes with too much imperative programming background. You need to, as it were, unlearn.

How does AI fit with CAD? Well, if you build an expert system with intelligent objects that know how to interact and propagate changes... hm...

Using LISP for an extension language is indeed strange in the sense that it's unfashionable and LISP programmers are not a dime a dozen. But laughing over somebody making an unfashionable choice is... shallow. Besides, you'd be laughing at emacs, Yahoo! and others (http://www.lisp.org/table/applications.htm).

Whether to learn another language is not a question of whim and vice, but of needs and resources. Python is becoming the extension or even implementation language for many (http://www.openoffice.org/) high-profile (http://www.zope.com/) applications (http://www.tmda.net/)and is challenging Perl as the hacker's tool of choice (http://pythonology.org/success&story=esr). If you don't care about extending these applications, or don't have the time, don't learn Python.

FK
2004-12-03, 01:28 AM
as if Photoshop used COBOL for it's plug-ins. :) COBOL was intended for people who don't know anything about programming, LISP was intended for people who know everything about programming, so the comparison does not quite fly. ;-)

hand471037
2004-12-03, 02:40 AM
FK: haha. :D

PeterJ
2004-12-03, 08:41 AM
laughing over somebody making an unfashionable choice is... shallow. Besides, you'd be laughing at emacs, Yahoo! and others (http://www.lisp.org/table/applications.htm).

Including Revit's early adopters....

hand471037
2004-12-03, 05:24 PM
Using LISP for an extension language is indeed strange in the sense that it's unfashionable and LISP programmers are not a dime a dozen. But laughing over somebody making an unfashionable choice is... shallow. Besides, you'd be laughing at emacs, Yahoo! and others (http://www.lisp.org/table/applications.htm).

Whether to learn another language is not a question of whim and vice, but of needs and resources. Python is becoming the extension or even implementation language for many (http://www.openoffice.org/) high-profile (http://www.zope.com/) applications (http://www.tmda.net/)and is challenging Perl as the hacker's tool of choice (http://pythonology.org/success&story=esr). If you don't care about extending these applications, or don't have the time, don't learn Python.
[/font]

uhh... jeeze. I use emacs sometimes. And if you want a good laugh, take a look at Radiance sometime. FK, lay off man, just because my cousin laughed at the thought of someone using LISP as an API in a non-geek mainstream commercial application doesn't mean that there was anything wrong about that or that he's shallow. He just thought it was funny, and that's all man. Sorry to offend the LISP gods and computer developers in general with my comment. :P

And as for Perl vs. Python, I actually started learning Perl, for my first stab at building a bridge from Revit to Radiance was to make a Perl program that would parse the Revit-produced DXF, and generate the required RAD files from it. That was due to Perl's ability to mangle text, and the fact that I've got a lot of high-level Unix admin friends (including one who works at Yahoo!) who know it that I can bother with question. However, this wouldn't work, for you wouldn't have the level of control that I want, and I wouldn't be able to add anything to the model that I didn't want to have in Revit.

So when I saw that someone I know was making a Python-driven add-on for Blender that can use Radiance as a render engine, much in the way that Mental Ray is used by Max, and that I would be able to use Blender additionally in product design and CNC milling/routing operations, I decided that I would stop learning Perl and start learning Python. Also it would be useful to know at least one programing language for other tasks, like writing little things to run on the server or what have you.

And, to be honest, I don't really like Python yet. Perl was easier to understand the basics of, and I had a really great Perl book. I still haven't found a good Python book, and the basics are much more confusing due to everything being all OO. But at least playing with Squeak is helping there, because it's all OO, but easier (IMHO) to learn, so at least some of the concepts transfer between the two...

MikeJarosz
2004-12-03, 05:45 PM
OK wise guys.... Here's the O'Reilly book

hand471037
2004-12-03, 05:50 PM
I've got that book, and I don't like it as much as the Perl one. Turns out that the quality between O'Rilley books can vary wildly, for they are all written by totally different people. The 'Learning Perl' book was written by a group of college professors, and it shows, for it teaches you all about Perl. The Python book wasn't written by educators, and as such, it more shows you everything about Python, rather than teaching you step-by-step. I've had more luck with the 'Dive into Python' and some of the other freebe online books. But it does seem like it will be a good reference book in the future, once I understand more about Python. :)

tmullins68225
2004-12-03, 06:07 PM
Ok guys, your scaring the architects with all this technical talk about snakes and jewelry. :confused:

I switched to revit so I wouldn't have to know any of this.

:wink:

Wes Macaulay
2004-12-03, 06:22 PM
You don't need to do any of this. But the programming types who come to Revit with these skills are always trying to continue the use of their skills!

FK
2004-12-03, 06:48 PM
FK, lay off man, just because my cousin laughed at the thought of someone using LISP as an API in a non-geek mainstream commercial application doesn't mean that there was anything wrong about that or that he's shallow. He just thought it was funny, and that's all man.
No grief. ;)

hand471037
2004-12-03, 07:28 PM
FK: cool. :)

BTW, just curious, what's your favorite language? or do you have one? I thought that Revit was written in C++; if you had your way, would that be different? Again, just wondering.

GuyR
2004-12-03, 09:04 PM
I still haven't found a good Python book, and the basics are much more confusing due to everything being all OO.

Example? The trouble I've had with python relates not so much to python but the verticals. I found I got going very quickly and the hill suddenly became very steep when you start mentioning words like interfaces, components,persistence, XML,XML-RPC, win32, threading, etc.

This would be true of any language, but at least with python I don't have to remember to get the variable types right or find that missing ;

Guy

hand471037
2004-12-03, 09:21 PM
I've just found the syntax and style of defining things within Python to be rather confusing, and haven't really read something yet that explains it in a way I can understand. So it's not that the fact that it's OO is the problem, its that I still really don't understand Python's syntax and structure. All of the guides I find are either too basic, or they assume that you already have a full understanding of OO and programing terminology. Once I learn what a term means, I can totally grasp the concept, but since I'm trying to learn on my own, in my spare time, it's going rather slow. Maybe next year I'll be able to take a class in it or something.

So, for example, I can write a little script to do something, but when I try to make it a little more complex I get errors of certain things being not properly defined, and I don't yet understand the syntax and logic well enough to understand what I'm doing wrong. With Perl, for whatever reason, it was a lot more obvious to me what I was doing wrong, and with Squeak, well, it deals with errors in a very nice way to help stupid folks like me. :)

GuyR
2004-12-03, 09:31 PM
Jeffrey,

You know my email address... Happy to help if I can.

Guy

FK
2004-12-04, 02:31 AM
BTW, just curious, what's your favorite language? or do you have one? I thought that Revit was written in C++; if you had your way, would that be different?
It's hard to tell. Out of the languages I used (and that's very few - 8 or so), ML wins hands down. Out of the languages I have not used, Python looks a likely candidate, although it looks like I'd miss ML's pattern matching and polymorphism. I tried Perl, but could not bring myself to like the ugliness (guess it's still an improvement over shell). I'm somewhat repulsed by LISP's syntax, but I think I know how to get around that. I respect C for what it does because it's all it does. I generally dislike C++ even though I've grown way too acustomed to it. Java feels like a cute little sandbox to play in. I don't feel like returning to Basic or Pascal at all. Plain C++ is lovely compared to C++ with ATL or Managed Extensions to C++. I guess "verticals" are hard in all generic languages.

About Revit... I don't really know. It's more than personal taste, it's people you can hire, third party tools you can deal with, etc., etc... It would be cool to do the core in Common LISP (because it's well-established, supported and can be optimized) and low-level graphics and whatnot in C. Could even use Python for UI (via wxPython) and extensions. ;-) But, you know, what we've got works too. ;-)

rhys
2004-12-04, 09:35 AM
OK Seems like this thread needs to become a new sub-forum. I still can't handle the math in family editor.
Not true really - after David Conant and Paul Loreto's classes at AU even I can now be inspired to attack the math in pursuit of the perfect universal family.