Retrieving the file path of nested CAD files

Retrieving the file path of nested CAD files

btmsoftware
Advocate Advocate
749 Views
6 Replies
Message 1 of 7

Retrieving the file path of nested CAD files

btmsoftware
Advocate
Advocate

in Revit 2016, I can get the list of the CAD files attached (in this instance, AutoCAD) and their path using something like

 

 

Select Case extRef.ExternalFileReferenceType
	Case ExternalFileReferenceType.CADLink
		dim filepath as string = ModelPathUtils.ConvertModelPathToUserVisiblePath(extRef.GetAbsolutePath)

	Case ....	

 

However, in the case this CAD file has xRefs/Images (images which by the way are not displayed in Revit), I only get the file path of the 'master'.

 

does anybody have any idea how I can also find the list of the the master's xRefs (and their path) as well, as, if they exists, their nested xRefs ?

 

0 Likes
Accepted solutions (1)
750 Views
6 Replies
Replies (6)
Message 2 of 7

jeremytammik
Autodesk
Autodesk
Accepted solution

The Revit API does not enable you to dive into the internals of a DWG.

 

You can use the AutoCAD.NET API to achieve that.

 

You can easily use the AutoCAD.NET API from within your Revit add-in, provided you have both AutoCAD and Revit installed.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 7

btmsoftware
Advocate
Advocate

As usual, thanx Jeremy for the quick answer...

 

Yes I could however, that would mean that AutoCAD MUST be installed on the machines running Revit too, which on my dev/test environment is the case.

 

Actually, if it a requirement to be able to links an AutoCAD file in a Revit project to have AutoCAD on the machine ?

 

Since Revit itself does it (the nested xRefs are indeed displayed), that means that Revit itself can do it, therefore ,next question:

 

What would it take to convince Autodesk to include that feature in the API in a next SP/Release ? And whom should I get in touch with ?

 

 

0 Likes
Message 4 of 7

btmsoftware
Advocate
Advocate

Hi Jeremy,

 

Sorry for the delay before responding, got side tracked 😉

 

I can get the list of the CAD Links and the file name therefore, indeed, I could use AutoCAD and MicroStation to get their nested references but then, would you know if there's anything (couldn't find anything) to find out if the link is an AutoCAD or a Microstation file ?

 

the reason is that if it's an AutoCAD file, I don't want to waste time starting up MicroStation and vice-versa....

0 Likes
Message 5 of 7

jeremytammik
Autodesk
Autodesk

Nope, sorry.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 7

Dale.Bartlett
Collaborator
Collaborator

Isn't .DGN or .DWG part of the returned filename?




______________
Yes, I'm Satoshi.
0 Likes
Message 7 of 7

btmsoftware
Advocate
Advocate

yes, if you use the default extension but who's to say that it will be the case on every machine, for every customer....

 

I have often seen at customer sites that they use an extension for the masters and another for the xRefs so they can visually see in windows Explorer what kind of file it is (I'm not saying it's the right way to go but it's one way.... ) 

 

As a rule of the thumb, I never depend on the extension of a file to determine what it is. For example, .DOC is used by a big lot of software and it would be a big mistake to assume it's Microsoft Word.

 

0 Likes