featurescript
Discussion List
-
My first Feature Script: Hex Rod
Being an FRC mentor means we draw a lot of 1/2 hex rods. I wrote my first featurescript to let you place a hex rod between two mate connectors. https://cad.onshape.com/documents/68cc6e7f44c7d45ead2a1b38/w/5c67626b11109a69231f9606/e/f5a54e138097299817bb6f7b
-
"Typecheck canBePlane failed", error creating a plane
Can someone help me with this error? it is still creating the plane but failing to sketch on it!! the millThcik is containing an input in millimeters. UPDATE: The issue is resulting from using a valuewithunits instead of an integer, I resolved it by dividing by the unit of measurement. However, I am not able to sketch on…
-
how to make a variable feature with multiple variables
Hi, I would like to have a feature script like the Variable, but then with multiple Variables for the input. The reason is that when you have a very complex document and the Variables in the beginning I takes quite some time to regenerate the drawing after submitting the values. You have to wait for that before adjusting a…
-
Working with evCollision in Featurescript
Okay so I'm playing around with the evCollision command but it seems odd to me that there is 8 "clashType" enum values but no matter how I arrange my tool and target bodies I can't seem to get all 8 outputs. So far I've figured out how to get: INTERFERE, ABUT_NO_CLASS, TOOL_IN_TARGET and TARGET_IN_TOOL. For some reason…
-
QR Code feature
Feature link: https://cad.onshape.com/documents/590aa2e4425ab6d582393356/w/81d6535fe1c9afe3c44a3424/e/98a77b1588b0b49a23f1a7dc This feature extrudes geometry representing a QR code. Notes: * Only "normal" ASCII characters are supported as input. No Kanji mode. No micro QR codes. * At the end of the feature dialog are some…
-
How to properly use imported FeatureScript in my own FeatureScript
I'm just starting to learn FeatureScript and have been able to use it in creating some simple geometry. Now I want to add in functionality of other FeatureScripts and have tried following the information in the imports section of the documentation. The FeatureScript I am trying to use is [Feature] Surface Text, and I would…
-
Trying to figure out how to attach custom attributes to the sheet metal master model
When you attach attributes to a sheet metal part in featureScript, the attributes are lost anytime the sheet metal part is modified downstream in the feature tree. This is because the geometry of the part is completely recreated in the studio. I am struggling to find away to attach attributes without them being wiped. My…
-
Featurescript to mate rotating/moving parts
Years ago I came across a public featurescript which lets me take to moving or rotating parts, and "cut" the second to conform to the first. I can't find it anywhere. Anyone know what it's called?
-
How can I find the intersection points from 2 circles in 2 sketches (w scripting)
Hello I want to find the intersection points of 2 circles I tried : var i = 1; var j = 2; // sketches Id var test_i = id + ("sketch_" ~ i); var test_j = id + ("sketch_" ~ j); // circles Id var circle_i = "circle_" ~ i; var circle_j = "circle_" ~ j; // circle edges var edges_i = sketchEntityQuery(test_i, EntityType.EDGE,…
-
@evDistance, what @ means ?
Hello When I look at the evDistance function définition in evaluate.fs, there is a callback to @evDistance... What does that means? Is the source code available ? export function evDistance(context is Context, arg is map) returns DistanceResult { var result = @evDistance(context, arg); ...
-
Set all material properites in featurescript
Is this possible? I am hoping to set all material properties not just the material density. Things like tensile, yield... I keeping finding examples where the only thing being set is the density. Or...is it possible to assign a material from a material library within featurescript(I'm pretty sure no but...).
-
Convert column in imported CSV to a user selectable list
Title says it all. Just can't figure out how this is done. CUSTOM SHEET METAL FEATURES | sheetMetalStart.fs Copy 1 (onshape.com) Thanks so much if you can provide an example or point to one.
-
SkSolve error
Hello, I don't speak chinese.. Can somebody translate this error message @skSolve: Parent Id FovTflfcvumxF3Q_0.sketch_ used at two non-contiguous points in operation history (Cannot have FovTflfcvumxF3Q_0.1.1 between FovTflfcvumxF3Q_0.sketch_.1 and FovTflfcvumxF3Q_0.sketch_.2)
-
Pierce constraint on featurescript
Hello I want to use the pierce constraint, on a 3D line and a sketch point, with the following code var newLineId = id + i + 1 + "line_"; opFitSpline(context, newLineId, { "points" : [sphereCenter, endPoint] }); var newPointLoopId = "point_" ~ (i + 1); skPoint(sketch_loop, newPointLoopId, {"position" : vector(delta , delta…
-
evPlane parameters
Hello I want to create a plane normal to a line I tried: evPlane(context, { "point" : qCreatedBy(id + "apex", EntityType.VERTEX), "normalTo" : qCreatedBy( newId, EntityType.EDGE) }); but got the error Precondition of evPlane failed (arg.face is Query) How can I select the point and lines I created, to put into evPlane…
-
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…