PDA

View Full Version : Parameter access- keynotes example



GuyR
2005-07-07, 05:25 AM
From this (http://forums.augi.com/showthread.php?t=21945) thread and the end of this (http://forums.augi.com/showthread.php?t=21191) thread find attached zip of a working dll, source code, revit file and entry for the ini file.

It's not accessing a structural family James but shows you one method of accessing type parameters and changing the values. Written in C#. You also have to have the .NET 1.1 framework installed to use the API, and this is a whopping 100MB!!!

Depending on where you put the dll you'll need to change the entry in the ini file.

What it does.

It parses the document looking for keynote families. Then it gets the keynote types and changes the description text of each keynote type. Finally it shows you the names of all the parameters in the keynote ;-)

I was really reluctant to write this example because it shows how to fix something that should be coming from the factory IMO (keynote text updating). But for whatever reason keynotes haven't been touched in at least 2 major releases. Those using keynotes extensively will see the significance of what this example can do and how you could develop it ;-) Roll on pyRevit.

If there are others using the API I'd be interested to know if there is a more direct route to the family types. I couldn't work out how to get to the family types from a selection rather than parsing the document.

HTH,

Guy

James.Lupton
2005-07-07, 09:08 PM
Guy

I noticed you used the

symbol.Name

to develop the note text string

Would it be possible to use the Keynote number parameter?

GuyR
2005-07-07, 09:37 PM
James,

You can use whatever you want, I just used the symbol(type) name because it was there and I wanted to show you can change the text. You could for example extract some text from a parameter in a beam and some text from a parameter in a wall and combine them in one keynote. The possiblities are endless ;-)

What you don't seem to able to do (at least I can't figure it out) is create a new type(symbol) in the document or change the symbol name. So there is no document.Create.newSymbol method. There's newFamilyInstance etc but symbols seem to be missing currently.

HTH,

Guy

Danny Polkinhorn
2005-07-07, 09:39 PM
Guy,

Take a look at the ArchSample1 sample app from the samples folder on the 8.0 disk. In the GetSortedNonSymbolElements function it uses a couple nested If...Then statements to filter out Symbols. This may help you get to your target objects quicker.

When I asked this question earlier, the response was that there wasn't a quick way to get a filtered selection of elements. I think the best way to do this at this point is to have the user select the elements you're interested in, then use the ActiveDocument.Selection for your iteration. Check the Selection contents to make sure they're what you want. Unfortunately, this only works for graphic elements and may not be what you need. But it's certainly quicker than iterating through the entire document.

Hope that helps,

GuyR
2005-07-07, 09:53 PM
Thanks Danny,

The trouble was (and it may have been my code) using ActiveSelection and elem.getType() == Autodesk.Revit.Elements.Family didn't work. I could only get it to work on the whole document. To be honest I didn't spend much time on this, I'm self-taught C# programmer and I'm concentrating on the python binding at the moment so it probably can work.

This version of the API seems to concentrate on the extracting of data and the creation of new instances of families. So using it for managing keynotes is probably pushing it at this stage anyway. Gives you a tantalising glimpse at the possibilities though...

Guy

ckc.mike
2007-10-27, 11:23 PM
Hi Guy,

do you please upload some screen shots to show what it should look like and how it work? I downloaded the API and loaded it into Revit, however, it nothing happen while I click on the it. May be I just did it incorrently. Could you please show me how it should work and look like?
Thank you

GuyR
2007-10-29, 08:16 PM
Hi Guy,

do you please upload some screen shots to show what it should look like and how it work?
Thank you

Mike, this won't run with RAC2008. The command interface changed so it needs to be recompiled once you've changed the source code. The was also how I dealt with keynotes pre the new keynote system in V9 so may not be relevant and might be creating some confusion.

HTH,

Guy