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: 

Edit existing slab boundary

19 REPLIES 19
SOLVED
Reply
Message 1 of 20
GeomGym
7175 Views, 19 Replies

Edit existing slab boundary

Hi,

 

As per the comments on this blog post (http://thebuildingcoder.typepad.com/blog/2008/11/editing-a-floor-profile.html ),  I'd also like to see the functionality to be able to edit an existing slab (rather than delete and create a new one).  I can't see that this is available, would be great to see this enabled.

 

Thanks,

 

Jon

19 REPLIES 19
Message 2 of 20
jeremytammik
in reply to: GeomGym

Dear Jon,

Yes, I fully agree.

Here is another vaguely related much more recent discussion:

http://thebuildingcoder.typepad.com/blog/2013/07/create-a-floor-with-an-opening-or-complex-boundary....

Have you looked at the SlabShapeEditor class?

Best regards,

Jeremy



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

Message 3 of 20
GeomGym
in reply to: jeremytammik

Hi Jeremy,

 

Thanks for the reply, SlabShapeEditor seems to edit geometry out of plane, but not the perimeter curve.

 

It would be good if perimeter definition editing could be enabled in a future build of the API.

 

Cheers,

 

Jon

Message 4 of 20
Joe.Ye
in reply to: GeomGym

 

I think SlabShapeEditor should be able to edit the slab shape by chaning its perimeter curve. See the sample SlabShapeEditing in Revit SDK samples subfolder to get the full sample code.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 5 of 20
Anonymous
in reply to: GeomGym

Hi,

 

I also need to edit an existing slab perimeter (with the API) so we can retain the Revit unique ID.

 

I have looked at the API reference help, used the SDK sample project / looked into what is possible but unfortunately I cannot see how it is possible to modify the slab perimeter using the SlabShapeEditor class (or the API).

 

It seems that the SlabShapeEditor class mimics the UI modify - add point, add split line and modify sub elements functionality. The SlabShapeEditor class allows selected vertices or creases to be offset (elevation), as per the UI modify sub elements functionality (but nothing that allows us to edit the boundary, as is possible via the UI).

 

I notice that there are several posts on the API forum with people asking similar questions but no there is no definitive answer given.

 

I would be very grateful for any feedback on this to either confirm these findings or if possible some more detail on how we can modify the slab boundary (with the API). If it isn't possible would this functionality be added to the API in the near future?

 

Many thanks,

 

Gary Easom

 

 

Message 6 of 20
jeremytammik
in reply to: Anonymous

Dear Gary,

Thank you for your query and associated ADN case 08835154 [Edit existing slab boundary using the API].

I am sorry to say that there is currently no API access to this functionality.

I submitted the wish list item CF-65 [Edit existing slab boundary using the API -- 08835154] on your behalf for the functionality you suggest, as this issue requires exploration and possibly a modification to our software. Please make a note of this number for future reference.

 

Sorry for the bad news.

 

Best regards,

 

Jeremy



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

Message 7 of 20
Joe.Ye
in reply to: Anonymous

Hi Gary,

Sorry for the misunderstanding.
There is a workaround to edit existing slab's boundary.

For each Revit slab or floor, there are mapping model lines to representing the boundary of tha slab. If we change those model line's position or shape, the slab or floor's shape will be updated accordingly.

There might be many model lines in a document. How can we find the model lines that representing the slab is the key point.

Here is the solution: You need to create a tempt transaction. During this temp transaction, delete the target slab by Document.Delete() method. This method will return all the deleted elements' ids after the slab is deleted. So the slab's boundary model line can be find by iterating all the return id (get the element from those ids and compare the object type if they are ModelLine class). Finally abort this temp transaction.

After get the boundary's boundary model lines, you can change the model line's shape by changing those ModelLine object ( use this method

LocationCurve lCurve = modelLine.Location as LocationCurve;
lCurve.Curve = newcurve.

I just did a very quick test, this works.

 

Here is the complete command code.

For simplicity, it just move the floor by changing the curve's position..

 

 

[Autodesk.Revit.Attributes.Transaction(

          Autodesk.Revit.Attributes.TransactionMode.Manual)]

        publicclassChangeFloor : IExternalCommand

        {

          public Autodesk.Revit.UI.Result Execute(

            ExternalCommandData commandData,

            refstring message,

            ElementSet elements)

          {

            Document doc = commandData.Application.ActiveUIDocument.Document;

            Autodesk.Revit.UI.Selection.Selection sel =

              commandData.Application.ActiveUIDocument.Selection;

 

            Reference ref1 = sel.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element,

              "Please pick a floor to edit");

            Floor f = doc.GetElement(ref1) asFloor;

 

            Transaction transTemp = newTransaction(doc);

            transTemp.Start("tempDelete");

            ICollection<ElementId> ids = doc.Delete(f);

            transTemp.RollBack();

 

            List<ModelLine> mLines = newList<ModelLine>();

            foreach (ElementId id in ids)

            {

              Element ele = doc.GetElement(id);

              if (ele isModelLine)

              {

                mLines.Add(ele asModelLine);

              }

            }

 

            Transaction trans = newTransaction(doc);

            trans.Start("ChangeFloor");

 

            //

            foreach (ModelLine mline in mLines)

            {

              LocationCurve lCurve = mline.Location asLocationCurve;

              Line c = lCurve.Curve asLine;

              XYZ pt1 = c.GetEndPoint(0);

              XYZ pt2 = c.GetEndPoint(1);

 

              Transform transform = Transform.CreateTranslation(

                newXYZ(1, 1, 0)); //move the line.

              XYZ pt1New = transform.OfPoint(pt1);

              XYZ pt2New = transform.OfPoint(pt2);

              Line newLine = Line.CreateBound(pt1New, pt2New);

              lCurve.Curve = newLine;

 

            }

            trans.Commit();

            returnResult.Succeeded;

          }

        }

 

    }



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 8 of 20
Joe.Ye
in reply to: Joe.Ye

