-
How can I use FeatureScript to get the longest edge of a part as a computed property
I try to create a feature script that lets me get the longest edge of a part as a computed property in a user defined table.So far I had no success other than get the compuedVolume as shown in an example somewhere. Can yomebody give me a hint or an example how to get all edges, find the logest and rturn that as a computed…
-
Sensor Custom Feature
Often in the design process there may be specific geometric constraints on the parts that need to be considered along the way. I created this Sensor custom feature to measure certain geometry and compare it to a specified value and warn if it is out of spec. Currently only edge length and fillet radius are supported but I…
-
Advanced Non-Uniform Scale Feature
Here and there I've seen threads or posts about the need for a non-uniform scale feature. I've written a little feature in FeatureScript capable of scaling in any chosen direction or set of directions. Choice between: * Uniform scaling; in the standard coordinate system * Non-uniform scaling; in the standard coordinate…
-
Featurescript to add heat-set threaded inserts
I use a lot of M3 heat-set threaded inserts in my 3Dprints but it takes several hole operations to generate the type of geometry I need. I haven't really created a featurescript before, but I think this would be a good use-case to simplify my workflow. What I'd like is to be able to specify a somewhat complicated hole type…
-
how to get the coordinates from all parts? loop through all parts en print the coordinates
Hi, I am not a programmer, but I think I want something fairly simple: I want a list of coordinates of all parts in the part studio. Basically loop through all parts and print the coordinates in the monitor (or save to csv, but that is luxury... : )…
-
Introducing Camel: CAM for OnShape, implemented in FeatureScript
Camel is a CAM application for OnShape, implemented in FeatureScript. Use the Camel FeatureScript library to generate tool
paths from a PartStudio to drive a 3-axis machine such as a CNC router.
Use Camel’s companion app to download toolpaths or simply copy/paste them from the FeatureScript notices panel. Refer to the…
-
Anyone ever written a feature script that references a .csv spreadsheet of part numbers/descriptions
Hello! We have some standard-ish panels that are assigned part numbers based off of sizing and a few other options. Right now I'm manually entering in the part numbers for the panels based off of the sizing of the panels (which can be time consuming, annoying and prone to occasional errors) I'd like to write a feature…
-
How do I get the parallel distance between two mate connectors?
working on my first script. evdistance is giving me the total distance between two mate connectors, but I want the parallel distance between them (or normal to the first one) https://cad.onshape.com/documents/68cc6e7f44c7d45ead2a1b38/w/5c67626b11109a69231f9606/e/f5a54e138097299817bb6f7b
-
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…