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.
featurescript
Discussion List
-
drawing a line with Features Script
Hello I want to draw a sphere and its radius. I wrote this code: annotation { "Feature Type Name" : "drawSphere" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "Radius" }…
-
Thickness Analysis (New Custom Feature!)
Thickness Analysis (New Custom Feature!) https://cad.onshape.com/documents/thicknessAnalysis With this custom feature, you can easily analyze the thickness of multiple faces. Special thanks to @Jacob_Corder for some performance tips. This feature is sponsored by CADSharp.com. If your daily modeling is repetitive, consider…
-
Set a custom property via Featuresript for another custom property
I am currently trying to write a bit of featurescript that will query a manual entry custom property within a part and write it to another custom property in a drawing. The part custom property has an ID that I can access, but I am really struggling to get the syntax right. Can anyone point me at an example of this?
-
How to pattern a revolve remove feature within featurescript?
Hi All, I've been tasked to create a bunch of bolt circle patterns using featurescript and am looking for a way to minimize the number of bolt hole sketches I have to make. My desired workflow: 1. Create a single sketch profile and revolve cut that 2. Then use some circular pattern function to replicate the revolved cut at…
-
Deleting Multiple Sketches with one opDeleteBodies???
I am working on a featurescript for taper lock bushings that will have something like 50 sketches/fitSplines after I work in all available sizes/hole patterns. Individually deleting bodies is helpful during custom feature generation, but, imo, makes the script unnecessarily long once finalized. Is there a way to delete all…
-
Slick trick for force closing a sketch profile in FS?
Howdy, My company recently switched to OS from Alibre so I am re-vamping all of our configurators with FS. This went super well for roller chain sprockets/bushings but I am struggling with welded steel and pintle chain sprockets because the mathematics in the ASME are JUST imprecise enough to prevent a closed sketch…
-
Trying to translate loft() to opLoft() in FeatureScript
Hi featurescript experts, I am trying to loft 2 organic shapes together using Featurescript opLoft() but I am just unable to get it to work, though I am able to achieve the result I want using the user interface which generates code using loft() instead of opLoft(). Here's the link to my test…
-
Multi Mate Connector request
@konstantin_shiriazdanov This is a great featurescript A couple things that could make Multi Mate edits faster * Display translate (offset) & revolve x,y,z delta coordinates for each item in the Transform array dialog * Ability to reorder those items
-
Best ways to create a 1:1 relationship between a set of queries and some other settings?
I'm working on a feature that generates a list of parts, which should have some values associated with them by the feature. Later (in the same feature), when I query one of those parts, I want to be able to get a list of the settings for it. I thought I might be able to use the query itself as the key to a map, which would…
-
Boardfoot Estimate (New Custom Feature)
We make custom handmade furniture and a big part of the design process is estimating stock. Rough wood is commonly measured and purchased in "board foot" (abbreviated bdft, bf). I created this super simple feature to show the bf measure in the featurelist. The feature uses the part's volume to convert to bf. Optionally,…
-
Custom Feature Update
Hi, I have used a custom feature of the Tangent plane when sketching, and it appears we have an update as per the attached image but I don't want to update the feature. Is there a way I can lock it so that the blue symbol can disappear, I understand it's possible to do this in assembly using Pin Reference. The reason I…
-
FS working in file with featurestudio but not when added to tool bar?
Hi All, I am wondering if anyone has experience trouble shooting this: I have a sprocket feature script that functions perfectly in the main file, but fails on a specific user input combination once I have added it to my tool bar in a different document. In the screen shot below the lefthand view is a close up of my…
-
How to read in specific variables from a CSV based on user inputs
Howdy Folks, I am trying to scan the first two columns of rows in a CSV using two numeric user inputs as the search key and find a match. Then, return the remaining two column values as variables required for creating a hub on a sprocket. Every simplification/variation of the code that I have tried returns the same…
-
How do I query an object after a boolean union?
I'm creating a feature that allows me to extend multiple walls up to a target height. * Select the top face of a wall element. * opExtrude a calculated distance to create a new wall element. * opBoolean union to join the two parts * I need to select the part created with the opBoolean to modify its attributes. I see the…
-
Passing in featureList as Argument, but not from a Feature Parameter
I'm in a slight dead end figuring out how a feature I've written can be used by some other features, when the feature has an 'is featureList' input (to ingest all the things created by a feature, which may vary). See the below example, where I want the thing represented by 'fList' to be a featureList type, and for it to…
-
FeatureScript name is red
Hello I wrote a feature script that runs without error, but the name of the featurescript is highlighted in red. Even closed. Why ? https://cad.onshape.com/documents/b779fbc5c77223353d4ce6aa/w/5beeb6a22fc35205de002ae9/e/d808d6b0bcd0567c369b865a?renderMode=0&uiState=64d9f243c22dde25a208712e
-
Why debug feature is not displayed ?
Hello, When I use the debug feature on a vector, the data are displayed in the FeatureScript Notice, but the lines are not drawn on the screen.I thought they should appear, right? I use the debug feature to display these lines on the sketch { // 1st line var line1Start = [x1, y1]; var line1End = [x2, y2];…
-
setExternalDisambiguation - Multiple Face Replacements on a Solid Body
I'm trying to create a feature that will approximate a number of curved surfaces, usually just 4 sided, with simplified planar surfaces using ReplaceFace. Taking three vertices from a face and turning it into a plane which replaces a face. If there's only one curved face in the solid body, then it works fine. But I can't…
-
Is it possible to configure properties of a body with Featurescript?
I'm trying to find out if it's possible to configure a body using Featurescript. The concept: -Prompt for two user-selected bodies -Get string from property "Name" of each part -Create a new simple body (in this case a cylinder) -Configure the cylinder to have two configurations -Set configured "Name" properties of the…
-
FeatureScript behaviour
I'm trying to understand how FeatureScripts work. I wrote a simple script :: export const main = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Select Spline", "Filter" : EntityType.EDGE, "MaxNumberOfPicks" : 100 } definition.curves is Query ; } {…
-
FeatureScript Notice
Hello, Is there a way to clear the FeatureScript Notice ?
-
Spline with an array
Hello I need some help with the spline.I wrote a feature which draw a spline from a csv fileInside I use this code } else if (linetype == "C") { var P1 = point_courant; var P2 = vector(aline[1], -aline[2]) * ZoomCoefficient + splineOffset; var P3 = vector(aline[3], -aline[4]) * ZoomCoefficient + splineOffset; var P4 =…
-
FeatureScript TableData not effective.
I write a FeatureScript which has to import a csv file : export const CSV_Path = defineFeature(function (context is Context, id is Id, definition is map) precondition { annotation { "Name": "file" } definition.myPathCurve is TableData; My problem is that half the time the file is not read The script starts correctly, If I…
-
println units
Hello Here is a small piece of code: var sketchPlane = evOwnerSketchPlane(context, { "entity" : definition.selectedEdge }); var n = 100; var samples = evEdgeTangentLines(context, { "edge" : definition.selectedEdge, "parameters" : range(0, 1, n) }); var origin = worldToPlane(sketchPlane, samples[0].origin); println(origin *…
-
evaluateSpline: Parameter at index 0 is outside the knot vector
I used a Split feature on a curve (helix) entity, and wanted to then subdivide this split version of the entity into line segments. However, I got the below error. Is this because the curve needs to in an ideal world be reparameterised between 0 and 1? Has the split operation done some funky business where it's almost…
-
skFitSpline and bSplineCurve .controlPoints
Hello, I draw a spline on sketch1: skFitSpline(sketch1, "spline1", { "points" : [ vector( 0 , 0) * centimeter, vector( 100, 100) * centimeter ], "startDerivative" : vector(150 , 0) * centimeter, "endDerivative" : vector(0 , 150) * centimeter, }); test: same with code formatting <div> skFitSpline(sketch1, "spline1",…
-
Reading feature related infromation
Is there any way to get the information added in feature script(samples below) through api. throw regenError("This is a regen error");reportFeatureInfo(context, id, "Some error found"); https://cad.onshape.com/documents/a63f2300d0234e62b89f906d/w/1432bb01183f19577aa937e2/e/32e2592e0830a05993a8a875