The forum has issue to parse the html of the code. So it deletes some space.


I posted the article about this solution to DevBlog.
You can get the corrent code from there.
http://adndevblog.typepad.com/aec/2013/10/change-the-boundary-of-floorsslabs.html



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 9 of 20
Anonymous
in reply to: Joe.Ye

Hi,

 

Thats really helpful, many thanks.

 

Cheers,

 

Gary

Message 10 of 20
boostyourbim
in reply to: jeremytammik

Hi Jeremy,

Has there been any progress on CF-65 [Edit existing slab boundary using the API -- 08835154] ?

I want to change the # of lines in the sketch with the API. Is that possible in Revit 2016? For example, the user selects a roof with a triangular sketch and I want to use the API to modify the roof sketch so that it is a trapezoid.

Is it possible to use the API to add a 4th line to the sketch of the existing roof?

Thanks
Harry
Message 11 of 20
bosborne
in reply to: GeomGym

I'll second Harry's interest in this topic. I'd like to see some way to modify slab boundaries without via the API without being limited to the same # of curves or having to trash the old floor and create a new floor. Some way that could preserve tagging, dimensions, element IDs etc - basically I'd like whatever Copy/Monitor does to modify floors to be exposed to the API.
Message 12 of 20
boostyourbim
in reply to: bosborne
Message 13 of 20
Anonymous
in reply to: GeomGym

Joe Ye‘s code works very well.

Thanks.

 

Sometimes Revit uses another additional model line to record the value of SpanDirectionAngle.

 

So, the Number of model lines of a rectangle slab maybe 5 not 4.

4 for edges and 1 for SpanDirectionAngle.

 

Hope this helps.

 

Thank you.

 

Message 14 of 20
OlegSheydvasser
in reply to: GeomGym

You may want to look at the Revit Preview (aka beta) if you are interested in new sketch-based element creation and editing via API:

Ceiling creation API 

Sloped Ceiling creation API

Floor creation API

 

Get Sketch elements API

Sketch Edit Mode API

Floor Sketch editing API

Wall and Shaft Opening Sketch editing API

 

To join the Revit Preview email revit.preview.access@autodesk.com 

 



Oleg Sheydvasser

Software Architect

Message 15 of 20

Dear Oleg,

 

Thank you for this exciting information!

 

Would you like me to share this invitation on The Building Coder blog as well?

 

Cheers,

 

Jeremy

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open
Message 16 of 20

Hi Jeremy,
By all means share this info.
We got very limited feedback on the preview.


Oleg Sheydvasser

Software Architect

Message 17 of 20

Those titles look like exciting additions to the API. If they provide stable functionality of the form noted in the titles then I would consider them to be a major step forward in API functionality (regardless of what lengths I need to go to in using them).

 

Currently there are things we cannot do with the API. When we have a situation where everything geometry wise done in the UI can be done in the API then that is the starting point for me, especially considering increasing Forge use etc. Those items seem like a great step forward towards that aim.

 

Now we just need to find out how to create and edit a scope box...

Message 18 of 20

Do we have any explicit invitation letter to the preview release?

 

I remember seeing something like that years ago...

 

Are you aware of a more recent version?

 

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

>Do we have any explicit invitation letter to the preview release?
No, sorry, I don't.
The PM just gave me the email address that I put in the previous post.


Oleg Sheydvasser

Software Architect

Message 20 of 20

Great, thank you!

  

Here is your invitation, reposted by The Building Coder:

  

https://thebuildingcoder.typepad.com/blog/2021/01/sketch-based-creation-and-editing-api-preview.html

  

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community