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: 

WallType assigning new CompoundStructure vs modify existing

13 REPLIES 13
Reply
Message 1 of 14
Scott_Wilson
1311 Views, 13 Replies

WallType assigning new CompoundStructure vs modify existing

Hello all,

 

I'm using Revit 2015 API to duplicate a wall type so that I can create custom types with new compound structures. I found some odd behaviour and wanted to know if there is something I'm missing or whether this is a bug.

 

My first approach was to duplicate a wall type of WallKind.Basic, create a list of layers with width, function and material id all set then create a new compound structure using CompoundStructure.CreateSimpleCompoundStructure() passing in my list of layers.

 

After assigning the new compound structure to the duplicated wall type, the new type was fine except that none of the materials were displayed correctly (all dark grey like the default material). Btw, the materials used are simple coloured materials without any appearance assests assigned. When I checked the properties and layer structure of the new wall type everything looked as it should, the correct layers were assigned and the layer structure preview even showed the layers in thier correct colours.

 

I tried a few things like working with duplicates of different wall types and re-assigning the materials to each layer again using SetMaterialId but nothing changed the behaviour.

 

Finally I tried using the existing compound structure of the duplicated wall type and used SetLayers() on it with the exact same list of layers I was using previously with CreateSimpleCompoundStructure() and everything worked fine, all layers displayed in correct colours. This confirms to me that the problem does not lie with the materials I'm using or the way I have constructed the layers, but is caused by assigning a compound structre created using CreateSimpleCompoundStructure.

 

So, in summary my problem is solved, but I'm interested if anyone knows why using CreateSimpleCompoundStructure doesn't work properly, is there a property I need to set somewhere or is it possibly a bug in the API?

13 REPLIES 13
Message 2 of 14
Scott_Wilson
in reply to: Scott_Wilson

Either no one else has seen this problem or my wall of text is just too much reading? Smiley LOL

 

In case it is the latter, I'll summarise further and provide the example code and project file.

 

If I take an existing WallType and assign a new CompoundStructure that was created using CompoundStructure.CreateSimpleCompoundStructure() the materials are not displayed correctly (they are all grey like the 'Default' material with no layer seperation visible even in a section view).

 

If I instead get the WallType's existing CompoundStructure and just replace its layers with exactly the same list of layers as used before, then assign the modified CompoundStructure back to the WallType everything is fine. Because of this I'm certain that the problem is not with the layers I've created or the materials being used. It is something caused by CreateSimpleCompoundStructure().

 

I suspect that it is a bug in the API, but it could also be that there is something I am unaware of that needs to be done to a new CompoundStructure before the material colours will display correctly.

 

See attached zip file for an example solution and project document (Revit 2015) that demonstrates the behaviour. For convenience, the build script in the solution will install the add-in application to $(ProgramData)\Autodesk\REVIT\Addins\2015\

Message 3 of 14
Scott_Wilson
in reply to: Scott_Wilson

Ok, one last bump so see if I can get someone to check this out. I'm pretty sure it is a bug in the API so it would be good if Arnošt or someone else from Autodesk could download and test the add-in and project document attached to my previous post.

 

On a side note, admittedly I haven't really looked too hard, but I'm not sure how I could go about submitting a bug report myself. Can someone point me in the right direction? I should add that I'm not an ADN member, just incase that would be a problem.

Message 4 of 14
jeremytammik
in reply to: Scott_Wilson

Dear Scott,

 

Thank you for reporting this and for your patience and perseverance.

 

Sorry for missing this one and that noboby else picked it up so far.

 

I escalated it to the ADN DevHelp queue.

 

That should do the trick.

 

Cheers,

 

Jeremy

 



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

Message 5 of 14
GeomGym
in reply to: jeremytammik

I think this relates to my request also

http://forums.autodesk.com/t5/revit-api/set-a-new-floortype-from-the-api/td-p/5098648

 

although I asked about floors and not walls.

 

Cheers,

 

Jon

Message 6 of 14
jeremytammik
in reply to: GeomGym

Dear Scott,

 

Thank you for your report.

 

I logged the issue REVIT-47356 [CreateSimpleCompoundStructure materials display wrong] with our development team for this on your behalf as it requires

 

further exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

They have alread taken a first look at it and recognised it as a major issue.

 

Dear Jon,

 

Thank you very much for pointing out the related issue that you already reported, which was escalated to ADN as case 09702495 [Set a new floortype from the API].

 

I added a note of that to the development team issue issue REVIT-47356 as well.

 

Best regards,

 

Jeremy



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

Message 7 of 14
Scott_Wilson
in reply to: jeremytammik

Yay! Another API bug gets hauled off to the firing squad.

 

I imagine that API bugs look similar to my avatar pic 🙂

Message 8 of 14
jeremytammik
in reply to: Scott_Wilson

🙂

 

lol

 

i love that one!

 

cheers,

 

jeremy



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

Message 9 of 14
jeremytammik
in reply to: Scott_Wilson

Dear Scott,

 

Thank you for your report and patience.

 

I am sorry to say that the firing squad has much less to do with this issue than we all expected.

 

In fact, maybe somebody else needs to be disciplined in one way or another.

 

After some careful analysis by one of the few people who know the internals of everything, we reached the following conclusion on this:

 

The issue REVIT-47356 [CreateSimpleCompoundStructure materials display wrong] is moot, almost.

 

The only thing required is a documentation enhancement:

 

You cannot apply the result of CreateSimpleCompoundStructure to a wall type, you must use CreateVerticallyCompoundStructure.

 

1. This does not appear to be documented. Remarks should be added to the documentation on CreateSimpleCompoundStructure and CreateVerticallyCompoundStructure.

 

2. HostObjAttr::setCompoundStructure only throws an exception if its input is vertically compound and the derived type does not support it (everything except walls). It does not throw when the opposite situation is encountered: a simple compound structure is passed to a wall type.

 

If the user replaces CreateSimpleCompoundStructure with CreateVerticallyCompoundStructure the problem should go away.

 

The issue will remain open until the documentation is updated and extra validation added to SetCompoundStructure.

 

I hope this helps.

 

Best regards,

 

Jeremy



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

Message 10 of 14
jeremytammik
in reply to: jeremytammik

I published a summary of this discussion and cleaned up my answer to it a bit here:

 

http://thebuildingcoder.typepad.com/blog/2014/11/traditional-3d-printed-vertical-compound-structures...

 

Cheers,

 

Jeremy



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

Message 11 of 14
Scott_Wilson
in reply to: jeremytammik

Thanks Jeremy I'll check it out.

Message 12 of 14
Scott_Wilson
in reply to: Scott_Wilson

I've looked around a bit and I can't seem to find the CreateVerticallyCompoundStructure() method anywhere. Which class does it reside in?

Message 13 of 14
jeremytammik
in reply to: Scott_Wilson

Hi Scott,

 

He-he... I faced the same dilemma. The statement above is a quote from the developer. Please look at my blog post for a more reliable answer that I verified myself:

 

http://thebuildingcoder.typepad.com/blog/2014/11/traditional-3d-printed-vertical-compound-structures...

 

By looking at the Revit API documentation, RevitAPI.chm... not by implementing and testing, though.

 

Now I'm off to AU. See you there?

 

Cheers

 

Jeremy



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

Message 14 of 14
Scott_Wilson
in reply to: jeremytammik

Thanks again, I'll take a better look and run some tests.

 

As for AU, unfortunately not, maybe another year. Have fun in Vegas.

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