Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Get all linked DWFx files from in Revit document

daniel
Enthusiast

Get all linked DWFx files from in Revit document

daniel
Enthusiast
Enthusiast

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 

0 Likes
Reply
822 Views
6 Replies
Replies (6)

jeremytammik
Autodesk
Autodesk

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

0 Likes

daniel
Enthusiast
Enthusiast

Hi, 

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

 

Daniel 

0 Likes

daniel
Enthusiast
Enthusiast

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

 

0 Likes

jeremytammik
Autodesk
Autodesk

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

0 Likes

daniel
Enthusiast
Enthusiast

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

 

 

0 Likes

jeremytammik
Autodesk
Autodesk

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

0 Likes