1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WizoScript reverses sign of Z-coords drawing 2D splines (test script)

Discussion in '3rd Party Add-ons' started by R-man, Jul 8, 2018.

  1. R-man

    R-man Senior Member

    I have been making great progress with Wizo Script and can see that it will be my main method of working in Alibre. BUT . . . . when I put 2d-splines into sketches on the ZX-Plane (or parallel planes), the sign of the Z-coordinates had their sign reversed.

    I've attached a zipped script to demonstrate this. It first draws 3D points and splines (which are drawn as expected) and then 2D splines. The 2D points that control the 2D splines are entered with negative z-coordinates, but are drawn as though positive values had been provided!

    Aside from this happening in Wizo Script it appears to also occur with the 'insert from file' function. I understand that the "insert from file" capability was originally an add-on contributed by an Alibre User. In both of these cases it should be possible to easily rectify the sign reversal.

    For WizoScript, so as not to mess up all the existing scripts that might anticipate this sign reversal, I would suggest the ability to include a flag at the top of a script to indicate that z-coordinates should be drawn as input. For "insert from file" a checkbox could be added to indicate a wish to preserve z-coordinates.

    As far as what happens, or should happen, on planes that are not parallel to the 3 major planes, I have no idea. It might be too mind bending to consider, but for the standard planes and their parallels, up and down should not be confused. (says me!)

    Attached Files:

  2. Lew_Merrick

    Lew_Merrick Alibre Super User

    R-man -- Are you familiar with the Right Hand Rule of coordinates? This is why "clockwise" is a mathematical failure.
  3. R-man

    R-man Senior Member

    Well, yes I've heard of it. It is a handy way to remember, for example, given x positive and y-positive, which is way is z-positive.

    Can the right hand-rule explain why one way of indicating points gives a result that is different from another way of indicating the same points?
    It sounds as though the situation I am concerned about is the way things 'should' be. I'm not yet convinced.
  4. Lew_Merrick

    Lew_Merrick Alibre Super User

    Remember that all the coordinates you are programming are Global positions.
  5. R-man

    R-man Senior Member

    That doesn't help me too much because I see the 3d xyz coordinates as the immutable 'global' reference frame. Regardless of what plane I'm attaching my 2D spline to, I'm inserting it into that 3d framework. And in doing so I expect to be able to dictate the underlying points within that 3D framework. What's more 'global' than wanting Z to be Z regardless of the method I'm using to create the spline.
    But your earlier comment about the right hand rule has helped. It seems that what it boils down to is that each plane has it's own coordinate system. And if I think of working on a plane not parallel to the xyz planes, it makes it clear why that is the way it has to be. I'll adjust to it in time!

    On a different topic I must say that your (Lew's) suggestion that I look into WizoScript has shown me new horizons. I have a (rusty) programming background and it is natural for me to create via code rather than via point, drag and click. Thank-you!
  6. Lew_Merrick

    Lew_Merrick Alibre Super User

    As an "old school" FORTH programmer, I find Python a relatively major effort -- but I am almost getting comfortable with it...
  7. ajayre

    ajayre Alibre Super User

    Let's take your example for the YZ-Plane:

    Points2Dyz = []  # format is [ z-coord, y-coord ]
    Points2Dyz.extend([-13, 5])
    Points2Dyz.extend([ -6,10])
    Points2Dyz.extend([ -6,15])
    I think the confusion here is that you are treating the numbers as [Z, Y]. It's a 2D plane so they are [X, Y] there is no Z.

    If you open a new 2D sketch on the YZ-plane and move the pointer in the top-left quadrant while looking at the status bar you will see that the X value for the cursor location is negative.

    It seems to me this isn't a problem with WizoScript or Alibre Design, but more a question of how 2D geometry maps to 3D space.

    WizoScript has the following function:

    [Px, Py] = MySketch.GlobaltoPoint(x, y, z)
    that may help do what you want.

  8. R-man

    R-man Senior Member

    Thanks Andy. That's good to know but in the meantime I've adjusted to the situation and just make sure things are going where I intend.

    BTW My appreciation of WizoScript is growing every day! It's a significantly more convenient and powerful way of using Alibre.
    ajayre likes this.

Share This Page