Hwo can I create a standalone wallsweep?

Hwo can I create a standalone wallsweep?

Anonymous
Not applicable
807 Views
3 Replies
Message 1 of 4

Hwo can I create a standalone wallsweep?

Anonymous
Not applicable

I can find a sample what can create a wallsweep in a wall type,
But the walltype was changed,I want to create a standalone wallsweep what can not change the walltype,How can I do?

I can find a little information from JEREMY TAMMIK`s blog.
The Building Coder: Many Issues Resolved
Standalone wall sweeps and reveals may be constructed using the static method Create().

But In the SDK, the mothod is
public static WallSweep Create( Wall wall, ElementId wallSweepType, WallSweepInfo wallSweepInfo)

Because wallSweepType is the ElementId type,I don't know How to use the method. 
Please help me.Thank you;

0 Likes
Accepted solutions (1)
808 Views
3 Replies
Replies (3)
Message 2 of 4

gopinath.taget
Alumni
Alumni

Hello,

 

I have enquired with the engineering team about this. I will get back to you as soon as I have some relevant information.

 

Thanks for your patience.

 

Best Regards,

 

Gopinath

0 Likes
Message 3 of 4

gopinath.taget
Alumni
Alumni
Accepted solution

Hello,

 

My engineering colleagues got back to me with this code snippet to determine the WallSweepTypeId:

 

        private ElementId GetSweepOrRevealTypeId(WallSweepType sweepType)
        {
            FilteredElementCollector wallSweeps = new FilteredElementCollector(RevitDoc);
            wallSweeps.OfClass(typeof(WallSweep));
            Func<WallSweep, bool> IsUnfixedSweep = sweep => !sweep.GetWallSweepInfo().IsFixed && sweep.GetWallSweepInfo().WallSweepType == sweepType;
            return wallSweeps.OfType<WallSweep>().FirstOrDefault<WallSweep>(IsUnfixedSweep).GetTypeId();
        }

        WallSweep sweep = WallSweep.Create(wall, GetSweepOrRevealTypeId(WallSweepType.Sweep), sweepInfo);

 

Another approach to determining the WallSweepType is:

 

FilteredElementCollector collector = new FilteredElementCollector(this.Document);
collector.OfCategory(BuiltInCategory.OST_Cornices);
ElementType wallSweepType = collector.FirstElement() as ElementType;

 

Hope this helps.

 

Thanks

Gopinath

0 Likes
Message 4 of 4

Anonymous
Not applicable

This no problem to run this Code. Thank you very much.

0 Likes