Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Attribute updated by journal, how to control the context? (ObjectOptions is obsolete)

Status
Not open for further replies.

erpj

Aerospace
Jul 15, 2011
24
Hi Everyone,

A lot of my journals use the "AttributePropertiesBaseBuilder.ObjectOptions" Enumeration to define in which context the attribute will be created. However, it appears that starting from NX8.5 this Enumeration is obsolete. The help documentation says:

("Deprecated in NX8.5.0. Use AttributePropertiesBaseBuilder.SetAttributeObjects instead.")

However, it is unclear to me how this method replaces the "ObjectOptions". How could you use SetAttributeObjects to specify that you want this attribute to be applied to all instances, or only one occurrence, or the part itself...

As an example, here is a snippet of code I use to apply the same CALLOUT to multiple components, how could I implement the new method in this script?

Code:
For Each tempComp As Component in CompList

	' ----------------------------------------------
	'   Update of the CALLOUT attribute
	' ----------------------------------------------
	objects(0) = tempComp

	attributePropertiesBuilder1 = workpart.PropertiesManager.CreateAttributePropertiesBuilder(objects)
	attributePropertiesBuilder1.ObjectPicker = AttributePropertiesBaseBuilder.ObjectOptions.ComponentInstance
	attributePropertiesBuilder1.DataType = AttributePropertiesBaseBuilder.DataTypeOptions.String
	attributePropertiesBuilder1.Category = "DB Component Instance"
	attributePropertiesBuilder1.IsReferenceType = False
	attributePropertiesBuilder1.Title = "CALLOUT"
	attributePropertiesBuilder1.IsArray = False
	attributePropertiesBuilder1.StringValue = StartCallout.ToString()
	'CStr(Int((1000 - 0 + 1) * Rnd) + 0)
	attributePropertiesBuilder1.Commit()
				
	Processed = Processed + 1

Next

Etienne
NX8.5.3.3 + TC9.1.2.2

 
Replies continue below

Recommended for you

Looks like SetAttributeObjects(NXObject[]) accepts array of NXObjects. So to assign part attribute you pass in the Part object, to assign attribute to instances you pass in NXOpen.Assemblies.Component objects and to assign Component attribute you pass in workPart.ComponentAssembly.RootComponent object.

I think to assign attributes to all occurrences you need to pass in all the component instances now. Even interactively I could not find the option to apply attributes to all occurrences.

Suresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor