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.
Linear Sketch Pattern FeatureScript Example
Lauren_Froschauer
Member Posts: 10 EDU
I have been trying to implement a linear sketch pattern in FeatureScript.
For guidance, I created a linear sketch pattern using the standard Onshape interface and took a look at the parts studio code.
I found the code really hard to decipher.
It would be great if someone could comment with an example of how to create a linear sketch pattern using FeatureScript.
For context, I am trying to create a box joint tool that makes a sketch pattern of squares for extruding.
For guidance, I created a linear sketch pattern using the standard Onshape interface and took a look at the parts studio code.
I found the code really hard to decipher.
It would be great if someone could comment with an example of how to create a linear sketch pattern using FeatureScript.
For context, I am trying to create a box joint tool that makes a sketch pattern of squares for extruding.
0
Comments
When you have code specifying where you want everything to be, it's generally easier to leave out constraints and just calculate where each point should be placed in the first place. Since there is no way to modify FS sketches after they are created, there's no need to also have all the constraint-adding noise that makes sketches more easily interactive.
To sketch the profile of a box joint, I'd suggest thinking about exactly how to calculate what coordinates to put each endpoint of each of the lines based on your inputs. The programming tool for the job is not a linear pattern, but a
for
loop. The gear from the demo might be a good example of the type of program you'd want.Going to chime in since Lauren and I talked about this in a meeting before she made the forum post. Both of us are working on box joints -- my gut reaction was to sketch out some line segments/rectangles and implement it with a
for
loop, while Lauren's gut reaction was to try using a linear pattern function (based on her CAD experiences). We thought the difference in thought process for initial implementation ideas was interesting, and is probably related to our different technical backgrounds (mine in software, and Lauren's in mechanical design). Of course both of us know very well what loops are and linear patterns are, but it's interesting to explore how we think about problems to FeatureScript solutions, and how different subsets of the target audience might think about problems to FeatureScript solutions.