Navisworks API

Reply
Contributor
ssdiesel
Posts: 23
Registered: ‎02-07-2012
Message 1 of 8 (435 Views)
Accepted Solution

Project units

435 Views, 7 Replies
09-11-2012 09:15 AM

Hello!

I want to merge my dxf file with navis drawing:

Autodesk.Navisworks.Api.Document doc = Autodesk.Navisworks.Api.Application.ActiveDocument;
                    if (doc.TryMergeFile(@"C:\test1.dxf"))
 {
                        MessageBox.Show("Merge successful.");
                    }

 But when i merge this files.I open Tree Structure. Navis project has units "Inches", but test1.dxf has milimetres.

 

How can i set inches?

 

Thanks 

Hi,

 

Using the .NET API, we can get the value of the Units for a document using the Document.Units() property. But it returns the units of the first model only. And setting the value is not possible since this property is read-only.

 

Using the COM API does not either help since the part.LinearUnits (where part is InwOaPartition2) is read-only and does not allow us to set the units. 

 

We have had wish to provide the API to set units.

ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 2 of 8 (426 Views)

Re: Project units

09-19-2012 08:35 PM in reply to: ssdiesel

Hi,

 

Using the .NET API, we can get the value of the Units for a document using the Document.Units() property. But it returns the units of the first model only. And setting the value is not possible since this property is read-only.

 

Using the COM API does not either help since the part.LinearUnits (where part is InwOaPartition2) is read-only and does not allow us to set the units. 

 

We have had wish to provide the API to set units.



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 23
Registered: ‎02-07-2012
Message 3 of 8 (421 Views)

Re: Project units

09-19-2012 09:32 PM in reply to: xiaodong.liang
Thx for answer! I found the way to set units without API and COM, but with external application. But for launnch this application i need use external C# reference. I am add this dll in a references. But when i try use some procedures or functions in my plugin Naviworks crash with fatal error.. I tryed to connect other dll (maybe those dll has any errors) wich i wrote by myself, wich show message only.. and the same result Nws was crashed. Is there the way to use external reference?
ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 4 of 8 (409 Views)

Re: Project units

09-24-2012 08:59 PM in reply to: ssdiesel

Hi,

 

The external reference of Navisworks plugin must be put within  <Navisworks installation path>\Dependencies\.

 

I am interested in how you set the unit :smileyhappy: Did you get the handle of the dialog and swtich to the control of the Unit, and mimic changing unit? Is it possible to share some hints? Thank you!

 

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
ssdiesel
Posts: 23
Registered: ‎02-07-2012
Message 5 of 8 (403 Views)

Re: Project units

09-25-2012 08:49 PM in reply to: xiaodong.liang

thanks for answer.

 

well for set units i used some scripts and windows handler. i think its wrong. but...

first of all i get screen size,then automaticaly press "structure view"  button, this button i check by coordinates, 

after i try to find this window, then press other button etc

 

well i know that awful desition, but it works.

 

Best Regards,

Sergey

Valued Contributor
JohnHon
Posts: 54
Registered: ‎03-12-2013
Message 6 of 8 (206 Views)

Re: Project units

11-05-2013 02:22 AM in reply to: xiaodong.liang

Hi all,

 

Is there any updates on setting unit in api?

 

Thanks,

John

ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 7 of 8 (179 Views)

Re: Project units

11-17-2013 07:48 PM in reply to: JohnHon
Hi John,

This is still a wish
#11542: Ability to set the units of a document using .NET API.

I did not hear an update on this. Sorry if this is bad news for you.


Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Valued Contributor
JohnHon
Posts: 54
Registered: ‎03-12-2013
Message 8 of 8 (163 Views)

Re: Project units

11-17-2013 09:27 PM in reply to: xiaodong.liang

Hi Xiaodong.

Sad to hear this news.

How about using Naviswork to change the unit of the model?Is it possible?

Thanks,
John

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.