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.

Using a data file to pick and place components?

I am a retired engineer / amateur artist and I have a project that I wondered if I could use onshape for.  Basically I want to make a grid (about 30 x 23) of 6 different types of cubes, these would be selected depending upon the data in a file which would be read in sequence.  The file (yet to be made) would be derived from a small pixelated black and white photo. I have not found anyone else who has done this, and I was wondering if it was at all possible. I fear it is not and that I will have to write some software to do this for me. Hopefully someone has some great ideas. 

Just to clarify, the goal of the project is to take a simple image and convert the pixels to one of six (may change) different cubes.  The cubes will have different slopes on their fronts, catching the light to represent different levels of grey.  For small pictures I will be able to do this by hand, but I would like to automate the process so that I can go bigger and 3D print.  Hope that makes sense :)

Answers

  • david_duncan238david_duncan238 Member Posts: 6
    I have just discovered Feature Scripts, I shall look into this.
  • SethFSethF Member Posts: 130 PRO
    edited October 2023
    I did something very similar. I used third parties to extract/format pixel data. But then this does about the same thing you’re talking about. You’d just want yours to assign a slope angle instead of a color to the different pixels.
    https://forum.onshape.com/discussion/18579/just-for-fun-pixel-cuboids#latest

    It was only ever half-baked, and only ever just-for-the-fun-of-it. But hopefully it'd be a decent starting point.
  • david_duncan238david_duncan238 Member Posts: 6
    SethF said:
    I did something very similar. I used third parties to extract/format pixel data. But then this does about the same thing you’re talking about. You’d just want yours to assign a slope angle instead of a color to the different pixels.
    https://forum.onshape.com/discussion/18579/just-for-fun-pixel-cuboids#latest

    It was only ever half-baked, and only ever just-for-the-fun-of-it. But hopefully it'd be a decent starting point.
    Thanks SethF, that looks promising, I shall look into your code. 
  • EvanReeseEvanReese Member, Mentor Posts: 2,144 ✭✭✭✭✭
    Evan Reese
  • david_duncan238david_duncan238 Member Posts: 6
    Thanks @SethF and @Evan_Reese for your input.  I have modified SethF's code and made a bunch of tiles in a greyscale (Greyscale) and I have made a squat cube with a triangle on top (SlopedCube), but I am having problems...

    Firstly I this part of the code in SlopedTriangle...

            // Draw triangle on side of squat cube
            skPolyline(sideTriangle, "polyline1", {
                    "points" : [
                        vector( 0,  0) * millimeter,
                        vector( -10,  0) * millimeter,
                        vector( -10,  5) * millimeter,
                        vector( 0,  0) * millimeter
                    ]
            });

    I am not able to change the "5" for the variable tHeight.

    And secondly I am having problems integrating the triangles into the Greyscale code.

    Here is a link to my code...

    https://cad.onshape.com/documents/fb0ed495e5d632ce2327435c/w/9e9dc44a0a8ae3e252105af2/e/7b1ac23f74f7656795ca7dbc

    I have commented out the bits that don't work in "Greyscale".

    I found that I could make the wedge shapes I wanted manually using rotate in MoveFace, but I could not make the Rotate feature work in Feature Script.

    I'm not that familiar with Feature Script, but I have done a fair amount of C and HTML. I'm sure there is probably a better way of approaching this, I would appreciate a little help.

    David
Sign In or Register to comment.