PartObject Class

class NXOpen.Preferences.PartObject

Bases: object

Represents the set of object preferences applicable to entire part.

All the preferences available at UG GUI for object can be set by using this class except work layer. Work Layer should be set by using NXOpen.Layer.LayerManager class which holds a work layer property. To obtain an instance of this class, refer to NXOpen.Preferences.PartPreferences

New in version NX3.0.0.

Properties

Property Description
FaceAnalysis Returns or sets the face analysis flag for Solid and Sheets
PartiallyShaded Returns or sets the partially shaded flag for Solid and Sheets
Translucency Returns or sets the translucency value

Methods

Method Description
ConvertColorNumberToRGBValue Converts color number to RGB constituents.
ConvertRGBValueToColorNumber Converts RGB color constituents to color number.
GetColor Returns the current color value for specified type.
GetLegacyLineWidthMap Gets line width map that is used to convert legacy line widths to new line widths.
GetLineFont Returns the current line font for specified object type
GetWidth Returns the current width for specified object type
MigrateLegacyLineWidths Migrates line width attributes stored in the part file to corresponding new line widths.
SetColor Sets the color.
SetLegacyLineWidthMap Sets line width map that is used to convert legacy line widths to new line widths.
SetLineFont Sets line font for specified object type
SetWidth Sets width for specified object type

Enumerations

PartObjectColorSelection Enumeration Describes whether color of object is not changed or it is default color or it is defined by user
PartObjectLineFontType Enumeration Represents the available types for font
PartObjectObjectType Enumeration Describes all available Types for object selection
PartObjectWidthType Enumeration Describes the available types for width

Property Detail

FaceAnalysis

PartObject.FaceAnalysis

Returns or sets the face analysis flag for Solid and Sheets

-------------------------------------

Getter Method

Signature FaceAnalysis

Returns:
Return type:bool

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Setter Method

Signature FaceAnalysis

Parameters:faceAnalysis (bool) –

New in version NX3.0.0.

License requirements: None.

PartiallyShaded

PartObject.PartiallyShaded

Returns or sets the partially shaded flag for Solid and Sheets

-------------------------------------

Getter Method

Signature PartiallyShaded

Returns:
Return type:bool

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Setter Method

Signature PartiallyShaded

Parameters:partiallyShaded (bool) –

New in version NX3.0.0.

License requirements: None.

Translucency

PartObject.Translucency

Returns or sets the translucency value

-------------------------------------

Getter Method

Signature Translucency

Returns:
Return type:int

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Setter Method

Signature Translucency

Parameters:translucency (int) –

New in version NX3.0.0.

License requirements: None.

Method Detail

ConvertColorNumberToRGBValue

PartObject.ConvertColorNumberToRGBValue

Converts color number to RGB constituents.

The color number passed should be between 1 to 216

Signature ConvertColorNumberToRGBValue(colorNumber)

Parameters:colorNumber (int) – Color value
Returns:Equivalent RGB constituents
Return type:NXOpen.Preferences.ViewVisualizationSpecialEffectsColorRGB_Struct

New in version NX3.0.0.

License requirements: None.

ConvertRGBValueToColorNumber

PartObject.ConvertRGBValueToColorNumber

Converts RGB color constituents to color number.

The Red, Green and Blue color constituents should be between 0 to 255.

Signature ConvertRGBValueToColorNumber(fogColorRgbValue)

Parameters:fogColorRgbValue (NXOpen.Preferences.ViewVisualizationSpecialEffectsColorRGB_Struct) –
Returns:Equivalent color value
Return type:int

New in version NX3.0.0.

License requirements: None.

GetColor

PartObject.GetColor

Returns the current color value for specified type.

The equivalent RGB values can be found by calling ConvertColorNumberToRGBValue()

Red Component is ((((216 - color_number) % 36)/6)* 51) Green component is (((216 - color_number)/36) * 51) Blue is (((216 - color_number) % 6)* 51). So for example if returned color value is 47 then Red is ((((216 - 47) % 36)/6)* 51) = (((169 % 36)/6)* 51) = ((25/6)* 51) = 4*51 = 204 Green is (((216 - 47)/36) * 51) = ((169/36) * 51) = 4*51 = 204 Blue is (((216 - 47) % 6)* 51) = ((169 % 6)* 51) = 1*51 = 51

