Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: binding to the API

  1. #11
    Autodesk Revit Developer
    Join Date
    2004-02
    Location
    Waltham
    Posts
    468
    Login to Give a bone
    0

    Default Re: binding to the API

    Umm, I'd rather see you exercise a certain different interface.

  2. #12
    AUGI Addict Scott Hopkins's Avatar
    Join Date
    2003-05
    Location
    Santa Barbara, CA
    Posts
    1,197
    Login to Give a bone
    0

    Default Re: binding to the API

    Snake? Why the need for all the secrecy? It doesn't take a genius to realize that you mean python....

  3. #13
    AUGI Addict
    Join Date
    2003-11
    Location
    New Zealand
    Posts
    1,116
    Login to Give a bone
    0

    Default Re: binding to the API

    Snake? Why the need for all the secrecy? It doesn't take a genius to realize that you mean python....
    Perhaps not a genius but how many non programmers know what python is other than as a snake? Those that knew what I was attempting understood. That was my target audience. I was just having some fun....

    For me Python is to programming what Revit is to Architectural documentation. Making the difficult things as simple as possible, giving you more time to concentrate on the design. To bring the two together is bloody exciting I reckon. And I'll show you why soon....

    I can definitely say it's working and seems to be working well so far although it's early days.

    In Python:

    Code:
    for elem in allElements:
        if elem.GetType() == a.GetType("Autodesk.Revit.Elements.Wall"):
                walls.Insert(elem)
    In C# (it'd be uglier in VB)

    Code:
    foreach (Autodesk.Revit.Element elem in ss)
    	{
    	if (elem.GetType() == typeof(Autodesk.Revit.Elements.Wall)) 
    		{
    		        {
    				walls.Insert(elem); 
    			}
    		}
    	}
    Umm, I'd rather see you exercise a certain different interface.
    Fedor, I think this is what you're referring to...

    The problem is AFAIK I can't pass a string from the ini file to load a particular python module. Thinking about it, having a list of scripts to run is easier for the novice anyway and only a few more mouse clicks. The list of scripts to run will be generated from a parsed directory so to add a script just drop it in the relevant directory.

    For those that want it I can release a dll that uses a fixed script name. So different scripts would have to be in different directories. And you could use the ini file as intended.

    I'm open to ideas on all of this. At the moment the priority is just getting things tidied up , playing more with the API, understanding exception handling/ testing and sorting out a few issues that affect installation.

    More examples to come in the next few days...

    For those who want to know more about python go to www.python.org.

    Guy

  4. #14
    Autodesk Revit Developer
    Join Date
    2004-02
    Location
    Waltham
    Posts
    468
    Login to Give a bone
    0

    Default Re: binding to the API

    If I understand what you mean, you want to have some kind of a dynamic choice of scripts. My "duh" question is, why not write a superscript on the Python side that would do the parsing and offer the user a menu? That would mean only one entry in revit.ini.

  5. #15
    AUGI Addict MikeJarosz's Avatar
    Join Date
    2015-10
    Location
    New York NY
    Posts
    1,497
    Login to Give a bone
    0

    Default Re: binding to the API

    how about:

    msgbox "Hello World"

    (firmly tonque in cheek!!)

  6. #16
    AUGI Addict
    Join Date
    2003-11
    Location
    New Zealand
    Posts
    1,116
    Login to Give a bone
    0

    Default Re: binding to the API

    If I understand what you mean, you want to have some kind of a dynamic choice of scripts.
    Correct. And you can run a script. Edit the script. Delete the compiled version(.pyc) and rerun the script again without restarting Revit ..... Almost. Depending on the changes, sometimes script changes seem to need a Revit restart.-Not sure what the technical explanation is. Possibly exception handling screwing the RevitAPI

    My "duh" question is, why not write a superscript on the Python side that would do the parsing and offer the user a menu?
    Sorry, poor choice of words. When I said a list of scripts what I was really saying was a listView of scripts. So yes this is exactly what will happen currently. If you look at the screenshot you'll see a column for script name plus a column for script description(from script).

    Not sure about description column there is a little bit of overhead with this.

    It's also worth noting that as this winForm is itself an external script people can modify it to their hearts content

    Will post a full example soon.

    Guy

  7. #17
    Autodesk Revit Developer
    Join Date
    2004-02
    Location
    Waltham
    Posts
    468
    Login to Give a bone
    0

    Default Re: binding to the API

    Aha. "Duh" indeed.

    What happens with recompiling is that .net may keep the old image in memory for a while.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2015: Binding
    By tim_newsome in forum AutoCAD Civil 3D - General
    Replies: 1
    Last Post: 2015-02-26, 08:46 PM
  2. X-Ref Binding Problem
    By Spenner in forum AutoCAD General
    Replies: 5
    Last Post: 2010-06-10, 03:29 PM
  3. Binding Xref
    By jc3cadd in forum AutoCAD General
    Replies: 10
    Last Post: 2009-10-29, 06:35 PM
  4. binding and pdf
    By bozza_05 in forum VBA/COM Interop
    Replies: 3
    Last Post: 2009-06-03, 08:27 AM
  5. LISP X-Ref/Binding
    By GreenMan415 in forum AutoLISP
    Replies: 3
    Last Post: 2008-06-05, 03:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •