I'm looking for an answer in VB.NET
I have a part with some attributes I put under one specific category, named "LCA"
Is there a way to get all the titles under this category as a string()?
Thanks in advance,
Student at University of Ghent
Solved! Go to Solution.
Since the Category designator is held in a structure element in the AttributeInformation, I think you would need to get all of the part attributes with GetUserAttributes(), and then iterate through them to see if each one is marked with the Category that you are interested in. (I have not tested this.)
Option Strict Off
Dim theSession As Session = Session.GetSession()
Dim wp As Part = theSession.Parts.Work
Dim specifiedCategory As String = "LCA"
Dim allPartAttrInfos() As AttributeInformation = wp.GetUserAttributes()
For Each thisAttrInfo In allPartAttrInfos
If thisAttrInfo.Category.Equals("LCA") Then
Echo("Title: " & thisAttrInfo.Title.ToString())
Echo(" Value: " & thisAttrInfo.StringValue.ToString())
Echo(" Category: " & thisAttrInfo.Category.ToString())
Sub Echo(ByVal output As String)
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Yes, I think so too.
Thank you for your help.
May I ask what "Echo" does in your code? I'm not familiar with that command.
It is a very small subroutine that is used to send the output to both the information window and the NX syslog. You will see it in a lot of the example programs that we post on the Solution Center.