Split wall

Split wall

BenoitE&A
Collaborator Collaborator
9,695 Views
20 Replies
Message 1 of 21

Split wall

BenoitE&A
Collaborator
Collaborator

Hey,

I want to split a wall in 2 at a given point of its LocationCurve that I can compute. Then I will delete one of the 2 parts which is useless.

I could use the PostCommand corresponding to the UI (SplitFace) but it requires the user to do manually the cut while I compute automatically the position of the cut, which is more precise and easier.

Any idea?

Use InstanceVoidCutUtils? 

Benoit


Benoit FAVRE
CEO of etudes & automates
www.etudesetautomates.com/
0 Likes
Accepted solutions (2)
9,696 Views
20 Replies
Replies (20)
Message 2 of 21

Revitalizer
Advisor
Advisor

Hi,

 

you can set Wall's LocationCurve with another curve.

Note:

If your Wall's LocationCurve is a straight line, so must be the target curve.

If it is an Arc, target curve must be an Arc, too.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 21

BenoitE&A
Collaborator
Collaborator

Interesting, but how do you do that?

Location is Lecture only.

You find the parameter and replace it? Can you give me a hint?

 

Thanks

Benoit


Benoit FAVRE
CEO of etudes & automates
www.etudesetautomates.com/
0 Likes
Message 4 of 21

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

I thought it had been discussed in this forum, but I'm wrong.

Here you are:

https://boostyourbim.wordpress.com/2018/08/09/biltna2018-wish-granted-align-a-straight-wall-with-a-c...

 

The idea is:

(yourWall.Location as LocationCurve).Curve = yourShortenCurve;

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 5 of 21

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi @BenoitE&A,

 

It looks what you need is the feature Split Element. As the other post mentions, the API is not yet exposed. 

https://forums.autodesk.com/t5/revit-api-forum/split-wall-using-revit-api/td-p/6562014

 

While with current API, it is feasible to do something. I did some investigation today and made it working with Line Wall. The code tells the logic how to split the wall by the middle point. you could apply it with the point you calculated. 

 

It will need more work with other types of wall: Arc, Eclipse, Spline, Nurbus, but I'd think the logic would be similar. Hope it could help you a bit. 

 

btw,  what @Revitalizer shared is about aligning wall to a given curve, which is also interesting to know.

 

 

 void splitWall(Document rvtDoc)
        { 
            Transaction trans = new Transaction(rvtDoc);
            trans.Start("mysplitwall");

            FilteredElementCollector FEC = new FilteredElementCollector(rvtDoc).OfCategory(BuiltInCategory.OST_Walls);
            IList<ElementId> wallids = FEC.ToElementIds() as IList<ElementId>;

            foreach (ElementId wallid in wallids)
            {
                Element e = rvtDoc.GetElement(wallid);
                if (e.Location == null) continue;
                Wall wall_1 = e as Wall;

                Curve wallCurve = ((LocationCurve)wall_1.Location).Curve;
                double stParam = wallCurve.GetEndParameter(0);
                double endParam = wallCurve.GetEndParameter(1);

                XYZ stPoint = wallCurve.Evaluate(stParam, false);
                XYZ endPoint = wallCurve.Evaluate(endParam, false);

                //assume split the wall in the middle point
                double midParam = (endParam - stParam) / 2.0;
                XYZ midPoint = wallCurve.Evaluate(midParam, false);

                if (wallCurve is Line)
                {
                    Line newLine1 = Line.CreateBound(stPoint, midPoint);

                    //becasue we will update endpoit of original wall,
                    //check if the endpoint has been joined with another successive wall 
                    //disallow the join, in order to update the endpoint
                    if (WallUtils.IsWallJoinAllowedAtEnd(wall_1, 1))
                        WallUtils.DisallowWallJoinAtEnd(wall_1, 1);

                    //align original wall with the new curve
                    ((LocationCurve)wall_1.Location).Curve = newLine1;

                    //because the successive wall will also update endpoint (its first segment)
                    //create new wall on the second segment of the first wall directly
                    //then the new wall and successive wall will be joined automatically 
                    Line newLine2 = Line.CreateBound(midPoint, endPoint);
                    Wall wall_2 = Wall.Create(rvtDoc, newLine2, wall_1.LevelId, false);

                }
                else if (wallCurve is Arc)
                {

                }
                else
                {
                    //other types of Walls
                }
            }
            trans.Commit();
        }

 

 

 

 

