Submitted by Minoru on Tue, 01/20/2015 - 07:44
Forums:
Hello Again!
How do I write the code for searching a command? for example, how often appears blend command on the part navigator ...
Tks in advance...
Minoru
Hello Again!
How do I write the code for searching a command? for example, how often appears blend command on the part navigator ...
Tks in advance...
Minoru
re: find features
The code below illustrates how to iterate through the features in the work part and report on them.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim blendList As New List(Of Features.Feature)
For Each myFeature As Features.Feature In workPart.Features
'lw.WriteLine(".GetFeatureName: " & myFeature.GetFeatureName)
'lw.WriteLine(".Name: " & myFeature.Name)
'lw.WriteLine(".FeatureType: " & myFeature.FeatureType)
'lw.WriteLine(".GetType: " & myFeature.GetType.ToString)
If myFeature.FeatureType = "BLEND" Then
'add feature to a list for future reference
blendList.Add(myFeature)
End If
Next
lw.WriteLine("the work part contains " & blendList.Count.ToString & " Edge Blend features:")
For Each theBlend As Features.Feature In blendList
lw.WriteLine(theBlend.GetFeatureName)
Next
lw.Close()
End Sub
End Module
Tks!
Tks...
Midsurface
and for offset midsurface command, the code would be the same?
Tks!
W. Yamada
re: midsurface
The code would be very similar; to find midsurface features, you would need to change
If myFeature.FeatureType = "BLEND" Then
to
If myFeature.FeatureType = "MIDSURFACE" Then
From there, the journal should work to find midsurface features, though you might also want to change the names of the "blendList" and "theBlend" variables to better document their use.