Results 1 to 3 of 3

Thread: Problem calling ".Selection.PickObject" from a ShowDialog Form

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2016-12
    Posts
    1
    Login to Give a bone
    0

    Question Problem calling ".Selection.PickObject" from a ShowDialog Form

    I need the possibility to pick element(s) in Revit GUI from a Windows From that ist shown with showdialog.
    Eveything is working fine from inside the form to make changes to the revit database with transactions.
    But still found no way to allow the user to click elements in the GUI.

    Testcode which should allow the user to pick an element an then find the ID in an datagrid on the form

    Private Sub cmdMEP_RaumSuchen_Click(sender As Object, e As EventArgs) Handles cmdMEP_RaumSuchen.Click

    Me.Hide()

    Dim rvtElementRef As Reference
    rvtElementRef = m_rvtUidoc.Selection.PickObject(ObjectType.Element, "MEP-Raum wählen")

    Dim rvtElement As Element
    rvtElement = m_rvtDoc.GetElement(rvtElementRef.ElementId)


    Me.ShowDialog()

    Dim Row As DataGridViewRow
    For Each Row In dbgRaumbuch.Rows
    If Row.Cells("MepID").Value.ToString = rvtElement.Id.ToString Then
    Row.Selected = True
    End If
    Next

    End Sub


    Would be nice if anyone can help me

  2. #2
    Member
    Join Date
    2015-12
    Posts
    19
    Login to Give a bone
    0

    Default Re: Problem calling ".Selection.PickObject" from a ShowDialog Form

    I know this is kinda late reply, but I've been looking at the same issue recently and it is not possible to pick objects because non modal Dialog boxes do not allow the Revit interface to behave properly. If you're not in need of transactions to modify or add something then you can use a modal dialog by using form.show instead of form.showdialog

    Modal dialogs however cannot use transactions because of some technical reasons, so you can use any Api function that does not require a transaction such as selection, reading parameters or properties.

  3. #3
    I could stop if I wanted to
    Join Date
    2007-07
    Location
    London, UK
    Posts
    361
    Login to Give a bone
    0

    Default Re: Problem calling ".Selection.PickObject" from a ShowDialog Form

    Not really, you can invoke a ExternalEvent from a modeless window.
    The event can be raise the on a separate thread or, even better, you can implement a async Task.

Similar Threads

  1. 2014: Need Hatch pattern for "Void Form"!
    By Cosmic Traveller in forum AutoCAD General
    Replies: 1
    Last Post: 2015-02-04, 12:00 PM
  2. Thickness in "Create Form" in Revit Arch 2011
    By haraldbrynlund in forum Revit - Conceptual Design Tools
    Replies: 1
    Last Post: 2011-01-15, 11:12 PM
  3. Replies: 1
    Last Post: 2010-01-05, 09:19 AM
  4. Replies: 41
    Last Post: 2007-11-20, 12:32 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •