Professional Documents
Culture Documents
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
Manufacturing DevBlog
(http://adndevblog.typepad.com
/manufacturing/)
The resource for software developers working with Design, Lifecycle and Simulation
technologies from Autodesk.
07/06/2016
1 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
2 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
'***********************************************
**************
' The declarations and functions below need to b
e copied into
' a class module whose name is "clsSelect". The
name can be
' changed but you'll need to change the declarat
ion in the
' calling function "TestSelection" to use the ne
w name.
' Declare the event objects
Private WithEvents oInteractEvents As Interactio
nEvents
Private WithEvents oSelectEvents As SelectEvents
' Declare a flag that's used to determine when s
election stops.
Private bStillSelecting As Boolean
Public Function Pick(filter As SelectionFilterEn
um) As ObjectsEnumerator
' Initialize flag.
bStillSelecting = True
' Create an InteractionEvents object.
Set oInteractEvents = ThisApplication.CommandM
anager.CreateInteractionEvents
' Ensure interaction is enabled.
oInteractEvents.InteractionDisabled = False
' Set a reference to the select events.
Set oSelectEvents = oInteractEvents.SelectEven
ts
oSelectEvents.WindowSelectEnabled = True
' Set the filter using the value passed in.
oSelectEvents.AddSelectionFilter filter
' Start the InteractionEvents object.
oInteractEvents.Start
' Loop until a selection is made.
3 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
Do While bStillSelecting
ThisApplication.UserInterfaceManager.DoEvent
s
Loop
' Get the selected item. If more than one thin
g was selected,
' just get the first item and ignore the rest.
Dim oSelectedEnts As ObjectsEnumerator
Set oSelectedEnts = oSelectEvents.SelectedEnti
ties
If oSelectedEnts.Count > 0 Then
Set Pick = oSelectedEnts
Else
Set Pick = Nothing
End If
' Stop the InteractionEvents object.
oInteractEvents.Stop
' Clean up.
Set oSelectEvents = Nothing
Set oInteractEvents = Nothing
End Function
Private Sub oInteractEvents_OnTerminate()
' Set the flag to indicate we're done.
bStillSelecting = False
End Sub
Private Sub oSelectEvents_OnPreSelect( _
PreSelectEntity As Object, DoHighlight As Boolea
n, _
MorePreSelectEntities As ObjectCollection, _
ByVal SelectionDevice As SelectionDeviceEnum, _
ByVal ModelPosition As Point, _
ByVal ViewPosition As Point2d, ByVal View As Vie
w)
If Not TypeOf PreSelectEntity Is Face Then Ex
it Sub
Dim oFace As Face
Set oFace = PreSelectEntity
4 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
5 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
(http://adndevblog.typepad.com
/.a/6a0167607c2431970b01bb091be323970d-popup)
Only the 3 user facing faces are selected.
Posted at 12:56 PM in Adam Nagy (http://adndevblog.typepad.com/manufacturing
/adam-nagy/), Inventor (http://adndevblog.typepad.com/manufacturing
/inventor/) | Permalink (http://adndevblog.typepad.com/manufacturing/2016/07
/filter-out-faces-not-facing-the-user.html)
(http://twitter.com/share?url=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html&
text=Filter%20out%20faces%20not%20facing%20the%20user)
(https://plus.google.com/share?url=http://adndevblog.typepad.com
/manufacturing/2016/07/filter-out-faces-not-facing-the-user.html)
(http://www.facebook.com/sharer.php?u=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html)
Comments
Typepad (http://www.typepad.com
Comment below or sign in with
/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html&fp=11de38fcb077768841c4aa0810914abd&
view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&post_uri=http:
//adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces-not-facingthe-user.html)
Facebook (http://www.typepad.com/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html&fp=11de38fcb077768841c4aa0810914abd&
view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&
service=facebook&post_uri=http://adndevblog.typepad.com/manufacturing
/2016/07/filter-out-faces-not-facing-the-user.html)
Twitter
(http://www.typepad.com/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html&fp=11de38fcb077768841c4aa0810914abd&
view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&
service=twitter&post_uri=http://adndevblog.typepad.com/manufacturing
/2016/07/filter-out-faces-not-facing-the-user.html)
Google+
(http://www.typepad.com/sitelogin?uri=http%3A%2F
%2Fadndevblog.typepad.com%2Fmanufacturing%2F2016%2F07%2Ffilterout-faces-not-facing-the-user.html&fp=11de38fcb077768841c4aa0810914abd&
view_uri=http%3A%2F%2Fprofile.typepad.com%2F&via=blogside&service=gplus&
6 de 7
20/01/2017 23:18
http://adndevblog.typepad.com/manufacturing/2016/07/filter-out-faces...
(http://www.typepad.com/)
Manufacturing DevBlog (http://adndevblog.typepad.com/manufacturing/)
7 de 7
20/01/2017 23:18