-
reusing a sketch in featurescript
I'm working on what will be a template to 3d print and then used for routing some plywood. One of the basic issues with machining is of course the tool diameter and thus the fillets created in corners. I thought it would be interesting to make a reusable feature to reapply some corner relief to address this. I have already…
-
relict
-
Script error i can't resolve please help. It's driving me nuts
here is my code. import(path:"onshape/std/standard.fs",version:"2581.0"); // Offset Skin FeatureScript for Xbox Controller (with Multiple Grip Patterns) // Creates an offset skin for an Xbox controller, allowing interactive // definition of the front face cut-out region and multiple grip patterns. export const xboxSkin =…
-
How to Set Sketch Origin to Plane Origin in Onshape?
I have some CAD feature models that include planar sketches defined by 3D points and coordinate systems, as well as extrusions. Now, I need to recreate the same models in Onshape based on this data. The main issue arises during the sketching process. Since Onshape's GUI does not allow defining a sketch plane's origin using…
-
Customizing the names of parts generated by patterns
I've yet to dip my toes into FeatureScript but this might be the problem that makes me jump in if it's solvable. Does the API give you access to control the names of parts generated by a custom feature?
-
Preserving part name and properties after opBoolean BooleanOperationType.INTERSECTION
From what I can tell, opBoolean BooleanOperationType.INTERSECTION will take target bodies A and B and use them to create a new body, C. C does not have any of the properties either A or B had, which is not what I'd like. I'm hoping for behavior like UNION where one body keeps its name and properties, i.e. A UNION B results…
-
Query sheet metal bend / flange center line
Hello there ! I'd like to measure the distance between a hole axis and my sheet metal bend center line (the dotted line inside the sheet metal flat view), but i'm having a hard time querying it I did managed to do a "manual" query of the center line ike so : annotation { "Name" : "Center line", "Filter" : EntityType.BODY…
-
How to getAllVariables() in defineFeature.precondition?
In a defineFeature, I would like to list all variables in the precondition. Here is my code: FeatureScript 2559; import(path : "onshape/std/common.fs", version : "2559.0"); annotation { "Feature Type Name" : "Set Variable", "Feature Type Description" : "" } export const myFeature = defineFeature(function(context is…
-
feature identity/selection stability with parametrized models
https://cad.onshape.com/documents/31d9f3436d1f6286f056967a/v/85b86a9ace50715ca6716cea/e/28794b8e69f77c9e0f3125ad In insert_unit I have a single square unit I use elsewhere. In bin I use my featurescript to instantiate a grid of these based on x and y count parametrization. In the script the grid of instances are booleaned…
-
Laser Joint Updated to V3.0: Pin Face Offset and Pin Chamfer!
Direct link to the new version here. Pin end faces can be offset either in or out; convex pin edges can be chamfered to aid insertion. End face offset as requested by @Hugh_Goodbody, @michael3424, and @brucebartlett. Notes: Performance on joints with no options is the same; pin face identification is currently the most…
-
Changing feature parameters when onshape won't load because regen time
I'm running into a problem on a custom feature I'm developing. Part of the feature is calculation intense, and uses a pattern operation to generate many copies of a body. The number is settable through a parameter, which means it is possible to enter a value that makes the regen time be unreasonably long. I imagine this…
-
Extrude separate adjacent shapes
Does anyone know of a way to extrude two or more adjacent sketch outlines as separate objects? I often need to do this and wind up making several separate extrude features, but it would be much quicker and simpler if there was a featurescript or something that would do it in one operation.
-
mates showing in part studio not present when in assembly
https://cad.onshape.com/documents/31d9f3436d1f6286f056967a/v/c7ea79f0a01fbb55a00bce3f/e/fd67035c9e5e62f496ede719 I am exploring and learning about both derive and featurescript here. In each of the part studios base_unit and insert_unit I create a mate connector. I use my featurescript with an instantiator to create a…
-
having trouble with setting configurations for `addInstance()`
var instance = addInstance( instantiator, baseUnitStudio::build, { "configuration" : { "is_left" : false }, "transform" : transform(vector(x * definition.xd, y * definition.yd, 0 * inch)) } ); https://cad.onshape.com/documents/31d9f3436d1f6286f056967a/v/cbf25e31bb40ade74e9aa036/e/9cbee39ae72c63645cafbc53 I am attempting to…
-
Transforming a sketch into straight vertical and horizontal lines for 3D printing
Hi! This is my first post here. The problem I want to solve is that if you 3d print something small, it matters where the slicer places the outer layers. When drawing a sketch, you don't know where the edges of the layers will appear. That's why I'm trying to make a new feature that allows you to copy and transform a…
-
Changing lookup table reference from an ENUM
Hi All, I am creating a "simple" feature script which swaps the lookup table for a different size table (Metric / Imperial set sizes). I'm getting two issues which I hope are simple fixes but I can't seem to figure them out. Any help would be appreciated. I am getting a duplication error on the definition.sSize…
-
Nesting Sheet Metal parts in Drawing
Is there a tool or featurescript that allows to nest a bunch of flat sheet metal parts to one Drawing or Sketch? To export to DXF. I need to laser-cut many parts in one go. Preferrably nicely packed together. Now I manually place them in a drawing, but that is too painful, as the parts are also subject to change based on…
-
Optimization Solver - New Feature on fs.place
I've gotten a number of request over the years for features that have a measurement based constraint such as perimeter or area. The topic has also come up on the forums a few times (https://forum.onshape.com/discussion/18610/how-can-i-use-perimeter-as-a-constraint). My answer to the question has always been - to optimize a…
-
A question about B-Spline to Interpolated-Spline
I’d like to ask if there is a way to convert a B-Spline (defined by control points, knots, etc.) into an Interpolated-Spline (defined solely by a series of points, similar to the spline in Onshape UI). The evCurveDefinition function returns the parameters of the B-spline (control points, knots, etc.), but the parameters I…
-
qCreatedBy(sketch_id, EntityType.EDGE) returns more edges than I drew
I drew a sketch with 11 edges, but qCreatedBy(sketch_id, EntityType.EDGE) returned 24 edges, and I parsed these edges and found that some of them were overlapping (all parameters were the same, except for deterministicId). Why is this happening? What are these "copied edges" used for?
-
Hey FeatureScripters - What would you like to see in an advanced FeatureScript tutorial?
Hey everyone, I'm Josh, one of the Part Studio developers. Recently I decided the community could use a more advanced tutorial to cover some of the trickier topics in FeatureScript: Queries, ids, transient ids, robust queries, tracking queries, etc. We could also cover common problems, gotchas, tips n' tricks, that sort of…
-
How to use Move boundary in FeatureScript - opMoveBoundary()
I was having trouble finding how to use the Move boundary within FeatureScript. There is no OpMoveBoundary or OpExtend like you would expect. Here is how you can do it: Import the extend FS from Onshapes STD at the start of your project. // For move boundary
import(path :…
-
Mounting Boss FeatureScript
Hello all, I've finally finished up this FeatureScript and thought some others may find it useful. It's for making different types of mounting bosses in plastic parts. These are used for adding screws to plastic enclosures, mounting circuit boards, etc... The script was based off of the Hardware Boss script by @NeilCooke.…
-
opPlane
Hi, I have used OpPlane operation in a feature script but i can't manage to display the name of the plane on screen as opposed to the feature Plane. Can someone help me on this topic please ?