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

Get all selected viewpoint

18 REPLIES 18
Reply
Message 1 of 19
SergeyShevtsov
1984 Views, 18 Replies

Get all selected viewpoint

Hello!

i need to get list of selected viewpoints , but i can get only last selected view.

and also how can i get position of viewpoint?

 

Thx

18 REPLIES 18
Message 2 of 19

Hi,

 

I am not sure if you are the guy who asked the similar question recently on our blog. The followingis what I replied there:

 

Yes, CurrentSavedViewpoint tells the last selected view points only. Can I know why you want to know the multi-selected items? As I know, only one saved viewpoint can be applied to the current view. If what you wanted is to do some post work after the user multi-selected the viewpoints, I would suggest you create your own panel to manage the viewpoints. Thus you can know multi-selected easily. 

 

As to position of the viewpoint, it is stored with the camera of the viewpoint contains.

1) before 2013, you will need to use COM API    e.g. 

   

     Com.InwNvCamera cam = m_state.CurrentView.ViewPoint.Camera;

     Com.InwLPos3f oPos = cam.Position;

      // .... other properties

 

2) from 2013, .NET API provides the relevant objects. Pleae refer to the blogs:

   http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-viewpoint-1.html

    http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-viewpoint-2.html

    http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-viewpoint-3.html

   http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-saved-viewpoint.html

Message 3 of 19

Hello!

yes its me again.

well i solved this the next folowing (as you sad):

created new dock panel transfer all data from viewpoint,

actually now am working with clash.

but unfortunally Navis cant work with multi - selection.

 

And btw, i want use multi-select for package renaming pointviews.

 

Thx for reply

Message 4 of 19

glad it helps. yes, you could manage flexibly in your own tree. The built-in trees of Navisworks do not always meet the requirement of customization. 

Message 5 of 19

thats right! you absolutly right!

some users dont want to work with newly panels, and want to use standarts panels.

but standarts panels and instuments have a limit.

btw, one more thing. can you tell me when i select viewpoint in mypanel tree, how can i select the same in Navis, i mean that Navis show me a view from this point?

Message 6 of 19

Same to the original question, since API cannot tell the multi-selection, it cannot either apply multi-selection. CurrentSavedViewPoint is a single select. Probably we could setup a wish if it has strong use cases.

 

In product, the scenarios when the user wants to multi-select may be:

 

-          Move them the one folder together

-          Add a copy with these selected items

-          Edit their common properties

-          Transform them with same transformation

-          etc….

In a word, the aim is to get a result, instead of just showing they are multi-selected.

 

So I think, when your user multi-selects in your own tree, he could decide what he what to do. And your program provides the ability to do what he wants. He does not need to concern switch back-forth between the built-in tree and your tree.

Message 7 of 19

sorry, but now i mean not multiselection.

i mean, when we selectin some viewpoint in a "Saved viewpoints" panel, Navis shows this point view in a model.

how can i make it with my panel of viewpoints tree?

 

Message 8 of 19

it sounds you need to apply the saved viewpoint (if multi-selection, the last saved viewpoint) to the current viewpoint in model? If yes, with COM API, you can just call state.ApplyView with the last saved viewpoint. If you are working with 2013, you can use pure .NET API to manage, e.g. oDoc.SavedViewpoints.CurrentSavedViewpoint =  oLastSavedViewPoint;

 

 

Message 9 of 19

Thanks alot!

You very help me!

Message 10 of 19

btw i am noticed a little strange.

when i get viewpoint position (SavedItem.Viewpoint.Position.X,Y,Z) and after that i am compare with coordinate (viewpoint>edit>position) those data have not same values.

for example

SavedItem.Viewpoint.Position.X = 2028,7496

but in a property window Position X = 71,74

why that happens?

thx

Message 11 of 19

unit affects this. API shows the value in document unit, while product uses meter. You can see a small 'm' atfer the values in the dialog viewpoint>edit>position.

Message 12 of 19

ok.. but how can i translate units coordinates in meters?

Message 13 of 19

I do not think it will be difficult for you to convert the values in different units, though Navisworks API does not provide the conversion.

 

btw, the document unit is told by Document.Units

Message 14 of 19

actually i dont get it how can i transform sv.Viewpoint.Position.X = 2028,...

into meters with Document.Units - enum class

 

Message 15 of 19

no Navisworks API, but this is a math question. e.g.

 

if the document unit is foot. while 1 foot = 0.3048 meter. thus the value in meter is : value * 0.3048

 

does this make sense?

Message 16 of 19

Now i get it, what you want to tell me..

with Document.Units we get default doc units and after that we translate it!

 

Thx for help!

 

Message 17 of 19

exactly! glad my comment could help 🙂

Message 18 of 19

I am so aggrevated by the Navisworks API/Documentation

 

It's the simplest things that drive me crazy.  

 

How does someone get a collection or array of the savedViewpoints?

 

I can get one viewpoint, but i want to loop thru all of them.  And I want to detect where they are in the "View" tree in the Navisworks UI, like if the viewpoint is in a folder.

 

Is there a website that I'm missing that has sample codes of Navisworks scripts?  This seems extremely poorly documented.  

 

 

0001D LLC. Where Design, Genetics, and Technology Overlap www.0001design.com
Message 19 of 19

Hi genscripter,

 

I’d apology for any inconvenience our API document caused. Our document is in the progress to be better. We appreciate any of your comments.

 

I am struggling to understand your question because of the other forum thread you are discussing in. if you just need to get the collection of saved viewpoints, the way is direct. Here is the blog:

http://adndevblog.typepad.com/aec/2012/06/navisworks-net-api-2013-new-feature-saved-viewpoint.html

 

but, I think you actually wanted to get the collection of selected viewpoints, as you mentioned in the other thread. I will reply there.

 

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

Post to forums  

Rail Community


Autodesk Design & Make Report