Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select cylindrical face with symbolic thread

Status
Not open for further replies.

niedzviedz

Mechanical
Apr 1, 2012
307
Hello,

Is there any way to select cylindrical faces but only the ones which has symbolic thread added?

With best regards
Michael
 
Replies continue below

Recommended for you

Do you want the code to automatically find and process these faces or are you looking for an interactive selection that limits the selection to faces with symbolic thread attached?

If you want the code to automatically find the faces, something like this may work.

If you want an interactive selection filtered for specific faces, it could be accomplished with the "SelectWithClassDialog" method.

www.nxjournaling.com
 
Thanks @Cowski, this is what I've been looking for. My old code was long and it wasn't process cylindrical face from unparametrised body, that's why I was looking for tweak it out.

below is my code, maybe it will be useful for someone.

Code:
Option Strict Off

Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
 
Module Module1
 
	Dim theSession As Session = Session.GetSession()
	Dim theUfSession As UFSession = UFSession.GetUFSession()
	Dim workPart As Part = theSession.Parts.Work
	Dim lw As ListingWindow = theSession.ListingWindow
	Dim displayModification1 As DisplayModification
	Dim facecolor as integer = 160
	
	Sub Main()
 
		lw.Open()
  
		Dim threadFeatures As New List(Of Features.Feature)
		Dim threadFaces As New List(Of Face)
 
		For Each myFeature As Features.Feature In workPart.Features
		
			If myFeature.FeatureType.ToUpper = "SYMBOLIC_THREAD" Then
			
				threadFeatures.Add(myFeature)
				
			End If
			
		Next
 
		Dim myThreadParameters As UFModl.SymbThreadData
		
		For Each myFeature As Features.Feature In threadFeatures
 
			theUfSession.Modl.AskSymbThreadParms(myFeature.Tag, myThreadParameters)
			Dim threadedFace As Face
			threadedFace = Utilities.NXObjectManager.Get(myThreadParameters.cyl_face)
 
			threadFaces.Add(threadedFace)
  
		Next
 
 
		displayModification1 = theSession.DisplayManager.NewDisplayModification()
		
		With displayModification1
		
			.ApplyToAllFaces = False
			.NewColor = facecolor
			.Apply(threadFaces.toarray)
			.Dispose()

		End With
	 
		lw.Close()
 
	End Sub
 
End Module

With best regards
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor