8 Replies Latest reply on Sep 14, 2017 9:19 AM by Ivan Spikmans

    solidworks doesn't use/take the right values for variables

    Ivan Spikmans

      when I run my code I want to select a horizontal face. But the variables I give get changed when used in SolidWorks.

      Or so does it seem.

       

      In the pictures you see what point does get selected in the solidworks part as a picture with a red piece that is the face I want to select.

      The other picture are the numbers that the program has for the variables.

       

      code:

       

      Alpha = Pi/6

      varcutthroughcylindercircle = 85/1000

      varcylinderheight = 29/1000

      varheighttopcut = 18/1000

       

      dX3 = -(Sin(Alpha) * (varCutThroughCylinderCircle))

      dY3 = -(Cos(Alpha) * (varCutThroughCylinderCircle))

      dZ3 = -(varCylinderHeight - varHeightTopCut)

      swModeldoc.Extension.SelectByID2 "", "FACE", dX3, dY3, dZ3, False, 1, Nothing, 0