0x
004771
2020-10-14

Visibilidades através da interface COM

É possível criar visibilidades através da interface COM?


Resposta:

Sim, é possível criar visibilidades através da interface COM (RF‑COM3/RS‑COM6). No código a seguir, os elementos são primeiro selecionados para uma visibilidade. Isto é efetuado utilizando Selections. Primeiro, ative-os com "rfEnableSelections" e depois utilize "rfSelectObjects" para selecionar os objetos:

  1. código.vb#

Sub set_visibility()

' get interface from the opened model and lock the licence/program
Dim iModel As RFEM3.IrfStructure3
Set iModel = GetObject(, "RFEM3.Structure")
iModel.rfGetApplication.rfLockLicence

On Error GoTo e

' get interface for modeldata
Dim iModData As RFEM3.IrfStructuralData4
Set iModData = iModel.rfGetStructuralData

' get interface for view
Dim iView As RFEM3.IrfView2
Set iView = iModel.rfGetActiveView
' remove old views
iView.rfDeletePartialView "test|view"
iView.rfDeletePartialView "test|view2"
iView.rfDeletePartialView "test|view_add"
iView.rfDeletePartialView "test|view_rev"
iView.rfDeletePartialView "test|view_diff"

' create first view
iModData.rfSelectObjects STR_MEMBER, "3-4"
iView.rfSetPartialView "test|view"
' iView.rfSelectPartialView "test|view", PVM_SHOW, True, True

' create second view
iModData.rfSelectObjects STR_SURFACE, "1"
iModData.rfSelectObjects STR_MEMBER, "3"
iView.rfSetPartialView "test|view2"
' iView.rfSelectPartialView "test|view2", PVM_SHOW, True, True

' create sum from view from 1 and 2
iView.rfSelectPartialView "test|view", PVM_SELECT, True, True
iView.rfSelectPartialView "test|view2", PVM_SELECT, False, True
iView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, True
iView.rfSetPartialView "test|view_add"

' create differential view 2 minus 1
' first created reversed view
iView.rfSelectPartialView "test|view", PVM_SHOW, True, True
iView.rfSelectPartialView "test|view2", PVM_SHOW, False, True
iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, True
iView.rfSelectPartialView "", PVM_SELECT, True, True
iView.rfSetPartialView "test|view_rev"
iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, True

' select view to substract and reverse view
iView.rfSelectPartialView "test|view_rev", PVM_SELECT, True, True
iView.rfSelectPartialView "test|view", PVM_SELECT, False, True
iView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, True
iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, True
iView.rfSelectPartialView "", PVM_SELECT, True, True
iView.rfSetPartialView "test|view_diff"
iView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, True

iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, True
iView.rfCancelPartialView

e: If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source

iModel.rfGetApplication.rfUnlockLicence
Set iModel = Nothing

End Sub
#/code#

Pode utilizar a interface "iView" e o comando "rfSetPartialView" para criar uma visibilidade. A descrição é muito importante neste caso. Das Trennzeichen "|" sorgt dabei dafür, dass eine Sichtbarkeit mit Namen "view" in der Gruppe "test" angelegt wird.

O comando rfSelectPartialView é utilizado para apresentar uma visibilidade. O primeiro argumento é o nome da visibilidade. Para o segundo argumento, pode selecionar vários comandos. Dependendo do comando, é necessário um nome para a visibilidade ou não.

O terceiro argumento pergunta se tudo o que foi mostrado até agora deve ser desativado ou não. Portanto, se também pretende apresentar duas visibilidades, tem de confirmar "False" pelo menos ao selecionar a segunda visibilidade.

O quarto argumento controla se tudo o que está oculto deve ser apresentado em segundo plano ou não.

Aqui está uma lista de comandos importantes do segundo argumento:

PVM_SHOW Zeigt die angegebenen Sichtbarkeit
PVM_SHOW_SELECTION_ONLY Nachdem Elemente aus den Sichtbarkeiten selektiert wurden können Sie nun so allein dargestellt werden
PVM_SHOW_REVERSE Alle bisher dargestellten Elemente gehen in den Hintergrund und alle Elemente aus dem Hintergrund werden dargestellt (Darstellung wird invertiert)


Autor

Thomas trata no Customer Support de questões técnicas relacionadas com o software. Ele aprofunda-se de forma fiável em diferentes temas e desenvolve abordagens de solução adequadas.

Ligações
Downloads


;