Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

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: 

SlabShapVertexArray don't work for me

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
744 Views, 3 Replies

SlabShapVertexArray don't work for me

Hello,

 

In one of my plugin i would like to move floor vertex height, so I used this line : 

 

SlabShapeVertexArray slabShapeVertexArray = floor.SlabShapeEditor.SlabShapeVertices;

 

in order to get the vertex array and I used a "for" loop to get each vertex :

 

             for (int i = 0; i < slabShapeVertexArray.Size; ++i)
            {
                SlabShapVertex vertex = slabShapeVertexArray.get_Item(i);

            }

 

but i never goes in the loop, so I i check the value of slabShapeVertexArray.Size and it's equal to 0;

 

Can someone help me Because i Don't know why i can't get the vertices

Labels (4)
3 REPLIES 3
Message 2 of 4
RPTHOMAS108
in reply to: Anonymous

Did you call SlabShapeEditor.Enable?

 

Note that you can't use this on a slab with a slope set by sketch.

Message 3 of 4
Anonymous
in reply to: RPTHOMAS108

No, i didn't call this method, but i've tried and it Don't change anything, the size field is still equal to 0.

 

I already use the slabShapEditor.drawPoint and it works, but the SlabShapVertexArray does not contain any Vertex

Message 4 of 4
RPTHOMAS108
in reply to: Anonymous

Yeah I see why.

 

You have to call Document.Regenerate if you are Enabling a slab not already enabled and manipulating the SubElements in the same transaction.

 

Private Function TObj137(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData,
ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Result
        If commandData.Application.ActiveUIDocument Is Nothing Then Return Result.Cancelled Else
        Dim UIDoc As UIDocument = commandData.Application.ActiveUIDocument
        Dim IntDoc As Document = commandData.Application.ActiveUIDocument.Document
        Dim AcView As View = UIDoc.ActiveGraphicalView
        Dim R1 As Reference = Nothing
        Try
            R1 = UIDoc.Selection.PickObject(Selection.ObjectType.Element)
        Catch ex As Exception
        End Try
        If R1 Is Nothing Then Return Result.Cancelled Else

        Dim El As Floor = TryCast(IntDoc.GetElement(R1), Floor)
        If El Is Nothing Then Return Result.Cancelled Else

        Using tx As New Transaction(IntDoc, "Edit slab")
            If tx.Start = TransactionStatus.Started Then

                If El.SlabShapeEditor Is Nothing Then
                    tx.RollBack()
                End If
                If El.SlabShapeEditor.IsEnabled = False Then
                    El.SlabShapeEditor.Enable()
                End If

                If El.SlabShapeEditor.SlabShapeVertices.Size = 0 Then
                    IntDoc.Regenerate()
                End If
                For I = 0 To El.SlabShapeEditor.SlabShapeVertices.Size - 1
                    Dim Vx As SlabShapeVertex = El.SlabShapeEditor.SlabShapeVertices(I)
                    If I = 1 Then
                        El.SlabShapeEditor.ModifySubElement(Vx, 0.5)
                    End If
                Next
                tx.Commit()
            End If
        End Using
        Return Result.Succeeded
    End Function

 

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

Post to forums  

Autodesk Design & Make Report