Navisworks API

Reply
Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 1 of 17 (338 Views)

Get all selected viewpoint

338 Views, 16 Replies
08-16-2012 11:17 AM

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

ADN Support Specialist
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 2 of 17 (324 Views)

Re: Get all selected viewpoint

08-21-2012 06:10 PM in reply to: ssdiesel

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



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 3 of 17 (320 Views)

Re: Get all selected viewpoint

08-21-2012 06:19 PM in reply to: xiaodong.liang

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

ADN Support Specialist
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 4 of 17 (315 Views)

Re: Get all selected viewpoint

08-21-2012 06:39 PM in reply to: ssdiesel

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. 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 5 of 17 (313 Views)

Re: Get all selected viewpoint

08-21-2012 06:43 PM in reply to: xiaodong.liang

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?

ADN Support Specialist
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 6 of 17 (309 Views)

Re: Get all selected viewpoint

08-21-2012 06:57 PM in reply to: ssdiesel

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.



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 7 of 17 (307 Views)

Re: Get all selected viewpoint

08-21-2012 07:07 PM in reply to: xiaodong.liang

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?

 

ADN Support Specialist
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 8 of 17 (303 Views)

Re: Get all selected viewpoint

08-21-2012 07:21 PM in reply to: ssdiesel

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;

 

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 9 of 17 (301 Views)

Re: Get all selected viewpoint

08-21-2012 07:27 PM in reply to: xiaodong.liang

Thanks alot!

You very help me!

Contributor
ssdiesel
Posts: 20
Registered: ‎02-07-2012
Message 10 of 17 (288 Views)

Re: Get all selected viewpoint

08-22-2012 05:36 AM in reply to: ssdiesel

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community