PDA

View Full Version : Saved Selection Sets



sfaust
2007-11-21, 04:25 AM
Just messing around with the API some more, here is a little utility to save and retrieve selection sets. It stores them in a text file located in the same location as the project file. The text file has to be the same name as the project file with " SelSets" added to the end. It will create that way automatically, but if you move or rename the file you will have to do the same with the txt file to retain your selection sets.

In the case of a worksets project it will store the txt file at the central file location.

The only small bug is that if you rename a selection set, you have to exit out of the dialog box and restart before you can select that set. I'm not sure why that is yet, but it's a minor thing in my mind, so I left it for now. If I get time later I'll come back and see if I can fix it.

Let me know what you think!

Kevin Janik
2008-05-15, 01:07 AM
When I add this to my Revit.ini it shows up on the menu but does nothing with or without picking. What am I suppose to see?

Kevin

sfaust
2008-05-15, 03:33 PM
you should select elements, then go to Tools->External Tools-> Selection Sets. It should pop up a dialog box with the existing selection sets listed (which will be none the first time). There is a place at the bottom to type in a name and create a selection set from the elements you currently have selected. After that, it should show up in the list of selection sets at the top and you can select it and hit "select elements".

Does this not work for you? It's working correctly in 2008 and 2009 for me...

Kevin Janik
2008-05-15, 09:39 PM
you should select elements, then go to Tools->External Tools-> Selection Sets. It should pop up a dialog box with the existing selection sets listed (which will be none the first time). There is a place at the bottom to type in a name and create a selection set from the elements you currently have selected. After that, it should show up in the list of selection sets at the top and you can select it and hit "select elements".

Does this not work for you? It's working correctly in 2008 and 2009 for me...

Steve,

I can see the Tools->External Tools-> Selection Sets and when I click it with or without items selected I get nothing.

What do you think is the problem.

Here is what I pasted into my Revit.ini file:

[ExternalCommands]

ECCount=5

ECName1= Selected Element Count
ECClassName1= ReD.Example.NumElements.Command
ECAssembly1= "C:\Program Files\Revit Architecture 2008\Program\NumElements\NumElements.dll"

ECDescription1= "Number of Selected Elements"
ECClassName2=FindReplace.Startup
ECName2="Find and Replace"
ECDescription2="Find and Replace in text notes"
ECAssembly2=C:\Program Files\Revit Architecture 2008\Program\FindReplace.dll

ECName3= Selected Element Count
ECClassName3= ReD.Example.NumElements.Command
ECAssembly3= "C:\Program Files\Revit Architecture 2008\Program\NumElements\Dlls_And_Ini_0.6\NumElements.dll"
ECDescription3= "Number of Selected Elements"

ECName4=RunJournal
ECClassName4=Redbolts.RunJournal.Command
ECAssembly4=C:\V10Commands\RunJournal.dll

ECName10 = Selection Sets
ECClassName10 = sfaust.Revit.SelectionSets.Command
ECAssembly10 = C:\Program Files\Revit Architecture 2008\Selection Sets\SelectionSets.dll
ECDescription10 = Saves and Retrieves Selection Sets

Any ideas?

Kevin

david.kingham
2008-05-15, 10:37 PM
Change the 10's in the last lines to 5's

ECName5 = Selection Sets
ECClassName5 = sfaust.Revit.SelectionSets.Command
ECAssembly5 = C:\Program Files\Revit Architecture 2008\Selection Sets\SelectionSets.dll
ECDescription5 = Saves and Retrieves Selection Sets

Kevin Janik
2008-05-15, 10:55 PM
David,

I did that before and tried it again without it working with or without selecting a bunch of walls.

I even changed the syntax with quotes in places where some of my other External Commands have them. The Revit.ini file syntax must be very loose since some people have " marks around the ECAssembly and ECDescription while others don't. I think something is not referencing the .ddl correct.

ECName5=Selection Sets
ECClassName5=sfaust.Revit.SelectionSets.Command
ECAssembly5="C:\Program Files\Revit Architecture 2008\Selection Sets\SelectionSets.dll"
ECDescription5="Saves and Retrieves Selection Sets"

Here is a cut for Windows Explorer for the location of the .dll.

C:\Program Files\Revit Architecture 2008\Program\Selection Sets

Now I see why! :( I put the .dll in the wrong place. I was right but it was my goof! I was sure it said under the Program directory. Now it works!

Even so what about the Revit.ini file syntax.

Another one for debugging taking longer than writing the program!

Thanks for the help!

Kevin

sfaust
2008-05-15, 11:54 PM
glad you got it to work. Let me know what you think of it and any suggestions for improvements! As a disclaimer, though, I'm a VERY novice programmer, so I may not be able to implement your great ideas, but I'll try :)

sfaust
2008-10-31, 12:09 AM
Went back and revisited this briefly now that I know a little more programming, and since 2009 is out now with filters. Changed it to use filters as well as some other coding to make it faster. Because of the filters, this version will only work for 2009, but it's about 800 times faster (no, I didn't clock it, but it's way faster).

For rough comparison, a large set on one of my projects took maybe 6 or 7 seconds to select with the old version and now takes less than a second.

Also changed it so that when you enter a name for a new set the create button becomes the default, so you can just hit enter when you're done typing to create it.

Shouldn't be any change to your ini, just copy the new dll

david.kingham
2008-11-03, 10:38 PM
Thanks Steve, it even works in 64 bit Revit

sfaust
2008-11-04, 01:13 AM
cool. Hadn't actually done anything regarding that, but glad it works :)

josh.made4worship
2010-05-12, 08:16 PM
Hey Steve,

Do you have this working for Revit 2011? I haven't been able to get it to work, and I was just curious if anyone else has it working, and if so, what they did?

sfaust
2010-05-12, 08:42 PM
Your timing is good! I actually just was messing with this one this morning trying to update it to the Revit 2011 API (they made a lot of changes). The attached should work, let me known if it doesn't. I have included the .dll file as well as the .addin manifest file.

The manifest should be copied to "C:\Documents and Settings\All Users\Application Data\Autodesk\REVIT\Addins\2011". If you put the .dll file in the same location and you're running XP you should be done. Otherwise you will need to open the .addin file (ideally with an xml editor but notepad works fine too), find the <Assembly> tag, and change it's value to the correct .dll path.

I believe the old .ini locations still work to register it as well but I haven't tested...

Let me know if it doesn't work...

josh.made4worship
2010-05-12, 08:43 PM
Your timing is good! I actually just was messing with this one this morning trying to update it to the Revit 2011 API (they made a lot of changes). The attached should work, let me known if it doesn't. I have included the .dll file as well as the .addin manifest file.

The manifest should be copied to "C:\Documents and Settings\All Users\Application Data\Autodesk\REVIT\Addins\2011". If you put the .dll file in the same location and you're running XP you should be done. Otherwise you will need to open the .addin file (ideally with an xml editor but notepad works fine too), find the <Assembly> tag, and change it's value to the correct .dll path.

Let me know if it doesn't work...

Awesome...thanks for the update and your contribution to the community!

josh.made4worship
2010-05-12, 08:48 PM
What is the manifest file for?...do you know where it should be copied for those of us running Vista?

josh.made4worship
2010-05-12, 08:50 PM
guess I spoke to soon...found the location for Vista machines...

C:\ProgramData\Autodesk\REVIT\Addins\2011

josh.made4worship
2010-05-12, 08:56 PM
I guess to clarify my question about the addin manifest...do I need the assembly location in both the addin manifest file and the Revit.ini file?

sfaust
2010-05-12, 10:57 PM
I guess to clarify my question about the addin manifest...do I need the assembly location in both the addin manifest file and the Revit.ini file?

No, the manifest is the new way to register external commands in 2011. For now both the .ini and the manifest file options should work (but both not necessary). I believe I heard they were going to do away with the .ini in future releases though, so I figured best to get used to the manifests now...

twiceroadsfool
2010-05-19, 05:02 PM
Im not sure why, i cant get it to play nice with 2010 on win7-64. I add the lines to the Revit.ini file:

ECName4 = Selection Sets
ECClassName4 = sfaust.Revit.SelectionSets.Command
ECAssembly4 = C:\Program Files\Autodesk Revit Architecture 2010 suite\Program\Selection Sets\SelectionSets.dll
ECDescription4 = Saves and Retrieves Selection Sets

Then i change the line

EACount=3

So that it says

EACount=4

When i save the Revit.ini file, it accepts both. (Ive gone back in to look). But when i launch revit, it resets the EACount to 3.

The .dll is in the following location:

C:\Program Files\Autodesk Revit Architecture 2010 suite\Program\Selection Sets

Am i missing something?

twiceroadsfool
2010-05-19, 05:08 PM
EDIT- Noticed that the code for these lines said EC.... and the others said EA.... So i changed them to EA on a whim, and now i get an error on startup. But thats more than i got before, lol.

Still nothing though.

sfaust
2010-05-19, 05:44 PM
EA and EC are seperate; External Application vs. External Command. If you are putting them in the section labeled [ExternalApplications] that is why you are getting an error. If you don't already have a section labeled [ExternalCommands] you will need to create it followed by the line "ECCount=1", then put the lines I posted after it...

If that doesn't make sense post your .ini and I'll update it...

twiceroadsfool
2010-05-20, 04:26 AM
EA and EC are seperate; External Application vs. External Command. If you are putting them in the section labeled [ExternalApplications] that is why you are getting an error. If you don't already have a section labeled [ExternalCommands] you will need to create it followed by the line "ECCount=1", then put the lines I posted after it...

If that doesn't make sense post your .ini and I'll update it...

THIS is where i meant the post saying Nevvvvvvvvvvvvvermind im an idiot. LOL

Pierre-Nelson NAVARRA
2010-05-20, 02:31 PM
Done this in RAC2010...
http://www.box.net/shared/qzq2fh88gk

sfaust
2010-05-20, 04:29 PM
THIS is where i meant the post saying Nevvvvvvvvvvvvvermind im an idiot. LOL

Ah, now I get it. Though maybe you had some funny mushrooms on your pizza ;)

sfaust
2010-05-20, 04:30 PM
Done this in RAC2010...
http://www.box.net/shared/qzq2fh88gk

can't get the movie to play...

Pierre-Nelson NAVARRA
2010-05-21, 11:52 AM
I'm sure of my link....it works....http://www.box.net/shared/qzq2fh88gk
Got the file here.

sfaust
2010-05-21, 03:58 PM
I got the link and the file, it just won't open for me. Media player just gives me an error. Is it using an unusual codec?