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.
Best Of
Re: Issues with Transforming imported Model
It depends on what you imported but "transform by mate connector" is the best option. You may need to create a some reference geometry (like a sketch to find the center, etc…) if there is no "obvious" reference point on your imported model.
Re: Copy from a sketch on one plane to another plane with only different "Z values
Thank you Michael. This is what I was looking for. My problem is solved
Re: Best way to convert a mesh to a solid
Re: Golden angle pattern (Sunflower)
@EvanReese Thanks. of course I know zip about programing. Except how to cut and paste.
So i took your "embarrassing" code and dropped it into Grok 3.
Below is what it sent back:
FeatureScript 1188;
import(path : "onshape/std/geometry.fs", version : "1188.0");
// Icon import (kept for UI consistency)
icon::import(path : "e8e9c163f08fa68c8a76741c", version : "79a131bdedd16200dcbcb8dd");
// Default bounds for sunflower pattern
export const SUNFLOWER_PATTERN_BOUNDS = {
(meter) : [-500, 0.001, 500],
(centimeter) : 0.2,
(millimeter) : 2,
(inch) : 0.1,
(foot) : 0.1,
(yard) : 0.025
} as LengthBoundSpec;
export const SUNFLOWER_COUNT_BOUNDS = {
(unitless) : [1, 25, 1e5]
} as IntegerBoundSpec;
// UI Definition for Sunflower Pattern
annotation { "Feature Type Name" : "Sunflower Pattern", "Icon" : icon::BLOB_DATA }
export const SunflowerPattern = defineFeature(function(context is Context, id is Id, definition is map)
precondition
{
annotation { "Name" : "Center Point", "Filter" : EntityType.VERTEX && SketchObject.YES || BodyType.MATE_CONNECTOR, "MaxNumberOfPicks" : 1 }
definition.center is Query;
annotation { "Name" : "Seed Diameter", "Default" : 2 * millimeter }
isLength(definition.seedDia, SUNFLOWER_PATTERN_BOUNDS);
annotation { "Name" : "Inside Diameter", "Default" : 5 * millimeter }
isLength(definition.innerDia, SUNFLOWER_PATTERN_BOUNDS);
annotation { "Name" : "Outside Diameter", "Default" : 50 * millimeter }
isLength(definition.outerDia, SUNFLOWER_PATTERN_BOUNDS);
annotation { "Name" : "Seed Count", "Default" : 25 }
isInteger(definition.count, SUNFLOWER_COUNT_BOUNDS);
annotation { "Name" : "Depth", "Default" : 1 * millimeter }
isLength(definition.depth, SUNFLOWER_PATTERN_BOUNDS);
annotation { "Name" : "Flip Direction", "UIHint" : "OPPOSITE_DIRECTION", "Default" : false }
definition.flip is boolean;
}
{
// Validate diameters
if (definition.innerDia >= definition.outerDia)
throw regenError("Inside Diameter must be less than Outside Diameter", ["innerDia", "outerDia"]);
// Core variables
const goldenAngle = (3 - sqrt(5)) * PI * radian;
var normal;
// Determine normal from center point
try silent
{
normal = evOwnerSketchPlane(context, { "entity" : definition.center }).normal;
}
try silent
{
normal = evMateConnector(context, { "mateConnector" : definition.center }).zAxis;
}
if (normal == undefined)
throw regenError("Invalid Center Point: Must be a sketch vertex or mate connector");
// Create sketch plane
var origin = evVertexPoint(context, { "vertex" : definition.center });
var skplane = plane(origin, normal);
opPlane(context, id + "plane1", { "plane" : skplane });
// Create and solve sketch for seed circle
var theSketch = newSketchOnPlane(context, id + "sketch1", { "sketchPlane" : skplane });
skCircle(theSketch, "circle1", {
"center" : vector(0, 0) * inch,
"radius" : definition.seedDia / 2
});
skSolve(theSketch);
// Extrude the seed circle
var extrudeNormal = definition.flip ? -normal : normal;
opExtrude(context, id + "extrude1", {
"entities" : qSketchRegion(id + "sketch1"),
"direction" : extrudeNormal,
"endBound" : BoundingType.BLIND,
"endDepth" : definition.depth
});
// Sunflower pattern transforms within inner and outer diameters
var axis = line(origin, normal);
var transforms = [];
var instanceNames = [];
var innerRadius = definition.innerDia / 2;
var outerRadius = definition.outerDia / 2;
var range = outerRadius - innerRadius;
var step = definition.count > 1 ? range / (definition.count - 1) : 0; // Handle single instance case
for (var i = 0; i < definition.count; i += 1)
{
var dist = definition.count > 1 ? innerRadius + (step * i) : innerRadius; // Single instance at inner radius
var angle = goldenAngle * i;
transforms = append(transforms, rotationAround(axis, angle) * transform(skplane.x * dist));
instanceNames = append(instanceNames, "_" ~ toString(i));
}
// Apply pattern
var seedBody = qCreatedBy(id + "extrude1", EntityType.BODY);
opPattern(context, id + "pattern1", {
"entities" : seedBody,
"transforms" : transforms,
"instanceNames" : instanceNames
});
// Cleanup
opDeleteBodies(context, id + "deleteBodies", {
"entities" : qUnion([qCreatedBy(id + "plane1"), qCreatedBy(id + "sketch1")])
});
});
Re: Golden angle pattern (Sunflower)
My Speaker Pattern feature does fibonacci patterns like this. It doesn't do the starts/stops, but could be modified to do so. It's one of my earliest custom features so the code is kind of embarrassing, but could be a great start. To make it really efficient for that many holes I'd aim to convert it to being a face pattern, not a feature or body pattern.
Re: 3D printing - Where do I start?
The software that came with your printer is usually the first choice.
Re: Custom Feature Icon for Dark Mode
@ethan_keller924 Dark mode is a complex thing and in the design we tokenized many of the colors so our system knows the flip colors for dark and light mode. Today, you would need to just pick icon colors that work best with both modes. We may publish a set of color tokens that can be used in the SVG to ensure the some of the darker tones to icons know how to properly flip. This is not something we have documented or published outside of our internal design system.
lougallo






