Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get all linked DWFx files from in Revit document

6 REPLIES 6
Reply
Message 1 of 7
daniel
592 Views, 6 Replies

Get all linked DWFx files from in Revit document

Hi, 

Im trying to list all links in a document using filteredelementcollectors.. 

 

I get the RVT links (revit and ifc), throug the BuiltInCategory, 

DWG links also works fine using the "ofClass(typeof(importInstance)" filter. 

 

I thought that DWFx and pointclouds also should be listed under this filter? 

 

It seems not to.. I can't get them through that filter, and I can't see any other type to use (by google or api documentation) 

 

Anyone have any tips? 

 

Are DWFx markups an own class? category ?? 

 

tnx 

Daniel 

6 REPLIES 6
Message 2 of 7
jeremytammik
in reply to: daniel

Dear Daniel,

 

Can you please attach a sample file with just one or two links and almost no other content, and tell us exactly what results you would expect to see?

 

Please include everything required to load the file with no warnings, detached from central, all support files included, etc.

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 3 of 7
daniel
in reply to: jeremytammik

Hi, 

I am creating a smal buildable sample now, will send it as soon as possible. 

 

Daniel 

Message 4 of 7
daniel
in reply to: jeremytammik

Hi,

While working on the small sample, I found the error.

It's kind of simple. DWFx does not get linked, even though they appear to be so.

 

When I changed from:

var dwgLinks = fecDwgLinks.OfClass(typeof(ImportInstance)).ToElements().Cast<ImportInstance>().Where(f=> f.IsLinked);

 

to

 

var dwgLinks = fecDwgLinks.OfClass(typeof(ImportInstance)).ToElements().Cast<ImportInstance>();

 

Things worked fine.

 

I have not tried it on pointClouds, but I guess it will work just fine.

 

 

\Daniel

 

Message 5 of 7
jeremytammik
in reply to: daniel

Dear Daniel,

 

Congratulations on solving it, and many thanks for letting us know!

 

You cannot imagine how often problems get resolved by attempting to create a minimal reproducible sample.

 

Could you please post the entire filtered element collector implementation to retrieve the DWF links?

 

Surely just asking for typeof(ImportInstance) will return other links as well?

 

Please also let us know how it goes with the point clouds.

 

Thank you!

 

Cheers,

 

Jeremy



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

Message 6 of 7
daniel
in reply to: jeremytammik

It does return other links aswell, but that is how I want it.

I am creating a tool, which lists all the links.

 

When I use the collected elements, I just use the category name, which contains the extension name.

 

var namearray = importlink.Category.Name.Split('.');

var name = namearray.FirstOrDefault();

var extension = string.Empty;

if (namearray.LastOrDefault() != null)

extension = namearray.Last();

 

 

then I have created an Enum, wich i group a list on..

 

GroupingEnum lType = GroupingEnum.Unknown;

if (extension.ToLower().Contains("dwg"))

lType = GroupingEnum.Dwg;

else if (extension.ToLower().Contains("dwf"))

lType = GroupingEnum.Dwf;

 

 

this is used to group a list, so that it is easy to chose the wanted elements.

 

Daniel

 

 

Message 7 of 7
jeremytammik
in reply to: daniel

Muy maja, Daniel!

 

I summarised the result here:

 

http://thebuildingcoder.typepad.com/blog/2015/08/batch-processing-dwfx-links-and-future-proofing.htm...

 

Cheers,

 

Jeremy



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

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community