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:
Sub set_visibility() ' get interface from the opened model and lock the licence/programDim iModel As RFEM3.IrfStructure3Set iModel = GetObject(, "RFEM3.Structure")iModel.rfGetApplication.rfLockLicence On Error GoTo e ' get interface for modeldataDim iModData As RFEM3.IrfStructuralData4Set iModData = iModel.rfGetStructuralData
' get interface for viewDim iView As RFEM3.IrfView2Set iView = iModel.rfGetActiveView' remove old viewsiView.rfDeletePartialView "test|view"iView.rfDeletePartialView "test|view2"iView.rfDeletePartialView "test|view_add"iView.rfDeletePartialView "test|view_rev"iView.rfDeletePartialView "test|view_diff"
' create first viewiModData.rfSelectObjects STR_MEMBER, "3-4"iView.rfSetPartialView "test|view"' iView.rfSelectPartialView "test|view", PVM_SHOW, True, True
' create second viewiModData.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 2iView.rfSelectPartialView "test|view", PVM_SELECT, True, TrueiView.rfSelectPartialView "test|view2", PVM_SELECT, False, TrueiView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, TrueiView.rfSetPartialView "test|view_add"
' create differential view 2 minus 1' first created reversed viewiView.rfSelectPartialView "test|view", PVM_SHOW, True, TrueiView.rfSelectPartialView "test|view2", PVM_SHOW, False, TrueiView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, TrueiView.rfSelectPartialView "", PVM_SELECT, True, TrueiView.rfSetPartialView "test|view_rev"iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, True
' select view to substract and reverse viewiView.rfSelectPartialView "test|view_rev", PVM_SELECT, True, TrueiView.rfSelectPartialView "test|view", PVM_SELECT, False, TrueiView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, TrueiView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, TrueiView.rfSelectPartialView "", PVM_SELECT, True, TrueiView.rfSetPartialView "test|view_diff"iView.rfSelectPartialView "", PVM_SHOW_SELECTION_ONLY, True, True
iView.rfSelectPartialView "", PVM_SHOW_REVERSE, True, TrueiView.rfCancelPartialView
e: If Err.Number <> 0 Then MsgBox Err.description, , Err.Source iModel.rfGetApplication.rfUnlockLicenceSet iModel = Nothing
End Sub
Pode utilizar a interface "iView" e o comando "rfSetPartialView" para criar uma visibilidade. A descrição é muito importante neste caso. O separador "|" assegura a criação de uma visibilidade com o nome "view" no grupo "test".
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_SELECT – seleciona os elementos na visibilidade especificada
PVM_SHOW – mostra a visibilidade especificada
PVM_SHOW_SELECTION_ONLY – após selecionar os elementos das visibilidades, estes podem ser representados sozinhos agora.
PVM_SHOW_REVERSE – todos os elementos visualizados até agora vão para segundo plano e todos os elementos do segundo plano são apresentados (a visualização está invertida).