Custom properties...

Custom properties...

Wolfgang.B.Weh
Enthusiast Enthusiast
1,472 Views
3 Replies
Message 1 of 4

Custom properties...

Wolfgang.B.Weh
Enthusiast
Enthusiast

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

0 Likes
Accepted solutions (1)
1,473 Views
3 Replies
Replies (3)
Message 2 of 4

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

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.  

0 Likes
Message 3 of 4

Wolfgang.B.Weh
Enthusiast
Enthusiast

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

 

0 Likes
Message 4 of 4

xiaodong_liang
Autodesk Support
Autodesk Support

Hi Wolfgang,

 

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

0 Likes