featurescript
Discussion List
-
Featurescript fails when using EvBoundingBox?
Hello all, I'm currently trying to write a script which evaluates the bounding boxes of a given set of parts, and then prints the vertices to the featurescript terminal. However, when I attempt to do this, it breaks and throws a Precondition of evBox3d failed (arg.topology is Query) error. I have added my code below. I'm…
-
Sheet metal and feature script
Hello, I try to use the featurescript "laser joint" with sheet metal module whithout finish this module. Can we do that? Is this included in an upcoming update?
-
Problems with Extruding in FeatureScript
var sketch1 = newSketchOnPlane(context, id + "sketch1", { "sketchPlane" : plane(vector(0, 0, 0) * inch, vector(0, 0, 1)) }); skRectangle(sketch1, "rectangle1", { "firstCorner" : vector(0, 0) * inch, "secondCorner" : vector(1, 2) * inch }); skRectangle(sketch1, "rectangle2", { "firstCorner" : vector(0.1, 0.1) * inch,…
-
Why OnShape defines a new program language - FeatureScript?
Hi, Why OnShape defines a new program language? Why not use the formal script language like JS? Seems FeaureScript is not easy to learn for both programmer and engineer. And FeatureScript can not be used out of Onshape. If using JS, at least, some people can easy to start. I would like to know the reason. Thanks!
-
A question on preconditions.
Can I somehow separate the preconditions out of the main function? there are two reasons I wish to do this: * it's getting too long and messy. * I want to take a precondition of queries and split it and return it in two separate definition maps i.e. definition.plane and definition.lines, I could split it into two queries…
-
Trying to add units and bounds for velocity... am I missing something?
So I have this code: export type VelocityBoundSpec typecheck canBeVelocityBoundSpec; export predicate canBeVelocityBoundSpec(value) { canBeBoundSpec(value); @size(value) == 1; for (var entry in value) isVelocity(entry.key); } /** * True for any value with velocity units. */ export predicate isVelocity(value) { value is…
-
Point of Intersection.
Is there a good way to evaluate the point at which two lines or edges intersect? Cheers, Darren
-
Re-apply attributes to patterned entities
Let's say I'm (linear) patterning a couple of bodies. Some of these have been given a specific attribute using FeatureScript ({"A" : true}), some others another attribute ({"B" : true}). The new bodies apparently don't get the attributes, which I'll need for later boolean operations! The instance count is based on a…
-
Sorry for the beginner's question, but I need to mix length units and I do not know how...
i.e. I would like to say const VNSpindleBearingOD is string = "SpindleBearingOD"; const SpindleBearingOD is number = 3.15; // this value is in inch const VNSpindleBearingOD is string = "SpindleBearingID"; const SpindleBearingID is number = 80; // This value is in mm verifyVariableName (VNSpindleBearingOD);…
-
How can I create string variables?
I have a featurescript feature that takes a string as a precondition. Is it possible to define a variable that is a string that I can pass into this feature? I've tried setting the value of a variable to be something quoted in double quotes and single quotes, neither of these is accepted.
-
New FeatureScript - Mortice and Tenon
Hello, after many attempts, I now have a working mortice and Tenon Script. The user selects the edge where the face side and face edge meet (the arris) And it creates both the tenon and mortice. The default width if the tenon is a third of the part and automatically haunches the tenon if the rail is flush with the top of…
-
What happens when I run out of vertical estate on a feature script UI, do I get a scroll bar?
My UI expands as I add different options such as ribs stringers and spars, with these options comes many more options for each one, what if my UI extends down further than I have screen? I tried just shrinking my browser but I just lost half my UI with no way of accessing the bottom half.
-
Featurescript - query/delete all sketches
I want to clean up my Part Studio, so that when I derive it in another (using opMergeContexts in FeatureScript) I don't get all the sketches and points and all, but I do want to import all parts and surfaces at once. Either I can query these one by one, calling opDeleteBodies on all the queries, but I'd really like a…
-
Using qCapEntity with a manually generated body
Hi. I am very new to both Onshape and FeatureScript, and I'm hoping I may be missing something obvious here. Is there a way to use qCapEntity to locate the cap of a body which was generated via an Extrude or Thicken in the PartStudio? All the examples I can find use a body generated within the FeatureScript (and thus with…
-
Code review of feature script to create a wood joint
I am working on learning FS. I would appreciate any criticisms of the following code. Feel free to say this would be faster, would have made the coding process easier... Anything will be appreciated. Here is the code. The code creates a joints between parts. The user needs to select faces to have tabs, parts to be slotted,…
-
Using Z axis of mate connector error once transformed
Hello, I am working on a feature that imports a part with a mate connector. I am then rotating that part using the mate connectors Z axis. I also have a boolean which if true, it will rotate about the mate connectors X axis first. The error occurs when I then want to rotate about the mate connectors Z axis. I would think…
-
Feature Request - UIHint HIDE_ON_CREATION
Hi, I have an idea that could be useful. It is another UI Hint that once a script is executed, it hides the feature on the feature tree. Similar to clicking the eye symbol in a part studio. This would be useful to hide mate connectors, sketches etc. This UI Hint could be placed in the initial feature name section.
-
Suppress through FS?
Is there any possibility to edit features in the part studio feature tree by means of FS? Specifically I'm interested in suppressing certain features, such as extrudes or holes, or other FS features, based on boolean parameters. I see in the part studio code that a suppressed feature simply is enclosed in an if (false) { }…
-
Change variable values after mergeContext / importDerived?
Now, I might be dreaming, but I'd really love this to be possible. Is there a way to Change variable values after using mergeContext or importDerived to import geometry from another PS? This would allow several morphologically different instances of the same geometry. I figured since variables are added to the context,…
-
Having troubles with: skCircle(Sketch, Id (array), map) does not match skCircle(..., string, ...)
the id: id+'circle1'+keys debugs to: Id : [ "FIZxwPCJn00T9Nq_1" , "circle1" , "0" ] I presume the issue is that it is an array of strings however this is valid for a sketch so I am puzzled. The link is: https://cad.onshape.com/documents/95877be3b17f49277e87a2c3/w/b503830fd20472014beb1221/e/4c4431103f44e823aca947dd the…
-
Use FeatureScript to automatically hide itself
Hello all, how could I set my script up such that when executed, it is hidden in the feature tree? Is it simply using the UIHint ALWAYS_HIDDEN in the feature name annotation at the top? Thanks Lee Hesketh
-
FeatureScript Profiler discussion
Hey FeatureScript authors, We're happy this week to have released the FeatureScript profiler, Onshape's tool for viewing timing data for individual execution steps inside your custom features (you can check out a quick video here or the documentation here). We're already eating our own dogfood and using this tool to help…
-
Is there a way of excluding a piece of code to a single action command?
This makes sense in my head, to elaborate... If I have a piece of code that is intensive in terms of many iterations etc, I don't want it to run every time I change a variable. Is there a way of holding off until the setup is finalised and then have some kind of way (maybe a button) to activate the intensive part? I…
-
FeatureScript: Query imported geometry
I am trying to figure out how to refer to any geometry of a feature that has been imported into a PS through FeatureScript. (Import is done using either opMergeContext() or importDerived(), not sure which one is preferable). It is important to me that there is no user selection (feature querying) involved, as I will be…
-
Mate connector
Hi! I added a mate connector to my bevels gear: https://cad.onshape.com/documents/9b04fb889def400dfd4a693f/v/49c81b9a7cb792589aff29d1/e/fc99f57d0b9bb11ec95b86b7 Is there a way to have them appear as independant Mate connectors, so I can show/hide them, and also to be able to select them from the parts list, in an assembly?…
-
Error when calling opSplitPart, CANNOT_RESOLVE_ENTITIES
Hello all, yet again I have another error, but in a different script this time. I am creating a script that splits a part into laminations, for use when creating counter tops out of many boards for example. I am using a for loop with the variable i to do this. The user selects the face which they want the board length to…
-
Fasteners creator
Hi everyone, I have started a document to easily create standard fasteners. Currently I have 3 featureScript that allow quick creation of washer screw and bolt. Each feature rely on table, currently the table are not fully completed but this is an ongoing work. I am new at featureScript and any suggestion on this document…
-
Use an editing logic function with booleans?
Can an editing logic function be used to tick a boolean check box in the UI? If so, how? Thanks Lee Hesketh