Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ask user to select sheets

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
1145 Views, 7 Replies

Ask user to select sheets

(Using Revit 2013)

 

Hi all,

Could anyone suggest how i can write into my api to ask the user to select sheets in their current project.

I would like to launch the "Selected view/sheets" box up to the user to check the tick boxes and then use these results for the rest of my code.

 

I have read the "viewprinter" in the SDK samples but it seems to be very complex for what i imagine should be an easy task.

Note: I dont want to launch the print box just the view/sheet selection box.

 

Thanks in advance

Mike

Tags (2)
7 REPLIES 7
Message 2 of 8
R.van.den.Bor
in reply to: Anonymous

How about :

 

Document doc = commandData.Application.ActiveUIDocument.Document;
UIApplication app = commandData.Application;

List<View> Views = new List<View>();
List<ViewSheet> ViewSheets = new List<ViewSheet>();

FilteredElementCollector coll = new FilteredElementCollector(doc);
ElementClassFilter filter = new ElementClassFilter(typeof(View));
coll.WherePasses(filter);
foreach (Element el in coll)
{
if (el is View)
{
Views.Add(el as View);
}
if (el is ViewSheet)
{
ViewSheets.Add(el as ViewSheet);
}
}

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 3 of 8
Anonymous
in reply to: R.van.den.Bor

Remy, Thanks for the reply but not quite what i am after.

That records ALL the views and sheets in the project which i am fine with but i want to get the end user to select from a list the sheets which they want to export,print, etc.

I am trying to achieve the below pop up box using the API but dont want all the print settings to pop up.

Once the user has selected the appropriate sheets i want to use that selection list in the rest of my code.

 

view sheet selector.PNG

 

 

Mike

Message 4 of 8
R.van.den.Bor
in reply to: Anonymous

Now I don't understand you. With my code you get a list of all the views in a project and all the sheets. With a filter the users can decide to see all the views, all the sheets or both. Then you let the user select with checkboxes what views/sheets he wants and you use that selection in your further code. Isn;t that what you want ??

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 5 of 8
Anonymous
in reply to: R.van.den.Bor

Remy,
Sorry probably my fault as I am a c# beginner.
I understand your code and what it does but when I run it in debugger it just runs through and selects all the views and sheets (doesn't ask user to do anything)

My question is how do I initiate the pop up window in Revit with the checkboxes?

After doing a bit of research I think I need to use the windows form designer to create this and then apply the lists to that?
Am I on the right line???

Thanks again for your help
Mike
Message 6 of 8
R.van.den.Bor
in reply to: Anonymous

Yes, you are right. You have to create your own dialogscreen, you can't call for this dialog. It's probably a good idea to have a look at the revit SDK first. The example allviews might be interesting for you aswell. Good luck,

Kind regards,
Remy van den Bor
ICN Solutions B.V.
Liked this post or found it usefull, don't forget the Kudo It won't hurt (at least not me).
Message 7 of 8
Revmzk
in reply to: Anonymous

Hi Mike, Did you end up creating this windows form? If so would you mind sharing your code on this thread as a solution to your original question?

Message 8 of 8
FlorisvdG
in reply to: Revmzk

There are many different ways to approach this 'let the user select sheets' case. The proper way would indeed be to create your own dialog.  The total implementation however includes datastructures, databinding and more code that isn't really that Revit API related, and posting it here would probably lead to a lot of off-topic discussion.

Note: This isjust my two cents. I'm just an other forum user.


In the SDK there are a lot of examples with custom dialogs. As said, that would be a good place to start.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community