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

Sketch Alignment Oddity

Discussion in 'Alibre Script' started by albie0803, Sep 12, 2020.

  1. albie0803

    albie0803 Alibre Super User

    So I had written myself a script to insert keyways parallel to the ZX Plane which normally suits me just fine but yesterday I had to draw a shaft with radially offset keyways. I thought about it and decided that, yes, I could adapt the script, so I added an if to add a plane at a set angle and then build my keyplane off that rather than off the XZ Plane. My first try was with a 30° and I got what I expected. My next try was with -30° and things went haywire. When I opened the sketch I found that the model was orientated in the negative direction, opposite to the 0 and positive angle sketches, meaning that my sketch was situated in mid air, rather than on the shaft. Interestingly enough, using a 330° offset caused the same thing. Another if solved the problem, making X values negative if the angle was negative. I guess the issue is: is there any logic to it for future scripting?
     
  2. Lew_Merrick

    Lew_Merrick Alibre Super User

    Hi Albie -- Not that I am suggesting that I could do anything to assist, but would not posting your script here allow those who are "scripting experts" a better overview of your situation? [Irrational minds want to know...] -- Lew
     
  3. albie0803

    albie0803 Alibre Super User

    Ok, here is my script. It is for putting metric keyways into shafts.

    Details:
    It assumes that the shaft is built on the X-Axis and the horizontal plane is the ZX-Plane
    The origin face should be on the YZ-Plane
    The reference face is the face the keyway is positioned from. You can choose if the keyway is towards or away from the origin face.
    Keyway cuts the reference face will put the centre of an end arc on the reference face.

    Instructions:
    make a keyway with zero rotation.
    Select origin face, reference face, cylinder edge where key will be, gap from reference face and keylength.
    click ok. A box will appear with a suggested keysize. Click Apply then Close
    Keyway is created
    Edge select box will appear for fillet on keyseat. Select edge and OK or Cancel
    inspect the sketch.
    make a keyway with a negative rotation (-30)
    Inspect the sketch.

    You should see that the second sketch has swung its XY coordinates.

    Copy ShKey.png to the same folder as the script. It uses it.
     

    Attached Files:

    Last edited: Sep 12, 2020

Share This Page