Datatools CADWorx Xdata Values with SQL Query

Datatools CADWorx Xdata Values with SQL Query

Anonymous
Not applicable
1,647 Views
6 Replies
Message 1 of 7

Datatools CADWorx Xdata Values with SQL Query

Anonymous
Not applicable

Hello,

I am trying to find a way to have Navisworks lookup a CADWorx Xdata value from an object and find the same value in the sql db in order to pull additional data. I have managed to currently link a CADWorx Property to sql, but that is only because CADWorx has a Tab that is automatically visible in Navisworks with the basic properties, but the property I need is not shown in the tab. It is limited to only a few properties. See image. So I am trying to find a connection string that will allow XDATA values?  I have also attached an image with one of the xdata values I would like to retrieve from Navisworks. Any ideas or is this even possible?

 

Thanks,

Jgarza

0 Likes
1,648 Views
6 Replies
Replies (6)
Message 2 of 7

dgorsman
Consultant
Consultant

There's no way to read arbitrary XDATA in Navisworks.   Normally for this you would be using the DBCode property.  Otherwise, consider using a custom property, possibly filled from the SQL database inside CADWorx. You might even fill it using a live database.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 3 of 7

Anonymous
Not applicable

@dgorsman,

What do you mean consider using custom property , possibly filled from a sql database inside CADWorx?

I thought CADWorx used Xdata from within the drawings and also external db's. So how would it be possible to fill in a custom property automatically with data?

 

Thanks, but I might also be on to a workaround. I am now trying to determine to what extents does the sql connection string uses sql functions. Here is a sample of the code I am trying to make work in order to get what I need accomplished but it looks like I am missing a small piece now. Maybe someone can shed some light.

 

What I am trying to do is use the handle id,(which starts over for every dwg) and use the drawing source name which for me makes it unique at the moment, but I also have to introduce the fact that xref's are used and now I have to stripe out the file path to just include the file name, just like the source file property. But I am having issues determining how the data tools connection strings uses the sql functions or select statements. I know this sql statement works up to using the Xref category, so this is where I am stuck now, because I know this sql works on my sql server.

 

SELECT * FROM [CADWorxTest] WHERE "000_Handle" = %prop("Entity Handle", "Value") and("Drawing" = %prop("Item", "Source File") or "Drawing" = %prop("Xref", ltrim(rtrim(REVERSE(substring(reverse("Name"),0,charindex('\',reverse("Name"),0))))));

 

0 Likes
Message 4 of 7

dgorsman
Consultant
Consultant

You're on the right track for inside Navisworks, using a dual-key handle/filename system. 

What I was referring to was using some custom programming inside Autocad, to populate a CADWorx custom property with a unique lookup key that's easier to work with.  If you wanted a more database-centric solution you could backfill custom properties in the live database (SQL or Access) using SQL statements that call from your SQL database. 

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 5 of 7

Anonymous
Not applicable

Thanks,

But I am still trying to find out if we are able to use sql functions on Navisworks properties. It doesn't seem like it wants to accept them. I even tried some very simple ones. If not then I am going to have to do all the processing in the db and queries.

 

Jgarza

0 Likes
Message 6 of 7

Anonymous
Not applicable

I am also noticing that you are not allowed to use Categories and Properties that are not visible on tabs. I tried to perform a simple sql string that includes the following and it will not connect. Like I said at the beginning, either we are not allowed to use none display properties or it doesn't like paths. I am trying to get the last piece of the pie, so I can accomplish what I need. I need to connect to the "Xref" and "Name" due to the fact that drawings are normally xref into other drawings. So this piece will make a unique id. is it possible to use the listed Category and Property?

 

Any help or solution is greatly appreciated. Below is the simple sql.

 

SELECT * FROM [CADWorx] WHERE "Dwg_Path" = %prop("Xref", "Name");

 

They both contain the exact same path...

C:\Test\123.dwg

 

 

So what are the limitations. What can we use for a sql statements as far as categories and properties and are sql functions allowed against properties values?

 

0 Likes
Message 7 of 7

gennadyKhkh
Enthusiast
Enthusiast

Hello, 

i'm wonder if you got any resutls from your investigations to use outside SQL DB. Do you have working sample?

 

Another idea could be to use OE directly with API.

So far xdata reader is not available in Navisworks 2023. I'm hopping that Navisworks COM portion can expose some interface with OE. Having source code available for OE i can post xdata via such interface easily.

 

With not much detailed docs this forum is good place to discuss different scenarios.

Thank you,

Gennady

0 Likes