Signature GetColor(type)

Parameters:type (NXOpen.Preferences.PartObjectObjectType) –
Returns:
Return type:int

New in version NX3.0.0.

License requirements: None.

GetLegacyLineWidthMap

PartObject.GetLegacyLineWidthMap

Gets line width map that is used to convert legacy line widths to new line widths.

Following widths are considered as legacy line widths. Preferences.PartObjectWidthType.ThinWidth Preferences.PartObjectWidthType.NormalWidth Preferences.PartObjectWidthType.ThickWidth

New line widths contain corresponding line widths for above three legacy line widths respectively. New line widths start at Preferences.PartObjectWidthType.WidthOne.

Signature GetLegacyLineWidthMap()

Returns:

Array of 3 new widths each corresponding to a legacy width. First element corresponds to Thin width Second element corresponds to Normal width Third element corresponds to Thick width. :rtype: list of NXOpen.Preferences.PartObjectWidthType

New in version NX10.0.0.

License requirements: None.

GetLineFont

PartObject.GetLineFont

Returns the current line font for specified object type

Signature GetLineFont(type)

Parameters:type (NXOpen.Preferences.PartObjectObjectType) –
Returns:
Return type:NXOpen.Preferences.PartObjectLineFontType

New in version NX3.0.0.

License requirements: None.

GetWidth

PartObject.GetWidth

Returns the current width for specified object type

Signature GetWidth(type)

Parameters:type (NXOpen.Preferences.PartObjectObjectType) –
Returns:
Return type:NXOpen.Preferences.PartObjectWidthType

New in version NX3.0.0.

License requirements: None.

MigrateLegacyLineWidths

PartObject.MigrateLegacyLineWidths

Migrates line width attributes stored in the part file to corresponding new line widths.

The migration is performed based on the legacy line width map stored in the part file.

See Preferences.PartObject.GetLegacyLineWidthMap()

Line widths of various displayable objects such as solids, wireframe, drawing views etc. will be updated to new line widths. Display is regenerated if necessary to reflect the changes. A displayable object, that already has new line width assigned to it, is not affected.

Signature MigrateLegacyLineWidths()

Returns:At least one legacy line width

attribute has been migrated. :rtype: bool

New in version NX10.0.0.

License requirements: None.

SetColor

PartObject.SetColor

Sets the color.

For Default color pass -2 as color value and for no change pass -1. For other color calculate the color in RGB format. If you pass R value of Red component G value of Green and B value of Blue the color will be: color = (((255-R)/51)*6 + ((255-G)/51)*36 + ((255-B)/51)*1) + 1 ; Where R G and B values are between 0 and 255 . So for Green (0,255,0)we will pass color = (((255-0)/51)*6 + ((255-255)/51)*36 + ((255-0)/51)*1) + 1 = 30+0+5+1 = 36 The equivalent color number value can be found by calling ConvertRGBValueToColorNumber()

Signature SetColor(type, color)

Parameters:

New in version NX3.0.0.

License requirements: None.

SetLegacyLineWidthMap

PartObject.SetLegacyLineWidthMap

Sets line width map that is used to convert legacy line widths to new line widths.

See Preferences.PartObject.GetLegacyLineWidthMap()

The new line widths used to map legacy line width are in logical order; i.e.; Preferences.PartObjectWidthType.ThinWidth maps to a smaller width value compared to Preferences.PartObjectWidthType.NormalWidth and so on. Otherwise, the legacy line width map will be rejected.

Signature SetLegacyLineWidthMap(newLineWidths)

Parameters:newLineWidths (list of NXOpen.Preferences.PartObjectWidthType) – Array of 3 new widths each corresponding to a legacy width. First element corresponds to Thin width Second element corresponds to Normal width Third element corresponds to Thick width.

New in version NX10.0.0.

License requirements: None.

SetLineFont

PartObject.SetLineFont

Sets line font for specified object type

Signature SetLineFont(type, lineFont)

Parameters:

New in version NX3.0.0.

License requirements: None.

SetWidth

PartObject.SetWidth

Sets width for specified object type

Signature SetWidth(type, width)

Parameters:

New in version NX3.0.0.

License requirements: None.