0 Likes
Message 6 of 21

BenoitE&A
Collaborator
Collaborator

Hi Revitlizer,

I took me some time to find I had to Disallow Join so that the function work but it does work now.

Thank you !!

Benoit


Benoit FAVRE
CEO of etudes & automates
www.etudesetautomates.com/
Message 7 of 21

BenoitE&A
Collaborator
Collaborator

Thanks, you arrived to the same conclusions as I did, using Revitilizer's hint.

Thank you !

Benoit


Benoit FAVRE
CEO of etudes & automates
www.etudesetautomates.com/
0 Likes
Message 8 of 21

m.vallee
Advocate
Advocate

Hi,

 

Can someone from Autodesk (maybe @jeremytammik ?) tells us if it's in Autodesk plans to include the "Split"/"Split with Gap" functions in the Revit API, one day or another ? This has been asked for about three years now on Revit ideas : https://forums.autodesk.com/t5/revit-ideas/make-api-methods-for-split-split-with-gap/idc-p/6882521#M....

 

The workaround explained here by @Revitalizer and @xiaodong_liang is really well thought, but after giving it a try, it has drawbacks :

  • if splitted walls are also rooms' boundaries, rooms get messed up
  • if splitted walls contain nested family instances like doors or windows, as you cannot rehost them to the correct wall, you have to recreate them, copy their parameter values, with the inconvenient they do not have the same Revit Id anymore, and delete the originals...

Best regards.

 

Maxime

Message 9 of 21

jeremytammik
Autodesk
Autodesk

Dear Maxime,

 

Thank you for your request.

 

Many thanks to Harry Mattison of Boost your BIM, Revitalizer and Xiaodong for the workaround!

 

Sorry to hear it has those flaws.

  

We used to have a Revit API development wish list item CF-802 [API wish: split duct or pipe like 'Split Elements' command]:

 

Request: I would like to split a Duct or a Pipe in a way that retains the intact Revit functionality.

 

The user interface provides a command to split walls via Modify > Split Element > Split with Gap.

 

How can I programmatically achieve something similar to split a duct or a pipe?

 

The 'Split Element' command that does work for Ducts and Pipes.

 

You suggest to remove the taps and then recreate them. In the UI, the extend method will only create the tap again if it is also defined in the DuctType and if the Preferred Junction Type is set to Tap. Furthermore, another thing that needs to be taken into account is that certain parameters might be set for the duct or pipe. and all of these parameter values will need to be copied to the newly created segment as well.

 

The function 'Split Elements' provided by the user interface does all of this automatically: it will just split the Duct and add a union family in between. That is exactly what I would like to achieve programmatically as well.

 

The development team replied:

 

Our internal method for splitting the MEP curve is wrapped pretty well. Please log an API request if the MEP curve split is a frequent customer need. Similarly, for setting the duct/pipe end positions, especially for a new unconnected curve.

 

I notice our UI does not support “Split with GAP” for ducts/pipes. For walls, the two split walls remains locked even if they are physically separated. That would be something unavailable to pipes/ducts.

 

According to the comments on that wish list item, it was implemented and closed with resolution 'fixed' in the Revit 2017 timeframe.

 

I do see the BreakCurve method in the API, but unfortunately only for pipe and duct curves:

 

https://apidocs.co/apps/revit/2019/3c302b80-d1f8-0e17-154a-b809cad2e545.htm

 

Consequently, I logged a new issue CF-4916 [API wish: split wall like 'Split with gap' -- 14929026] 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.

 

You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.

 

This issue is important to me. What can I do to help?

 

This issue needs to be assessed by our engineering team and prioritised against all other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:

 

  • Impact on your application and/or your development.
  • The number of users affected.
  • The potential revenue impact to you.
  • The potential revenue impact to Autodesk.
  • Realistic timescale over which a fix would help you.
  • In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.

 

This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 10 of 21

m.vallee
Advocate
Advocate

Hi @jeremytammik 

 

Thanks for your answer.

 

Personnally I just need the "Split" function to be available in the Revit API, not the "Split with Gap" function (but maybe the "gap" could just be a parameter in the method). It would be used to split wall instances in a custom plugin our teams really look after. 

 

It would be very nice if the development team could solve this problem as quickly as they did with the "pipes" equivalent issue.

 

Maxime

0 Likes
Message 11 of 21

aignatovich
Advisor
Advisor

Hi, Jeremy!

 

I'm also interested in the ability to split walls via API, but it is more interesting for me to split them horizontally by levels.  It can be easily done, for example for columns using FamilyInstance.Split method.

 

Impact on your application and/or your development: I have a workaround, but it has a lot of restrictions and sometimes it produces bad results.

The number of users affected: 5-10%

The potential revenue impact to you / The potential revenue impact to Autodesk. Structural Revit models differ from architectural ones. In most cases, I faced with, in structural models walls are splitted by levels. So there are a bunch of tools (my and I believe from other developers too) to prepare a model for constructors. They are useful and reduce time and cost. They can produce much better results if the API would contain this method.

 

Thank you!

 

0 Likes
Message 12 of 21

jeremytammik
Autodesk
Autodesk

Thank you, Maxime and Alexander, for you updates and business case, which I added to the wish list item CF-4916 [API wish: split wall like 'Split with gap' -- 14929026].

 

For the sake of completeness, you should also ensure there is an entry for this in the Revit Idea Station and vote for that. You can mention this development issue number there as well.

 

Cheers,

 

Jeremy

 



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

0 Likes
Message 13 of 21

m.vallee
Advocate
Advocate

Hi Jeremy,

 

Do you have new information from the dev team ?

 

Thanks in advance.

Best regards.

 

0 Likes
Message 14 of 21

jeremytammik
Autodesk
Autodesk

Nope, nothing new. I added a prompt for an updated status to the wish list item.

 



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

0 Likes
Message 15 of 21

Anonymous
Not applicable

My team is also looking for this API capability. The ability to split walls without having to recreate it, and the hosted elements. Is there anything else we can do to help raise the priority for this?

 

Thanks @jeremytammik !

 

0 Likes
Message 16 of 21

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

Yes, please vote for the wish list item in the Revit Idea Station.

 



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

0 Likes
Message 17 of 21

xavier.kedzierski
Explorer
Explorer

Hello Jeremy, how can we request an update on CF-4916?

 

Thank you!

Message 18 of 21

jeremy_tammik
Alumni
Alumni

Dear Xavier,

 

Asking right here is fine, just as you did.

 

I checked the development ticket and see no new activity on that, I'm afraid.

 

I asked the development team for an update and their plans with it for you.

 

Cheers,

 

Jeremy

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 19 of 21

gernot_luidoltSWIE
Explorer
Explorer

Hello everybody!

Is there an update about exposing this API call? wish list item CF-4916
It would be very helpful for several workflows I want to implement.

Thanks,
Gernot

0 Likes
Message 20 of 21

jeremy_tammik
Alumni
Alumni

Dear Gernot,

 

Thank you for checking again. I still see no new activity on that development ticket. I added a note of your request to it and re-prompted the development team again for an update and their plans with it. I'll let you know if and when I hear back from them. 

  

Please also vote for the wish list item in the Revit Idea Station:

  

https://forums.autodesk.com/t5/revit-ideas/make-api-methods-for-split-split-with-gap/idc-p/6882521

    

The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements. The Revit development team looks there. Your comment here in the discussion forum might be overlooked. Thank you!

  

Cheers,

 

Jeremy

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open