public class TessellatedShapeBuilder : ShapeBuilder
The TessellatedShapeBuilder type exposes the following members.
| Name | Description | |
|---|---|---|
| TessellatedShapeBuilder | Constructs a new instance of a TessellatedShapeBuilder. |
| Name | Description | |
|---|---|---|
| Fallback | Defines acceptable fallback if the desired type of geometry can't be built. | |
| GraphicsStyleId | Optional - if set, the built geometry will use that graphics style. | |
| IsFaceSetOpen | Flag whether the current set of connected faces is open and additional tessellation faces can be added to it. | |
| IsValidObject |
Specifies whether the .NET object represents a valid Revit entity.
(Inherited from ShapeBuilder) | |
| LogInteger | Integer value used for logging, if it is performed. Usually the number of the face set(s) in the IFC file, from which they are imported. Any value is acceptable. | |
| LogString | String used for logging, if any. Usually the name of the file from which face sets were imported. | |
| NumberOfCompletedFaceSets | Number of completed face sets. | |
| OwnerInfo | String used for logging, if any. Usually describes the element or object, which either defined or will own the geoemtrical objects to be built. | |
| Target | Requests the type of geometry to be built. |
| Name | Description | |
|---|---|---|
| AddFace | Adds a face to the currently open connected face set. | |
| AreTargetAndFallbackCompatible | Checks whether this combination of fallback and target parameters can be used as a valid combination of inputs. | |
| Build | Builds the designated geometrical objects from the stored face sets. Stores the result in this TessellatedShapeBuilder object. | |
| CancelConnectedFaceSet | Cancels the current face set - i.e., all data from it will be lost and the builder will have no open connected face set anymore. | |
| Clear | Erases all face set and clears the logs, if any. | |
| CloseConnectedFaceSet | Closes the currently open connected face set. | |
| CreateMeshByExtrusion | Builds a mesh by extruding curve loop(s) along extrusion distance. | |
| Dispose | (Inherited from ShapeBuilder) | |
| DoesFaceHaveEnoughLoopsAndVertices | Checks whether 'face' has enough loops and vertcies to be valid. | |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) | |
| GetBuildResult | Get the built geometry, build status and other data stored in TessellatedShapeBuilderResult. Clears the stored data. | |
| GetHashCode | Serves as the default hash function. (Inherited from Object) | |
| GetType | Gets the Type of the current instance. (Inherited from Object) | |
| OpenConnectedFaceSet | Opens a new connected face set. | |
| ToString | Returns a string that represents the current object. (Inherited from Object) |
// Create a pyramid-shaped DirectShape using given material for the faces public void CreateTessellatedShape(Document doc, ElementId materialId) { List<XYZ> loopVertices = new List<XYZ>(4); TessellatedShapeBuilder builder = new TessellatedShapeBuilder(); builder.OpenConnectedFaceSet(true); // create a pyramid with a square base 4' x 4' and 5' high double length = 4.0; double height = 5.0; XYZ basePt1 = XYZ.Zero; XYZ basePt2 = new XYZ(length, 0, 0); XYZ basePt3 = new XYZ(length, length, 0); XYZ basePt4 = new XYZ(0, length, 0); XYZ apex = new XYZ(length / 2, length / 2, height); loopVertices.Add(basePt1); loopVertices.Add(basePt2); loopVertices.Add(basePt3); loopVertices.Add(basePt4); builder.AddFace(new TessellatedFace(loopVertices, materialId)); loopVertices.Clear(); loopVertices.Add(basePt1); loopVertices.Add(apex); loopVertices.Add(basePt2); builder.AddFace(new TessellatedFace(loopVertices, materialId)); loopVertices.Clear(); loopVertices.Add(basePt2); loopVertices.Add(apex); loopVertices.Add(basePt3); builder.AddFace(new TessellatedFace(loopVertices, materialId)); loopVertices.Clear(); loopVertices.Add(basePt3); loopVertices.Add(apex); loopVertices.Add(basePt4); builder.AddFace(new TessellatedFace(loopVertices, materialId)); loopVertices.Clear(); loopVertices.Add(basePt4); loopVertices.Add(apex); loopVertices.Add(basePt1); builder.AddFace(new TessellatedFace(loopVertices, materialId)); builder.CloseConnectedFaceSet(); builder.Target = TessellatedShapeBuilderTarget.Solid; builder.Fallback = TessellatedShapeBuilderFallback.Abort; builder.Build(); TessellatedShapeBuilderResult result = builder.GetBuildResult(); using (Transaction t = new Transaction(doc, "Create tessellated direct shape")) { t.Start(); DirectShape ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel)); ds.ApplicationId = "Application id"; ds.ApplicationDataId = "Geometry object id"; ds.SetShape(result.GetGeometricalObjects()); t.Commit(); } }
' Create a pyramid-shaped DirectShape using given material for the faces Public Sub CreateTessellatedShape(doc As Document, materialId As ElementId) Dim loopVertices As New List(Of XYZ)(4) Dim builder As New TessellatedShapeBuilder() builder.OpenConnectedFaceSet(True) ' create a pyramid with a square base 4' x 4' and 5' high Dim length As Double = 4.0 Dim height As Double = 5.0 Dim basePt1 As XYZ = XYZ.Zero Dim basePt2 As New XYZ(length, 0, 0) Dim basePt3 As New XYZ(length, length, 0) Dim basePt4 As New XYZ(0, length, 0) Dim apex As New XYZ(length / 2, length / 2, height) loopVertices.Add(basePt1) loopVertices.Add(basePt2) loopVertices.Add(basePt3) loopVertices.Add(basePt4) builder.AddFace(New TessellatedFace(loopVertices, materialId)) loopVertices.Clear() loopVertices.Add(basePt1) loopVertices.Add(apex) loopVertices.Add(basePt2) builder.AddFace(New TessellatedFace(loopVertices, materialId)) loopVertices.Clear() loopVertices.Add(basePt2) loopVertices.Add(apex) loopVertices.Add(basePt3) builder.AddFace(New TessellatedFace(loopVertices, materialId)) loopVertices.Clear() loopVertices.Add(basePt3) loopVertices.Add(apex) loopVertices.Add(basePt4) builder.AddFace(New TessellatedFace(loopVertices, materialId)) loopVertices.Clear() loopVertices.Add(basePt4) loopVertices.Add(apex) loopVertices.Add(basePt1) builder.AddFace(New TessellatedFace(loopVertices, materialId)) builder.CloseConnectedFaceSet() builder.Target = TessellatedShapeBuilderTarget.Solid builder.Fallback = TessellatedShapeBuilderFallback.Abort builder.Build() Dim result As TessellatedShapeBuilderResult = builder.GetBuildResult() Using t As New Transaction(doc, "Create tessellated direct shape") t.Start() Dim ds As DirectShape = DirectShape.CreateElement(doc, New ElementId(BuiltInCategory.OST_GenericModel)) ds.ApplicationId = "Application id" ds.ApplicationDataId = "Geometry object id" ds.SetShape(result.GetGeometricalObjects()) t.Commit() End Using End Sub