EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

萧闫子 发表于 2014-1-14 10:23:37

设置两种过滤条件

在Inventor中做交互操作时,是否能同时设置kDrawingNoteFilter和kDrawingDimensionFilter两个过滤条件呢?也就是说是否可以让用户选择这两种标注样式呢?答案是肯定的。除了两个特别的过滤条件(kSketchProfileFilter和kSketch3DProfileFilter),别的类型的过滤条件累加是没有问题的(通过重复调用AddSelectionFilter)。Inventor的开发帮组文档对AddSelectionFilter的参数的解释中暗示了可以增加多个过滤条件:
Parameters
Description

Filter
Input value to be added to the list that specifies the filter or the indication of the type of object(s) being looked for. The valid filters for sketch profile selection are kSketchProfileFilter, kSketch3DProfileFilter or both. If either of these filters is added, no other filters can be added (method returns an error). If any filter other than these two are already added, adding these filters return an error.


下面是我写的VBA测试代码,可以返回用户选取的标注文字和标注尺寸:Module1:Sub twoFilters()' Create a new clsSelect object.Dim oSelect As New clsSelectDim objs As ObjectCollectionSet objs = ThisApplication.TransientObjects.CreateObjectCollectionoSelect.Pick objsSet oSelect = Nothing
If objs.Count > 0 Then'Do something here...End Ifobjs.ClearSet objs = NothingEnd Sub
Class clsSelect:'*************************************************************' The declarations and functions below need to be copied into' a class module whose name is "clsSelect". The name can be' changed but you'll need to change the declaration in the' calling function "testSelection" to use the new name.
' Declare the event objectsPrivate WithEvents oInteractEvents As InteractionEventsPrivate WithEvents oSelectEvents As SelectEventsPrivate oSelectedEnts As ObjectCollection
' Declare a flag that's used to determine when selection stops.Private bStillSelecting As Boolean
Public Sub Pick(ByRef objCol As ObjectCollection)' Initialize flag.bStillSelecting = True
' Create an InteractionEvents object.Set oInteractEvents = ThisApplication.CommandManager.CreateInteractionEvents
' Ensure interaction is enabled.oInteractEvents.InteractionDisabled = False
' Set a reference to the select events.Set oSelectEvents = oInteractEvents.SelectEvents
' Set the filter using the value passed in.oSelectEvents.SingleSelectEnabled = FalseoSelectEvents.AddSelectionFilter kDrawingNoteFilteroSelectEvents.AddSelectionFilter kDrawingDimensionFilteroInteractEvents.StatusBarText = "Select note and dimention, ESC to quit."
Set oSelectedEnts = ThisApplication.TransientObjects.CreateObjectCollection' Start the InteractionEvents object.oInteractEvents.Start' Loop until a selection is made.Do While bStillSelectingDoEventsLoop
' Get the selected items.objCol.ClearIf oSelectedEnts.Count > 0 ThenDim obj As ObjectFor Each obj In oSelectedEntsobjCol.Add objNextEnd If
' Stop the InteractionEvents object.oInteractEvents.Stop' Clean up.Set oSelectEvents = NothingSet oInteractEvents = NothingEnd Sub
Private Sub oInteractEvents_OnTerminate()' Set the flag to indicate we're done.bStillSelecting = FalseEnd Sub
Private Sub oSelectEvents_OnSelect(ByVal JustSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View)Dim obj As ObjectFor Each obj In JustSelectedEntitiesoSelectedEnts.Add objNextEnd SubPrivate Sub oSelectEvents_OnUnSelect(ByVal UnSelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View)Dim obj As ObjectFor Each obj In UnSelectedEntitiesoSelectedEnts.RemoveByObject objNextEnd Sub 文章来源:http://blog.csdn.net/barbarahan

萧闫子 发表于 2016-4-10 11:42:37


(ˇˍˇ) 路过~

妮可 发表于 2016-4-5 10:12:16

(~ ̄▽ ̄)~路过!!~~

萧闫子 发表于 2014-6-24 14:53:49


学习了 谢谢分享

一梦千寻 发表于 2014-2-18 12:15:23

(*^__^*) 嘻嘻……

月之影 发表于 2014-2-18 12:19:15

路过!!!
帮顶……

悠悠筱荷 发表于 2014-2-18 12:22:43

路过!!!
不发表意见……

秦惑 发表于 2014-2-18 12:29:11

路过!!!
不发表意见……

烈火ivk 发表于 2014-2-19 15:01:25

顶......
楼下跟上.....

leowave 发表于 2014-2-21 14:44:57

顶!!!!!!!!!!!!!!!!!!!!!!!!!

开始了d 发表于 2014-2-21 14:47:17

顶!!!!!!!!!!!!!!!!!!!!!!!!!

茶神idg 发表于 2014-2-22 20:16:10

顶......
楼下跟上.....

等你回来 发表于 2014-2-25 10:38:53

顶起来…………

烈火ivk 发表于 2014-3-5 15:39:33

顶!!!!!!!!!!!!!!!!!!!!!!!!!

JHXT杰西卡 发表于 2014-3-7 11:59:35

路过!!!
帮顶……

xy666 发表于 2014-3-7 12:02:41

(*^__^*) 嘻嘻……

孙雅 发表于 2014-3-10 12:21:20

顶......
楼下跟上.....

妮可 发表于 2014-3-11 15:36:42

路过!!!
帮顶……
页: [1] 2 3 4
查看完整版本: 设置两种过滤条件