feature script
Discussion List
-
Center of Gravity Calculated with Featurescript
Hi Guys, I am trying to calculate the Center of Gravity (COG) of a 2D man (Picture). I worked with Solidworks Api and could figure everything out with the Macro Recorder. Sadly this feautre doesnt exist in Onshape and there are not a lot of Tutorials for Onshape. What i want to do in Feature Script is to calculate for all…
-
Is it possible to access a user-selected configuration parameter in a featureScript?
Hi everyone, I'm writing a featureScript that deletes selected entities, if a selected configuration parameter has a specific value. How is it possible to access a user-selected configuration parameter in a featureScript? Thanks for your help, Timo
-
Is it possible to enable selection while importing part using featurescript code?
I am importing a solid part. And I want to apply some transformations on importing solid part so that I can align it to Y-Axis. If I can select the desired cylinder face of importing solid part, then I can easily align it to Y-Axis.
-
How to query "self-referencing" entities that are generated in the feature
Hi there, This is a bit of a weird one. I want to be able to have the user give an initial set of inputs, have a script that uses those to generate some sketches and bodies, and then (still in the UI screen) for the user to be able to fill out a Feature Parameter Query with one of the entities created from the feature. In…
-
What's wrong with this opTransform input?
I can't figure out the specific problem that @opTransform: INVALID_INPUT refers to. I have checked the input, and don't see anything wrong with it. Is there a problem with the query I am passing? It's just a bunch of faces from an annotation. I tried a few others, and I keep getting this error. I tried a few different…
-
[New] Extend/Trim Edges FS
With this custom feature you can select two edges and automatically extend or trim the surfaces so the edges intersect! https://cad.onshape.com/documents/cbe410e5c44c9abf4e218496/v/4a1925e806a6d04ca473a864/e/b56a4d83f2e98a1be655ccef Like my previous Fill Gaps feature, keep in mind that this may not always work on broken…
-
FeatureScript for modifying sheet metal bends
One of the things I do very frequently is sheet metal bend perforations - to do this in Onshape now I sketch directly on the sheet metal flat and remove material from the flat. However, this is a very tedious process as I need to manually add each cutout for each bend. What I'd like to know (as someone with no…
-
Updating Official Feature Scripts and Using the Updated Version
I'm working on a design for compound planetary gear boxes with the intention of 3D printing them: https://cad.onshape.com/documents/9ca554446455ea6f1adca427/v/115c4f54e64515268982634d/e/10697cc92f7ab71e3933066c I have developed a design using the offical Spur Gear feature script, but that script lacks backlash control,…
-
Feature script CANNOT_RESOLVE_ENTITIES error
Hello, I am very new to feature script I am writing a feature script that will automatically add holes to a part at a fixed spacing. The goal is to pass a line along which the holes should be cut, and the spacing desired and have the script decide how many holes will fit, and how to center them along the line. I have the…
-
Problem: opPlane() with a rotated coordSystem creates a "non-rotated" plane
I'm trying to write a feature script that takes a curve and a point as parameters (among others), and creates a plane with the x-axis pointing in the direction of that curve's tangent at the given point. (The motivation is, I want to then manually draw a sketch on that plane that extends the curve in some way.) Everything…
-
How to assign material from a spreadsheet data base
is this a feature script capability? if not, then is there another way of automating material assignment from a data base like excel spread sheet? say my spread sheet has two columns: part numbers & material and my assembly in onshape has also the same exact part numbers.
-
How to move a part using BodyType.MATE_CONNECTOR
How can I move the cube to the end of the cylinder? annotation { "Feature Type Name" : "Transform" } export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "My Query", "Filter" :…
-
[New] Fill gaps FeatureScript
Easily identify open gaps in surface bodies with this new custom feature with option to automatically fill the gaps and create a solid part. https://cad.onshape.com/documents/ce40596b860ab50d657e1a25/v/93eddbbe03dde1a35dcb3d19/e/c40a2b405f618e4760ef6ebb Thanks to @kevin_o_toole_1 and a few others for the guidance!
-
Variable WORLD_ORIGIN not found Variable Z_DIRECTION not found
Why is the code broken?I do not get it const lineToRotateAround = line(WORLD_ORIGIN, Z_DIRECTION); //????????? const angleIncrement = (360 * degree) / MyCount; var transforms = []; var instanceNames = []; //definition.count -> MyCount for (var i = 1; i < MyCount; i += 1) // Iterar de 1 -> (definition.count - 1) porque ya…
-
For (var i = .. Sketch and Plane and Circular pattern
How could you create a with a "for (var i = ...." a Sketch in each plane. And how Extrude each Sketch. jhljlñkjñl var sketch2 = newSketch(context, id + "sketch2", { "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE) }); for (var i = 0; i < 5; i += 1) { var miPlane is string = "plane" ~ i; var Circle is string =…
-
How can I use profiles that are not user defined in the loft feature?
I created two profiles in my feature script and now I want these to be used in the loft feature, is there a way of using them? like profile is from sketch 1 at point (x,y)? or maybe someone could just direct me to a script that demos this if its easier? Kind regards, Darren Lynch
-
Hole Feature Naming
Is it possible to create a hole feature that names the feature the same as the tap information or clearance information? For example if a hole feature creates a tapped hole for a M3x0.5 screw, the feature would be called M3x0.5, and if the hole feature creates a clearance hole for the M3x0.5 screw, the feature would be…
-
Creating Plane through 3 Points in featureScript
Does anyone have any tips for creating a new plane through 3 points. Have not had any luck with all test attempts of cPlane, opPlane, etc. var b = vector(32, 56, 0) * millimeter;var a = vector(88, 0, 0) * millimeter;var c = vector(88,56,50) * millimeter;var _origin = (a+b+c)/3;var _normal = cross((c-a), (b-a));var newplane…
-
Ellipsoid custom feature
In support sometimes we get a chance to create tools that bridge the gap between current functionality and potential future functionality through the use of FeatureScript and custom features. In this case, a feature to create ellipsoids! With independant x/y/z dimensions. Check it…
-
Examples of functional code of simple small operations.( Feature_Script)
Hello, I'm new with this Feature_Script, and I can not hole a geometry. Before putting this post I tried to find an example. The documentation of Feature_Script is confusing to me. As a user I am missing examples of functional code of simple small operations. It would be wonderful if these examples were discussed in…
-
help with guidance in a feature script for will solids with patters like lattices
Hello Looking for some help from the feature scripts masters. After a conversation with someone from the support team, he told me that a feature like this would be possible to do it and as I have no idea/experience with feature scripts coding I would love some help/guidance/recommendations to where to look for writing my…
-
Replicating Offset behavior in FeatureScript
I'm am developing a feature allowing me to automate the creation of a spline representing the profile of a slice of a boat hull. Is there a way to programmatically offset the spline as we can do it in a Sketch ? This should allow to give some thickness to the profile. At the time, I haven't been able to find a suitable…