[PSCE C#]各位好,在使用PsSelect时,什么函数能够更新选择集?

我在添加object id以后,模型中实体的选中效果没有显示,怎么触发更新界面的选择结果呢?!

Parents
  • 在PSCE中能找到一个开发文档ProStructures.chm,其中有关AddObject有如下VB.NET的例子:

    Sub Example_PickObject()
    ' This example pick an object into the selection , add another one,
    ' subtract that and display the first object's name.
    Dim Selection As New PsSelection
    Dim Id As Long
    Dim AddId As Long
    Id = Selection.PickObject("Pick an object:")
    If Id <> 0 Then
    MsgBox("There is one object in selection.")
    AddId = Selection.PickObject("Pick second object:")
    If AddId <> 0 Then
    ' Add one to te selection
    Selection.AddObject(AddId)
    MsgBox("One object added to selection")
    ' Subtract added one from selection
    Selection.RemoveFromSelection(AddId)
    MsgBox("The added object was removed from selection")
    End If
    MsgBox("There is a " & PsDrawingProperties.ObjectName(Id))
    Else
    MsgBox("No object picked")
    End If
    End Sub
    您先将该例子改写为C#代码测试一下是否可正确运行?如果可以的话,可能是您AddObject中提供的ObjectId不正确导致的。



Reply
  • 在PSCE中能找到一个开发文档ProStructures.chm,其中有关AddObject有如下VB.NET的例子:

    Sub Example_PickObject()
    ' This example pick an object into the selection , add another one,
    ' subtract that and display the first object's name.
    Dim Selection As New PsSelection
    Dim Id As Long
    Dim AddId As Long
    Id = Selection.PickObject("Pick an object:")
    If Id <> 0 Then
    MsgBox("There is one object in selection.")
    AddId = Selection.PickObject("Pick second object:")
    If AddId <> 0 Then
    ' Add one to te selection
    Selection.AddObject(AddId)
    MsgBox("One object added to selection")
    ' Subtract added one from selection
    Selection.RemoveFromSelection(AddId)
    MsgBox("The added object was removed from selection")
    End If
    MsgBox("There is a " & PsDrawingProperties.ObjectName(Id))
    Else
    MsgBox("No object picked")
    End If
    End Sub
    您先将该例子改写为C#代码测试一下是否可正确运行?如果可以的话,可能是您AddObject中提供的ObjectId不正确导致的。



Children