Wall CompoundStructure - Add layers in group named-"Layers Below Wrap"

kailas_dhage
Contributor
Contributor

Wall CompoundStructure - Add layers in group named-"Layers Below Wrap"

kailas_dhage
Contributor
Contributor

Hi All,

 

I am creating wall definition and want to add layers into "Layers Below Wrap" and also mark then to be wrapped. But by default layers are always added into "Layers Above Wrap" and also I am not able to set them as wrapped.

 

Please suggest way to achieve this. Following is code snippet being used to create wall definition.

 

Thanks and Warm Regards,

Kailas Dhage

 

var document = commandData.Application.ActiveUIDocument.Document;
            var collector = new FilteredElementCollector( document ).OfClass( typeof( WallType ) )
                .ToElements();
            var wallDefsrc=collector.OfType<WallType>()
                .FirstOrDefault( tmpDef => tmpDef.Kind == WallKind.Basic );

            if( wallDefsrc== null )
            {
                return Result.Succeeded;
            }

            using( var trans = new Transaction( document, "create wall def" ) )
            {
                trans.Start();
                var wallDefNew = wallDefSrc.Duplicate( "TestWallDef" ) as WallType;
                if( wallDefNew != null )
                {
                    var compStruct = wallDefNew.GetCompoundStructure();
                    compStruct.EndCap = EndCapCondition.Exterior;
                    compStruct.OpeningWrapping = OpeningWrappingCondition.Exterior;
                    var wallLayers = compStruct.GetLayers();
                    var lc = wallLayers.Count;
                    for( var k = 0; k < lc; k++ )
                    {
                        wallLayers.RemoveAt( 0 );
                    }

                    var wla1 = new CompoundStructureLayer( 0.25, MaterialFunctionAssignment.Structure, ElementId.InvalidElementId )
                               {
                                   LayerCapFlag = true
                               };
                    wallLayers.Add( wla1 );

                    var wla2 = new CompoundStructureLayer( 0.125, MaterialFunctionAssignment.Structure, ElementId.InvalidElementId )
                               {
                                   LayerCapFlag = true
                               };
                    wallLayers.Add( wla2 );

                    var wla3 = new CompoundStructureLayer( 0.0625, MaterialFunctionAssignment.Structure, ElementId.InvalidElementId )
                               {
                                   LayerCapFlag = true
                               };
                    wallLayers.Add( wla3 );

                    compStruct.SetLayers( wallLayers );
                    wallDefNew.SetCompoundStructure( compStruct );
                }

                trans.Commit();
            }

            return Result.Succeeded;
2016-12-08_09h58_12.png

 

 

 

0 Likes
Reply
Accepted solutions (1)
979 Views
1 Reply
Reply (1)

matthew_taylor
Advisor
Advisor
Accepted solution

Hi Kailas,

I think you're looking for the SetParticipatesInWrapping function http://www.revitapidocs.com/2017/a0963e2b-4f8c-9117-a0cc-19da424e16d8.htm

and the SetNumberOfShellLayers function http://www.revitapidocs.com/2017/8b8ea4e3-e697-6176-92c0-dc2687723a71.htm

 

There are examples of their use in the SDK.

 

Cheers,

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes