featurescript
Discussion List
-
Detecting used mate connectors?
I am hoping to develop a feature that will scale a model without scaling its used mate connectors. This will allow me to preserve the size of a joint (e.g. a screw hole) while scaling the rest of the model. Is there a way to detect used mate connectors?
-
Point Pattern, set orientation for each?
I'm using @cody_armstrong 's Point Pattern FS quite a bit. Very nice!! Some of my patterns would benefit from being able to set the orientation of each thing patterned and I would like to add that functionality to a copy of "Point Pattern". Something simple and click-able like the "reorient" like when placing Mate…
-
What does this error message mean?
Posted previously today about a FeatureScript I am working on for some learning/practice. I made some progress after getting stuck on a small miss of coding, but now I have this error: The first mate connector stops working, and the second one is fine using the same format.
-
Second opTransform not working following same format as previous one
I am practicing some of my FeatureScript skills and understanding (sadly after having to take a break from FS) by creating a FeatureScript that makes three mate connectors in each of the three axis orientations for a selected mate connector location. I can't seem to figure out why this call line is not working when the…
-
How do I export a value to the part studio in FS?
Sorry about the previous post… tried to press enter to move to the body box and it sent instead… As the title states, I am having issues with exporting a variable back into the part studio from my function… I want to do my calculations in the script and be able to retrieve the result of the calculation… here is my feature……
-
How to Identify Faces Directly Created from Sketch Edges in an Extruded Part (FeatureScript)?
Hi everyone, I’m working with FeatureScript in Onshape and I have a question regarding extrusion operations. I’ve created a part by extruding a sketch, and now I need to identify which faces of the resulting solid are directly created from the edges of the sketch (i.e., the side faces that are the result of extruding the…
-
Connections array for opLoft not being applied
Hello! I have been working on creating a featurescript to loft together two identical spur gear profiles at a vertical and rotational (around Z) offset, creating a hyperboloidal profile. the gear profiles generate without issue, and there are no errors in the featurescript, in the code or generation, that are reported. The…
-
FeatureScript Video Walkthrough Series
Hello everyone, I've been wanting to make some FeatureScript training content as of late, so I decided to record a series of videos where I create a new FeatureScript from scratch while talking through my thought process and code as I go. The full Youtube Playlist is here:…
-
qAdjacent finding phantom edges in deform feature
Hey there, I'm working on a feature that will take a body (solid or sheet), a 'From Wire' and a 'To Wire' and deform the body from the From wire to the To wire. In many senses, this is similar to some other features I've seen published (Flex, I'm looking at you), but I haven't been able to get the behavior I'd like with…
-
How to name sketches created in featurescripts?
The following code does not work as intended. When running this feature script it will produce a sketch named "Sketch 1" in the feature tree. How can I change the name to "Name of my sketch"? var sketch1 = newSketch(context, id + "sketch1", { "sketchPlane" : qCreatedBy(makeId("Top"), EntityType.FACE) });…
-
External table content, creation, and modification
Apologies if this question has already been asked or answered in some form — I took a look around the forum and couldn't find anything that really fit my query. My ultimate goal is to add additional thread specifications to both the Hole and External Thread features. It seems reasonable to do this by creating a new table…
-
How to use function autocomplete?
I am trying to write my own functions with feature script. I want to use autocomplete the way the standard onshape functions do. The problem is I can't get it to work. I've been copying what I see in the standard library with no luck: Here's a dummy function with what I'm trying export function dummyFunction(id is Id)…
-
Preserving Attributes on Sheet Metal Parts in FeatureScript
Hi, I have a sheet metal part where I set custom ids on its surfaces so that i can keep track of them : setAttribute(context, { "entities" : faceOfASheetMetalPart "name" : "CustomId", "attribute" : "aCustomId", }); That works great, but when I apply fillets to the sheet metal, the attribute disappear. How can I keep track…
-
Get multiple vertices from a query
How would I go about getting multiple vertices from a query? I have a parameter that creates a query of 3 points. I am attempting to make a plane using the 3 points. Here is what I have so far: annotation {"Name" : "Points", "Filter" : (EntityType.VERTEX), "MaxNumberOfPicks" : 3} definition.points is Query; var points =…
-
trouble using opSplitPart() with multiple faces in a single body
I am practicing my surfacing and once I got to a useful base object I wanted to add some more solid-like features to it. I'm working on a custom feature to make this easier. I hoped to make the workflow be kind of like a wrap, but without warping and applicable to 'any' surface, not just cylinders and cones as I believe…
-
Featurescript Boolean of Booleans not working
Hi! I am having trouble with booleans in featurescript when using the result of a boolean as a tool for another boolean. I have attached a simple example to explain my problem better. In this case, I generate 3 intersecting cylinders: I want to do a Boolean to combine the first two and then another Boolean to intersect the…
-
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…