Bitmasks are essentially bitwise comparisons. Understanding how bitmasks work might make more sense if you think of their binary representation.

The binary representation of the decimal number 1 is 0001, 2 is 0010, 4 is 0100, etc.

Think of each bit as a switch. For example, the decimal number 5 in binary is 0101. The third bit (0100) is on and the first bit (0001) is on. So, 0101 = 0100 + 0001.

If a SolidWorks enumerator has a bitmask like the following:

 Decimal Option Binary 1 OptionA 0001 2 OptionB 0010 4 OptionC 0100 8 OptionD 1000

and you want OptionA and OptionC on, then add their two values together:

 Decimal Option Binary 1 OptionA 0001 + 4 OptionC 0100 = 5 0101

Provide feedback on this topic

* Required

 *Email: Subject: Feedback on Help Topics Page: Bitmasks *Comment: * I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

Never show this message again
x

Web Help Content Version: API Help (English only) 2014 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.