-
How do I create a Part from a set of vertices/faces in FeatureScript?
I want to be able to create a solid part from a set of mathematically computed vertices. I know how to associate the vertices into faces that form a closed volume, but I'm unsure of how best to use feature script to generate the solid. Fumbling about trying things, I have found that I can generate the points as a set of…
-
Simple Polyline Sketch Example on Selected Plane
I can't find a Featurescript example where the user picks the plane or face in the precondition area. All the examples I find use the "TOP" but I want to select one of the datums or an existing face to create my canned polyline logo. Help!
-
Is there a way to set a Property with the name of the FeatureScript a part was created by?
I have a featurescript that produces different parts, and I usually apply it multiple times in one part studio. When exporting the BOM it would be great to have a Propertiy that tells me with which FS a part was created (e.g. "script name" 1, "script name" 2, "script name" 3 etc.) Is there a way to add this as a property…
-
Is there any way to find eye vector?
Hi @NeilCooke Is there any way to find an eye vector (a vector perpendicular to the screen) using featurescript?
-
Why are my variables not working when set for feature driven pattern
I have the following profile designed using a variable width In my custom feature I have tried the following annotation { "Name" : "Profile", "Filter" : SketchObject.YES, "MaxNumberOfPicks" : 1 } def.profile is FeatureList; ... setVariable(context, "width", 115 * millimeter); applyPattern(context, id + "sk0", {…
-
Is it possible to write a featureScript that deletes parts depending on their name?
I didn't find any query that depends on the name of a part, so I was wondering if it is possible to delete parts depending on their name with a FeatureScript? Thank you, Timo
-
Is it possible to export numbers from a FeatureScript?
Hi everyone, I'm trying to calculate a couple of values (e.g. distances) with a FeatureScript and then export them (to a type of file such as .csv, googleSheets, .txt) Is this possible? Any help is appreciated! Cheers, Timo
-
Projected Extrude FeatureScript (V1.1.2)
Over winter break I had some time to write this new featurescript which returns a part from the intersection of two nonparallel sketches. It is mostly a copy of the Projected curve feature which is already part of our feature set. Thanks to @lana and @Jake_Rosenfeld for the extra help!
-
opBoolean.SUBTRACTION not working?
Hello! I am trying to create a quick feature script to engrave a text onto an existing object. This is the code I am using: annotation { "Feature Type Name" : "Tag" }export const Tag = defineFeature(function(context is Context, id is Id, definition is map) precondition { annotation { "Name" : "Location and Orientation",…
-
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
-
Prevent featureScript from pre-calculating
Hi everyone, I wrote a longer featureScript which needs about 10-20 selected vertices as input. When I start selecting them, it atomatically starts calculating which makes the process of selecting the vertices more difficult/slower. Is there a way to stop the script from caclulating anything until I click the checkmark to…
-
CSV FILE READING ISSUE
I have the following issues while reading from the CSV file: 1. Sometimes I am getting unwanted characters like "���". 2. I have a character like 'µ' in the CSV file. But after reading I am getting "��". anyone can help. Thanks.
-
How to find the id of several bodies in "Query" with several mouse Picks
I am trying to pass the body id to rename solids with a string + i (1,2,3 ...... etc) annotation { "Feature Type Name" : "Name my_Part" }
export const myFeature = defineFeature(function(context is Context, id is Id, definition is map) precondition { // Define the parameters of the feature type annotation { "Name" : "Nome",…
-
Can't Sketch on Plane Created with opPlane
Hello, I am trying to create a new plane using opPlane, then create new sketch features on it. The plane shows up, but not the sketch. The body of the FS code is below. Thanks! var plane1 = opPlane(context, id + "plane1", { "plane" : plane(vector(0, 0, 2) * inch, vector(0, 0, 1), vector(1, 0, 0)), "width" : 6 * inch,…
-
Is it possible to determine in which direction an angle is measured?
Hi everyone, I want to measure multiple angles between vectors always to the same direction. i.e. I would also receive angles larger than 180 degree for some cases. The only function I know is the angleBetween(), but it just always takes the smaller angle(<180 deg). Is there a way to always measure in the same direction…
-
New FeatureScript: Hose Routing
Hello Everyone, Good News! I'm releasing my Hose Routing FeatureScript: https://cad.onshape.com/documents/54d06a3b8abd1fcb0daba26b/w/00a336bf184d3800f0194a5c/e/e689b647e557695970d3d603 The FeatureScript uses Arcs and Circles as input (either from solids or sketches). You don't need sketches at all, which makes it more…
-
Need coordinate system (xAxis, zAxis) help for a transform
I'm trying to learn some Featurescript but am having trouble getting the xAxis and zAxis vectors for a transform. My Featurescript UI has the user select a start point (vertex), and a direction. From that I'm trying to move the orange strip (that was created by FS and is located at the origin) to the user selected point,…
-
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…
-
Automation for assemblies
Hi all, One of my company's products is a modular roof-edge solar installation. For each project, we line the roof (flat roof, think top of an apartment building) with our solar units using a small handful of configured parts. First, the base unit assembly is defined by things like solar panel size and angle of…
-
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…
-
Hiding Sketch
Is it possible to hide sketch in featurescript?
-
Alternative to chamfering internal edges
I am messing around in feature script and have tried to chamfer the edges of extruded text, highlighted here. It fails on any piece of text that has a vertex with edges at less than 90 degrees. Is there another method I could use to achieve this?
-
Split using plane size?
I am trying to make a script that creates mitred corners. I thought of creating a plane and then calling opSplit. But then I realised that the plane is infinite and will not just split the desired corner, but the whole part. Is there a way of setting an "effect radius"? Such that it will only split a part in a certain…
-
Help rotating text in FeatureScript
Perhaps I'm on the wrong path, or not... Ive created a featurescript to make an array of holes. I want to add labels (text) to the holes but I cant seem to figure the best way to rotate the text so it is aligned to the holes. The following FS is my work in progress:…
-
How to offset faces for parts in a for-loop
I have a list of faces which I'm running through a for-loop to extrude each one as a unique part, attribute part metadata, and offset (inwards) each one. When I add the opFaceOffset feature I get an error message which I can't seem to wrap my head around. : Below is the error message: I have tried shifting the order…
-
[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…
-
Adding Maps
Is there a way to "add" maps? Or to easily use one map as a the "basis" for another - i.e. I have one map that defines a bunch of generic attributes - and I want to use that - or pass it with some other definitions? I know I can make a [deep] copy of the original, then add new stuff to the copy - then pass this - but it…
-
Determine if a line lines flat against a face
I have 2 (actually 3) bodies. The two grey ones, and the purple one. I have two grey faces (one on each body) that are both circular. My purple body was created by extruding these two faces and taking the intersection. Thus, the purple-dotted-line "lies flat against" one (actually both) of these faces. So when I look at…