Message 1 of 2
Delete Materials is not working
Not applicable
03-14-2016
01:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone!
Can anyone help me with problem. Delete element by Id is not working.
That's my code:
Private Sub DataTransferStartButton_Click(sender As Object, e As EventArgs) Handles DataTransferStartButton.Click
Dim App As Autodesk.Revit.UI.UIApplication = myCD.Application()
Dim UIDoc As UIDocument = App.ActiveUIDocument
Dim Doc As Document = App.ActiveUIDocument.Document
App.OpenAndActivateDocument("C:\Users\Pashin.Evgeniy\Desktop\001_Проба.rfa")
Dim tr As New Transaction(Doc, "DeleteAllElements")
tr.Start()
Try
Dim coll As FilteredElementCollector = New FilteredElementCollector(Doc).OfClass(GetType(Material))
For Each dtFillPaternElement As Autodesk.Revit.DB.Material In coll
Doc.Delete(dtFillPaternElement.Id)
MsgBox("I kill material with name " & dtFillPaternElement.Name.ToString)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
tr.Commit()
tr.Dispose()
End SubI'm using ExternalCommand and myForm.
myForm.ShowDialog( ) is not working!!!
I'm using myForm.Show( ) - and It's better...
Family project is opening but materials is not deleted!!! Why? Transaction is not completed!!! Why?