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.

How to extrude imported parts with a featurescript

Lucas_LovettLucas_Lovett Member Posts: 6

I am making a featurescript that generates some parts to make the CAD process faster for my FRC team and I'm not sure how to extrude an imported part. I want to make it so that you can change it's length based off a definition.length inputted earlier in the featurescript. This is my first time doing a featurescript so the answer might be obvious but I just don't know what to do yet. If someone could point me to the right documentation or give me some examples that'd be greatly appreciated.
Code Snippet I have for the import of the 8020 part I want to extrude
if (definition.materialSelection == materialChoice.eightyTwenty)

    {
        startVec = evVertexPoint(context, { "vertex" : definition.startPoint });
        if (definition.generationChoice == generationType.TWO)
        {
            endVec = evVertexPoint(context, { "vertex" : definition.endPoint });
            dir = normalize(endVec - startVec);
            dVec = endVec - startVec;
            normDVec = norm(dVec);
        }
        if (definition.generationChoice == generationType.ONE)
        {
            csys = evMateConnector(context, { "mateConnector" : definition.startPoint });
            dir = csys.zAxis;
            if (definition.reverseDir == true)
            {
                dir = -1 * csys.zAxis;
            }
        }
        if (definition.generationChoice == generationType.ONE)
        {
            if (definition.eightyTwentyType == eightyTwentyTypeOptions.ONE)
            {
                addInstance(instantiator, eightyTwenty1x1::build, { "transform" : thingTransform });
                instantiate(context, instantiator);
            }
            if (definition.eightyTwentyType == eightyTwentyTypeOptions.TWO)
            {
                addInstance(instantiator, eightyTwenty1x2::build, { "transform" : thingTransform });
                instantiate(context, instantiator);
            }
        }
        if (definition.generationChoice == generationType.TWO)
        {
        }
    }

Any tips on how to layout this differently would be greatly appreciated as well since this is one of my first featurescripts so any advice or tips would be greatly appreciated.

Comments

Sign In or Register to comment.