feature script
Discussion List
-
Trim previous sketch entities with FS?
I'm working on a feature that—among many other steps—copies and trims some existing sketch curves. I want the output to look and behave just like a normal sketch entity. I'd asked previously about whether we can do something like "use" to convert an existing entity into my sketch that the feature is making (was told no).…
-
Feature Scripts: One large script, or Several small scripts for variables across multiple documents
I'm using scripts to make variables for every aspect of a huge project (Over 2000 variables and counting). I'm wondering if there's any performance difference between having all of these organized into 3-4 script files or 20+ script files? Some background: I'm designing a large structure that I've been working on for 4…
-
constructPath() sometimes doesn't return a continuous path, possible bug?
I have been using constructPath() to construct a continuous path along a set of connected edges supplied by the user. My code then iterates over each edge in the path and queries the geometry using evApproximateBSplineCurve(). If the path's flipped flag is set to true for an edge, then I process that edge in reverse. For…
-
Why can't I pass a value with units to an opThicken
Why can't I pass a value with units to an opThicken unless it's passed in as a variable from function parameter definition: https://cad.onshape.com/documents/c8eef2271809c4293325c9b1/w/d82cceae829e190d1649e512/e/287a2ff37d6f3ee70d59456f (for onshape team only). see line 61 to 69 and note that this all works with no errors…
-
How to accept wonky strings as featurescript inputs?
Hi! I'm writing a Featurescript that will (hopefully) take an SVG string input, and parse it/convert it into Onshape sketch features, letting users essentially import SVGs through a configuration input. (This would let you integrate configurable logos into your designs, where a user can just upload an SVG in string form,…
-
Spline plus cross sections for loft
Possible to draw a spline (middle line of cross sections) and automatically put rectangles (cross sections, Height/2 and Width/2) from file at given length to make a loft? Length (cm) Area (sq cm) Side Len (cm) Height/2 (cm) Top Len (cm) Width/2 (cm) Width Flare…
-
Insert part by name not by PartStudioData
Hi allI'm looking for a way to insert in FeatureScript existing parts by name/URL or anything else without using UI input via PartStudioData.I can generate the part name in FS via my local situation and I then insert a corresponding additional part into the local situation. I'm talking about several hundred parts here, so…
-
Delete internal volume featurescripts
Hello, I am calculating buoyancy of an assembly and I am wondering if there are existing featurescripts that can help automate my process. I begin with my assembly and use Create part studio in context using the assembly origin as the origin of the new part studio. I then use Transform -> Copy in place to grab all the…
-
FS for sheet metal slotted bend lines?
I was looking for some examples of designs for precise sheet metal bend lines and found a patent with a series of interesting slotted bend line designs. According to Google the patent is expired since 17-8-2020 and the designs can be used free. It looks like something that could be an useful FS. I just started using…
-
Feature Script
Hello! I'm looking for any feature script which can give me back the name of the version where I'm working in. The reason for this is the following one: I want to assign a customize part propertie where the part number contain the version name, so I need to achive the document version to add in a variable. Thanks!
-
Looping sketch creation with Extrude Cut or Boolean
Hi All, I have a feature script for crate a broached hex, and I have three main issues, which I'm hoping I can get help on. The link to the document is here: https://cad.onshape.com/documents/143d97f968e97efe61cf1d4f/w/86344877e8b059d820b296f3/e/7dd59a453a901190faf0a82a * I am trying to have the extrude cut feature remove…
-
Internal or External Surface Selection
Hi, I am learning how to use Feature Scripts and I have come up against a bit of a road block that I'm sure must be relatively easy to solve: I can't figure out how to tell whether a user selected surface is an external or internal face (for example a cylindrical surface could be either a hole or a shaft). Please could…
-
How to mirror a feature?
I would like to mirror the opSweep and opBoolean function, on the opposite side of a cylinder. The documentation says, that i need a featureList as an input for the instanceFunction. Could not find out, how i can construct it. Or is there another way I could achieve this?? opSweep(context, id + "sweep1", { "profiles" :…
-
Custom feature programmer
Hello, Any recommendations for custom feature developers? Thank you
-
Variable Section Body FS Help
Hi, I am working with the Variable Section Body FS to try and create a serpentine flexure hinge that has a variable width. I am currently running into issues with keeping the section centered around the path line. Does anyone have experience utilizing this feature script and can tell me what I am doing wrong or whether…
-
Multi Mate Connector - Face Mode U/V Axis
@konstantin_shiriazdanov With the Face option for Multi mate connector, it would be really nice to have an explicit way to chose the secondary axis being aligned to the U or V direction. Right now, it seems like if I pick the Face as the secondary reference instead of Default, I can get it to flip from U to V, but I…
-
Centred Text in FeatureScript
I'm trying to create a simple featurescript thing that will take a numeric value (from a variable, but that's incidental), convert it to a string with a prefix and write it as text centred on the origin of a face of a body. Most of that is quite straightforward, but I've been completely beaten by the (seemingly simple)…
-
How can i write feature script for triangular pyramid?
How can i write feature script for triangular pyramid?
-
How to write triangular pyramid in feature script!
i've a problem when i write feature script for triangular pyramid,here a prbolem ,Please tell me what i need?annotation { "Feature Type Name" : "pyramid" }export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation {…
-
In Feature Script: Zero need ValueWithUnits when sketching somethings?
Hello Everyone, I try to sketch circle like this: precondition { annotation { "Name" : "Ring Diameter" } isLength(definition.myRingDiameter, { (millimeter) : [0, 120, 500] } as LengthBoundSpec); } var D = definition.myRingDiameter; skCircle(sketchPINS, "circle1", { "center" : vector(0 , D/2), "radius" :…
-
Custom feature script for 2 extrudes
I would like to make a feature script that will make 2 extrudes. I do this exact same action very often and I would like to make this automated. Regarding FeatureScript I am still relatively new (I have made a few featurescipts for variable lists), so I wanted to ask what I would need to do to make these actions happen.…
-
Is there a way to control dependencies in the 'configure properties' table?
I'm wondering if anyone can tell me how to use FS to control dependencies in the configurations property table(if possible). For instance, I have a hose I want to vary in both diameter and length. For any length of hose with D=1", I would want the part number to be 1. For any length of hose with D=2", I would want the part…
-
How to select only created sketch objects?
I've been working on improving the part lightening script that I made, and have run into a issue that I can't think of a way to get past. I have the script create rectangles follow the path of selected lines to make the ribs between parts. But I'm running into the problem where the extrude operation includes automatically…
-
Set a color to the holes with cosmetic-thread
Hi all.Does anyone know if it is possible to create a feature-script in Onshape to set a specific color to the faces (red for example) only for the holes with a cosmetic thread created in my part? Thank you in advance