Split surface command in revit api.

Split surface command in revit api.

AndrewButenko
Advocate Advocate
2,494 Views
9 Replies
Message 1 of 10

Split surface command in revit api.

AndrewButenko
Advocate
Advocate

I can't find split surface command in revit api. Anybody  know?

 

I tried use SiteSubRegion.create, but it have not  geometry.

 

0 Likes
2,495 Views
9 Replies
Replies (9)
Message 2 of 10

jeremytammik
Autodesk
Autodesk

Face.HasRegions & Face.GetRegions()

 

This property and method provide information about the faces created by the Split Face command. HasRegions returns a Boolean value indicating if the face has any Split Face regions. GetRegions returns a list of faces. As the material of these faces can be independently modified through the UI with the Paint tool, the material of each face can be found from its MaterialElementId property.

 

http://www.revitapidocs.com/2018.1/b54848a3-e52c-618c-24ad-20fc3c7966bb.htm

 

HasRegions Property 

 
Identifies if the face contains regions (which can be created, for example, by the Split Face command).
 


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

Message 3 of 10

Revitalizer
Advisor
Advisor

Hi,

 

no, you cannot do that via API.

@jeremytammikwe want to set these lines, not only get them (or the areas they define)...

 

Rudi Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 4 of 10

Revitalizer
Advisor
Advisor

Hi,

 

there is a FaceSplitter class but no documentation about how to create one.

It has a SplitElementId property, so we have its Element relation.

But besides this, what's the benefit of this class?

 

 

Cheers,

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 10

jeremytammik
Autodesk
Autodesk

Hi Rudi!

 

http://thebuildingcoder.typepad.com/blog/2013/02/whats-new-in-the-revit-2012-api.html

 

FaceSplitter class

 

The FaceSplitter class, representing the element produced by a Split Face operation, has been exposed to the API.

 

Use this class to identify the element whose face was split by the element (SplitElementId property).

 

  Autodesk.Revit.DB.Options opt
    = app.Create.NewGeometryOptions();
  opt.ComputeReferences = true;
  opt.IncludeNonVisibleObjects = true;
 
  FilteredElementCollector collector
    = new FilteredElementCollector( doc );
 
  ICollection<FaceSplitter> splitElements
    = collector.OfClass( typeof( FaceSplitter ) )
      .Cast<FaceSplitter>().ToList();
 
  foreach( FaceSplitter faceSplitter in
    splitElements )
  {
    Element splitElement = doc.get_Element(
      faceSplitter.SplitElementId );
 
    Autodesk.Revit.DB.GeometryElement geomElem
      = faceSplitter.get_Geometry( opt );
 
    foreach( GeometryObject geomObj in
      geomElem.Objects )
    {
      Line line = geomObj as Line;
      if( line != null )
      {
        XYZ end1 = line.get_EndPoint( 0 );
        XYZ end2 = line.get_EndPoint( 1 );
        double length = line.ApproximateLength;
      }
    }
  }

 

To find the faces created by the split, use the new Face.GetFaceRegions() method on the face of the host element for the split.

 

Cheers,

 

Jeremy



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

Message 6 of 10

pmcmm1
Enthusiast
Enthusiast

Hey guys,

 

Any update on this?

 

The benefit of this class is that it would allow to create regions automatically on the wall WITHOUT modifying the wall. Look at the example below. For Energy Performance Building Analysis, I want to know the area of the wall attached to apartment but I don't want to cut the wall, so creating an automatic FaceSplitter by projecting the closer edge of the internal wall would work like a charm. But we can't create FaceSplitter elements...

 

Typical Apartment Floor PlanTypical Apartment Floor Plan

0 Likes
Message 7 of 10

jeremytammik
Autodesk
Autodesk

Hi guys,

 

If the required functionality is not provided by the Revit API and no workaround can be found, we need to raise a wish list item for it in the Revit Idea Station and tag it as API.

 

Can you please check whether one exists, vote for it if it does, add it if not, and post a link to it here for others to see?

 

Thank you!

 

Meanwhile, I can ask the development team whether they have any alternative suggestions for us.

 

Cheers,

 

Jeremy

 



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

Message 8 of 10

jeremytammik
Autodesk
Autodesk

I heard back from the development team on this, and they say:

 

I do not think FaceSplitter can be created programmatically. Only after a Face is split in UI this class will be returned by API.

 

The documentation I can see indicates that the get regions method was added to the API in 2012, but there was no mention of creating split faces at that time.

 

So the wish list item in the Revit Idea Station is probably a good next step.

 

Cheers,

 

Jeremy

  



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

Message 9 of 10

pmcmm1
Enthusiast
Enthusiast

Hi Jeremy,

 

Thanks for looking it up. In the meantime, I've just found a way to do what I was looking for. I am using PartUtils function to create pieces of the outside walls as Part class. I got inspired from your blog, see here:

 

https://thebuildingcoder.typepad.com/blog/2012/09/parts-assemblies-partutils-and-divideparts.html

 

Either way, if the facesplitter function is already there, it would be interesting to be able to create FaceSplitter class from lines, otherwise the function is quite limited from the point of view of the API.

 

Thanks a lot for your help.

0 Likes
Message 10 of 10

jeremytammik
Autodesk
Autodesk

Thank you for your appreciation.

 

Congratulations on solving your task and thank you for sharing your approach.

 

Please vote on the idea station for the read-write creation access to FaceSplitter, if you care about that.

 

Cheers,

 

Jeremy

 



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