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: 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));
                }









Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    Where are those variables declared? If they are standard Onshape constants did you include the module they are declared in?
    Senior Director, Technical Services, EMEAI
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    @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: 42 ✭✭
    @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");&nbsp;</div>

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    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: 42 ✭✭
    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(vector(0, 0, 0) * meter, vector(0, 0, 1)); </code>const lineToRotateAround = line(WORLD_ORIGIN, Z_DIRECTION);  <span>//????????? 
    
    </span><pre class="CodeBlock"><code>

Sign In or Register to comment.