Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Binary arithmetic/operators in featurescript?

mark_sherriff693mark_sherriff693 Member Posts: 2 EDU
Hi,

I'm looking to be able to do things like XOR, bit shifting and bit masking inside a function in FeatureScript, as part of a generative algorithm to draw a pseudo Hilbert curve.

Unfortunately, this looks like it's not possible, as FS gives no binary operators or binary types - is there a known way to do these sorts of things in the community?

The closest I can get to anything resembling it in decimal is representing a right shift as "floor(value / 2)" - but this is only one part of the algorithm.

Thanks

Comments

  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,034 EDU
    @mark_sherriff693

    There is no binary operators in FeatureScript. You will have to do your own functions for that. Also, all numbers in FeatureScript are represented as double-precision floats, so you will lose some precision as soon as you go above ~53 bits.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
Sign In or Register to comment.