Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Variable WORLD_ORIGIN not found Variable Z_DIRECTION not found
Fda
Posts: 42 ✭✭
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 hemos creado la instancia base (0)
{
const currAngle = i * angleIncrement;
const currTransform = rotationAround(lineToRotateAround, i * angleIncrement);
// Añadir currTransform a la lista de transformaciones
transforms = append(transforms, currTransform);
// los nombres de instancia no importan, solo deben ser cadenas únicas
instanceNames = append(instanceNames, toString(i));
}


Tagged:
0
Comments
-
Where are those variables declared? If they are standard Onshape constants did you include the module they are declared in?Senior Director, Technical Services, EMEA0
-
@fermin_fermin_1
These are fairly new constants in the system, your feature studio may be on too old of a version to have them. Can you post a screenshot of the very top of your feature? I am interested in the line that says "FeatureScript ####;" and all the imports that come after that.
If you have an import of "onshape/std/geometry.fs" and the FS version is high enough, those constants should exist.Jake Rosenfeld - Modeling Team0 -
Jake_Rosenfeld said:@fermin_fermin_1
These are fairly new constants in the system, your feature studio may be on too old of a version to have them. Can you post a screenshot of the very top of your feature? I am interested in the line that says "FeatureScript ####;" and all the imports that come after that.
If you have an import of "onshape/std/geometry.fs" and the FS version is high enough, those constants should exist.</code>FeatureScript 1096; <pre class="CodeBlock"><code>import(path : "onshape/std/geometry.fs", version : "1096.0");

This fixes the error:<div>FeatureScript 1120;</div><div>import(path : "onshape/std/geometry.fs", version : "1120.0"); </div>
1 -
For anyone with the same problem, `Z_DIRECTION` is just shorthand for `vector(0, 0, 1)` and `WORLD_ORIGIN` is just shorthand for `vector(0, 0, 0) * meter`Jake Rosenfeld - Modeling Team0
-
So that no one else wastes time, as I did.Jake_Rosenfeld said:For anyone with the same problem, `Z_DIRECTION` is just shorthand for `vector(0, 0, 1)` and `WORLD_ORIGIN` is just shorthand for `vector(0, 0, 0) * meter`const lineToRotateAround = line(vector(0, 0, 0) * meter, vector(0, 0, 1)); </code>const lineToRotateAround = line(WORLD_ORIGIN, Z_DIRECTION); <span>//????????? </span><pre class="CodeBlock"><code>
1


