How to use PickPoint function in another view.

How to use PickPoint function in another view.

휴엔
Participant Participant
2,076 Views
9 Replies
Message 1 of 10

How to use PickPoint function in another view.

휴엔
Participant
Participant

 

Hello Everyone,

I have question about two methods below.

 

According to the Revit Document, these two methods have the remark below in common.

 

"Revit users will be permitted to manipulate the Revit view (zooming, panning, and rotating the view), but will not be permitted to click other items in the Revit user interface. Users are not permitted to switch the active view, close the active document or Revit application in the pick session, otherwise an exception will be thrown.

Note: this method must not be called during dynamic update, otherwise ForbiddenForDynamicUpdateException will be thrown."

[PickObject Method Description] https://www.revitapidocs.com/2020/0315fd62-b533-1817-2f2d-d9ebd4bc8e33.htm 

[PickPoint Method Description]  https://www.revitapidocs.com/2020/e35b0233-64b5-d0c0-713a-292f62942769.htm 

 

But PickObject method works while selecting element in multiple view.
And PickPoint method throws exception while trying to change view.

 

The remarks are the same, but the functionality works differently.

Is there any solution to select point in another view without exception?

0 Likes
Accepted solutions (1)
2,077 Views
9 Replies
Replies (9)
Message 2 of 10

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @휴엔 ,

 

I don't see any problem with PickPoint.

 

While executing PickObject/PickPoint command the properties browser, project browser, and ribbon items are greyed out. So you cannot select any options from the greyed out items. Here the navigation bar and View cube are not greyed out so by using the view cube and navigation bar you can go to a particular view of your model and select the element.

 

While executing PickPoint/PickObject command and before selecting the point or object, using the navigation bar you can zoom, pan, and rotate the view. Since the project browser is greyed out you cannot switch the floor plan. Also, you cannot goto/Switch the elevation view using the project browser.

 

I think this is what mentioned in the remarks section of the Revit API document.

 

To answer your question about pickpoint, While executing the pickPoint command, I am able to change the view using view cube and I am able to select the point.

 

If this answer doesn't help, could you please explain your problem a bit more clearly?

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 10

휴엔
Participant
Participant

Thank you for the answer.

I need to add more details about "changing view".

 

Please check the attached image for reference.

We want to use PickPoint() method in the different "Window". (I don't know the mentioned word is right).

The other task will be done in 3D view. but during the task,

we want user to have a chance to click point in floor plan view.

 

So if the user wants to do it, they must click plan view window first and then click the point.

(because they were doing other task in 3D view.)

 

but PickPoint already throws exception when they click the window so the user cannot click the point

because the method is terminated.

 

We want to know if there is other way to use PickPoint with changing window.

Hopefully you understand my question.

0 Likes
Message 4 of 10

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @휴엔 ,

I am able to understand your issue.

Let's say you have a 3d view and level 1 floor plan view.

You are saying while using pickPoint you are unable to change the view.

My suggestion is to use a Tile view

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2020/EN... 

 

By using the tile view option, open 3d view, and Level 1 floor plan view.

PickPoint always uses the Active UI document.

Here are the steps to achieve what you want

1)Make tile views (i.e)open 3d view and floor plan view as tile views

2)Do your task in the 3D view

3)The changes will be reflected in the floor plan view

4)As you said just click the plan view window before selecting the point. This will make the floor plan view window document as the active UI document.

5)Now you are able to select the point in the Floor Plan view.

 

I hope this solves your problem.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 10

휴엔
Participant
Participant

Thank you for the answer.

 

So before doing PickPoint, the Active UI document must be set to the plan view, is that right?

It seems PickObject can change Active UI document during selecting elements,

But PickPoint cannot change it during selecting its point.

 

We are aware of the solutions you suggested. We just wanted to figure out that PickPoint can change active UI document during selection time just like PickObject can do.

0 Likes
Message 6 of 10

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @휴엔 ,

Yes, Your observations are correct.

 

As per my understanding,

PickObject => Prompts the user to select one object. So here you can change the view and select an object.

But 

PickPoint => Prompts the user to select a point on the active work plane. So I think changing the view makes the active work plane to change. So the error shows up

 

PickObject=>https://www.revitapidocs.com/2018.1/ce1d67ae-e180-5215-81cf-994b66929d7f.htm 

PickPoint =>https://www.revitapidocs.com/2018.1/a1d40214-13d6-2e11-36bb-905d49105168.htm 

 

I think this is what happens.

 

Here is the link about WorkPlane

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/CloudHelp/cloudhelp/2020/EN... 

 

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 7 of 10

jackmrdoctor
Contributor
Contributor

Did you solve this problem? i got the same issue with PickPoint method as well. Can not switch view while using PickPoint

0 Likes
Message 8 of 10

휴엔_채두원
Participant
Participant

Unfortunately, we were unable to resolve the issue.

Anyway, thank you for leaving a comment.

0 Likes
Message 9 of 10

longt61
Advocate
Advocate

Hi @휴엔 ,

I think the root of the problem is the working plane (or the View.SketchPlane) of the view. Revit wants to make sure that you would click on a certain plane so that it can infer the coordinate of the point. I also tried switching view with the same working plane during PickPoint() operation, but it does not work, either. I find this limitation is strange since the 2 views share the same work plane, therefore switching views should not affect the point 's coordinate.

A work around I can think of is that you should put you PickPoint() operation in a conditional loop by checking the exception and active view to handle user switching view and user abort the operation by pressing "Esc". Something like this:

 

 bool isContinue = true;
 ElementId viewId = uidoc.ActiveGraphicalView.Id;
 XYZ point = null;

 while (isContinue)
 {
     try
     {
         point = uidoc.Selection.PickPoint();
     }
     catch(Autodesk.Revit.Exceptions.OperationCanceledException ex)
     {
         // user intentionally abort the operation in original view instead of switching view
         if (viewId == uidoc.ActiveGraphicalView.Id)
         {
             isContinue = false;
             point = null;
         }
     }
 }
 return point;

 

Besides, you might want to check if the new view has work plane or if the work planes are the same. 

 

0 Likes
Message 10 of 10

jackmrdoctor
Contributor
Contributor

Thank you so much. It works for me now. But it's funny if i want the command finish, i have to go back to the original view. Then the command will finish. I think it is to do with this line.
if (viewId == uidoc.ActiveGraphicalView.Id)
{
isContinue = false;
}

0 Likes