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: 

Custom properties...

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Wolfgang.B.Weh
1123 Views, 3 Replies

Custom properties...

Dear All,

I've managed to add custom properties to model items which are visible in the properties panel.
Is it also possible to add properties which are not visible to the end-user?
Or alternatively, is it possible to make properties read-only or locked or so?

I also want to store some generic custom properties in the document.
In AutoCAD I use the Named Objects Dictionary (NOD) for that.
Where to store such data in Navisworks?

Many Thanks & Best Regards

Wolfgang

3 REPLIES 3
Message 2 of 4

hi,

 

custom property cannot be set readonly/visible currently. you could pop out your own dialog of property. Thus you can control their visibility or readonly. Of course you have to ask the user not to open native property dialog, in case they do modification.

 

 

Navisworks API provides Document Database, which allows you to store information with the document. <Nw path>\api\net\examples\Basic Examples\CSharp\WPF is a demo. So by this mean, you could consider to display the properties temporarily, instead of adding them to the object.  

Message 3 of 4

Thank you Xiaodong Liang,

using the database works fine for me.

One note for others who go done the same route.

It's important that you dispose the database object in time, e.g. before you open or create a different document.

In my situation "Using" was the easiest way to achive that.

Here's a VB.Net code snippet:

Using database As DocumentDatabase = Autodesk.Navisworks.Api.Application.ActiveDocument.Database

   Using trans As NavisworksTransaction = database.BeginTransaction(DatabaseChangedAction.Edited)

      Dim cmd As NavisworksCommand = trans.Connection.CreateCommand()

      cmd.CommandText = " some SQL statement... "

      Try
         Dim affected As Integer = cmd.ExecuteNonQuery()
         trans.Commit()

      Catch ex As Exception
         trans.Rollback()

      End Try

   End Using

End Using

Best Regards

Wolfgang

 

Message 4 of 4

Hi Wolfgang,

 

much appreciate your trick to use Database API! It is also helpful to me 🙂

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

Post to forums  

Rail Community


Autodesk Design & Make Report