Oui, il est possible de créer des visibilités via l'interface COM (RF-COM3/RS-COM6). Avec le code ci-dessous, les éléments sont d'abord sélectionnés pour une visibilité. Cette opération est effectuée via les Séléctions. Activez ces séléctions avec la commande « rfEnableSelections », puis utilisez « rfSelectObjects » pour sélectionner les objets :
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
L'interface « iView » et la commande « rfSetPartialView » servent à créer une visibilité. Cette description est particulièrement importante dans ce cas. Le séparateur « | » garantit qu'une visibilité nommée « view » est créée dans le groupe « test ».
La commande rfSelectPartialView permet d'afficher une visibilité. Le premier argument est le nom de la visibilité. Pour le second argument, vous pouvez sélectionner différentes commandes. Selon la commande, le nom de la visibilité est requis ou non.
Le troisième argument demande si tout ce qui est affiché jusqu'à présent doit être désactivé ou non. Ainsi, si vous souhaitez afficher deux visibilités, vous devez au moins valider la valeur « False » lors de la sélection de la deuxième visibilité.
Le quatrième argument contrôle si tout ce qui est masqué doit être affiché en arrière-plan ou non.
Voici une liste des commandes importantes du second argument :
PVM_SELECT - sélectionne les éléments dans la visibilité spécifiée
PVM_SHOW - affiche la visibilité spécifiée
PVM_SHOW_SELECTION_ONLY - Une fois les éléments sélectionnés dans les visibilités, ils peuvent être affichés seuls.
PVM_SHOW_REVERSE - Tous les éléments affichés jusqu'à présent passent en arrière-plan et tous les éléments de l'arrière-plan sont affichés (l'affichage est inversé).