212x
001941
2020-10-14

[ZH] 常见问题 004771 | 是否可以使用COM接口创建可见性?

问题:
是否可以使用COM接口创建可见性?

答案:
是的,可以通过 COM 接口 (RF‑COM3/RS‑COM6) 创建可见性。 在下面的代码中,首先选择元素以获得可见性。 这是通过选择完成的。 首先,使用“rfEnableSelections”激活它们,然后使用“rfSelectObjects”选择对象:

子集可见性()

' 从打开的模型中获取接口并锁定许可证/程序
Dim iModel As RFEM3.IrfStructure3
Set iModel = GetObject(, "RFEM3.Structure")
iModel.rfGetApplication.rfLockLicence

出错时转到 e

' 获取模型数据接口
Dim iModData As RFEM3.IrfStructuralData4
设置 iModData = iModel.rfGetStructuralData

' 获取视图接口
Dim iView As RFEM3.IrfView2
设置 iView = iModel.rfGetActiveView
' 删除旧视图
iView.rfDeletePartialView "测试|视图"
iView.rfDeletePartialView "test|view2"
iView.rfDeletePartialView "test|view_add"
iView.rfDeletePartialView "test|view_rev"
iView.rfDeletePartialView "test|view_diff"

' 创建第一个视图
iModData.rfSelectObjects STR_MEMBER, "3-4"
iView.rfSetPartialView "测试|视图"
' iView.rfSelectPartialView "test|view", PVM_SHOW, True, True

' 创建第二个视图
iModData.rfSelectObjects STR_SURFACE, "1"
iModData.rfSelectObjects STR_MEMBER, "3"
iView.rfSetPartialView "test|view2"
' iView.rfSelectPartialView "test|view2", PVM_SHOW, True, True

' 从视图 1 和 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"

' 创建微分视图 2 减 1
' 首先创建了反转视图
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

' 选择要减去的视图并反转视图
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:  如果 Err.Number 0 那么 MsgBox Err.description, , Err.Source

iModel.rfGetApplication.rfUnlockLicence
设置 iModel = 无

末端接头

可以使用接口 "iView" 和 "rfSetPartialView" 命令来创建可见性。 说明在这里尤其重要。 分隔符“|”确保在“测试”组中创建名为“视图”的可见性。

rfSelectPartialView 命令用于显示可见性。 第一个参数是可见性的名称。 对于第二个参数,您可以选择各种命令。 根据命令的不同,是否需要可见性的名称。

第三个参数询问是否应该停用到目前为止显示的所有内容。 因此,如果您还想显示两个可见性,那么至少在选择第二个可见性时必须提交“假”。

第四个参数控制是否所有隐藏的内容都应该在后台显示。

这里是第二个参数的重要命令列表:

PVM_SELECT - 选择指定可见性的单元

PVM_SHOW - 显示指定的可见性

PVM_SHOW_SELECTION_ONLY - 从可见性中选择单元后,现在可以单独显示它们。

PVM_SHOW_REVERSE - 到目前为止显示的所有元素都进入背景,而背景中的所有元素都将被显示(反转显示)。