Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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

FdaFda Member Posts: 19 ✭✭
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));
                }









Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,402
    Where are those variables declared? If they are standard Onshape constants did you include the module they are declared in?
    Neil Cooke, Director of Technical Marketing, Onshape Inc.
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,381
    @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 Team
  • FdaFda Member Posts: 19 ✭✭
    @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.


    FeatureScript 1096;
    import(path : "onshape/std/geometry.fs", version : "1096.0");



    This fixes the error:

    FeatureScript 1120;import(path : "onshape/std/geometry.fs", version : "1120.0"); 

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,381
    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 Team
  • FdaFda Member Posts: 19 ✭✭
    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`
    So that no one else wastes time, as I did.
    const lineToRotateAround = line(WORLD_ORIGIN, Z_DIRECTION);  //????????? 
    
    const lineToRotateAround = line(vector(0, 0, 0) * meter, vector(0, 0, 1)); 

Sign In or Register to comment.