Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
As a generate string to -> ASCII Binary (FeatureScript to generate QR )
Fda
Member Posts: 42 ✭✭
Hi, I'm trying to create a FeatureScript to generate QR as a solid body.
The question is:
As a generate -> ASCII -> Binary
https://cad.onshape.com/documents/c147851704bf76a3ee2c0a30/w/4febbbd4c01a9812f459fe10/e/e9ef4309e41a74f961e25983
I was inspired by this "OpenSCAD" code
https://ridercz.github.io/OpenSCAD-QR/
As a generate -> ASCII -> Binary
Hi, I'm trying to create a FeatureScript to generate QR as a solid body.
Is it an easy way to generate an ASCII Binary?
(Surely something easy lol)
const chrMap_Binary = { '=' : "00111101" ,// chr(61) '>' : "00111110" ,// chr(62) '?' : "00111111" ,// chr(63) '@' : "01000000" ,// chr(64) 'A' : "01000001" ,// chr(65) 'B' : "01000010" ,// chr(66) 'C' : "01000011" ,// chr(67) 'D' : "01000100" ,// chr(68) 'E' : "01000101" ,// chr(69) 'F' : "01000110" ,// chr(70) 'G' : "01000111" ,// chr(71) 'H' : "01001000" ,// chr(72) 'I' : "01001001" ,// chr(73) 'J' : "01001010" ,// chr(74) 'K' : "01001011" ,// chr(75) 'L' : "01001100" ,// chr(76) 'M' : "01001101" ,// chr(77) 'N' : "01001110" ,// chr(78) 'O' : "01001111" ,// chr(79) 'P' : "01010000" ,// chr(80) 'Q' : "01010001" ,// chr(81) 'R' : "01010010" ,// chr(82) 'S' : "01010011" ,// chr(83) 'T' : "01010100" ,// chr(84) 'U' : "01010101" ,// chr(85) 'V' : "01010110" ,// chr(86) 'W' : "01010111" ,// chr(87) 'X' : "01011000" ,// chr(88) 'Y' : "01011001" ,// chr(89) 'Z' : "01011010" ,// chr(90) '[' : "01011011" ,// chr(91) '\'' : "01011100" ,// chr(92) ']' : "01011101" ,// chr(93) '^' : "01011110" // chr(94) }; annotation { "Feature Type Name" : "QR" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "My String" } definition.myString is string; } { // Define the function's action var chartt = splitIntoCharacters(definition.myString); //returns Characters<br> ???????????? T<b></b>he question is: ?????????????<br> // front chartt var qr_data = [[1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1] ]; for (var axis_x = 0; axis_x < mySizeStrign + 1; axis_x += 1) { if ((qr_data[axis_x ][axis_y ]) == (1)) // is true ? { fCuboid(context, id + ("cuboid1" ~ axis_x ), { });
https://cad.onshape.com/documents/c147851704bf76a3ee2c0a30/w/4febbbd4c01a9812f459fe10/e/e9ef4309e41a74f961e25983
I was inspired by this "OpenSCAD" code
https://ridercz.github.io/OpenSCAD-QR/
Tagged:
2
Answers
Here is an example that will do all characters to a number, including control and punctuation characters:
(Script was generated externally )
IR for AS/NZS 1100