3 Replies Latest reply on Jun 22, 2015 2:08 AM by c.pfaffenbichler

    How to find angle of last transformation?

    vikramo53539272

      var idTrnf = charIDToTypeID( "Trnf" );

          var desc57 = new ActionDescriptor();

          var idnull = charIDToTypeID( "null" );

              var ref39 = new ActionReference();

              var idLyr = charIDToTypeID( "Lyr " );

              var idOrdn = charIDToTypeID( "Ordn" );

              var idTrgt = charIDToTypeID( "Trgt" );

              ref39.putEnumerated( idLyr, idOrdn, idTrgt );

          desc57.putReference( idnull, ref39 );

          var idLstT = charIDToTypeID( "LstT" );

          desc57.putBoolean( idLstT, true );

      var lastTransformation = executeAction( idTrnf, desc57, DialogModes.NO );
      but here i want angle?

        • 1. Re: How to find angle of last transformation?
          JJMack Most Valuable Participant

          It look like the transform you recorded with the scriptlistener plug-in did mot rotation. So none was recorded.  Here one I recorded where I rotated the current laye -35 degrees.

           

           

           

          // =======================================================

          var idTrnf = charIDToTypeID( "Trnf" );

              var desc19 = new ActionDescriptor();

              var idnull = charIDToTypeID( "null" );

                  var ref11 = new ActionReference();

                  var idLyr = charIDToTypeID( "Lyr " );

                  var idOrdn = charIDToTypeID( "Ordn" );

                  var idTrgt = charIDToTypeID( "Trgt" );

                  ref11.putEnumerated( idLyr, idOrdn, idTrgt );

              desc19.putReference( idnull, ref11 );

              var idFTcs = charIDToTypeID( "FTcs" );

              var idQCSt = charIDToTypeID( "QCSt" );

              var idQcsa = charIDToTypeID( "Qcsa" );

              desc19.putEnumerated( idFTcs, idQCSt, idQcsa );

              var idOfst = charIDToTypeID( "Ofst" );

                  var desc20 = new ActionDescriptor();

                  var idHrzn = charIDToTypeID( "Hrzn" );

                  var idRlt = charIDToTypeID( "#Rlt" );

                  desc20.putUnitDouble( idHrzn, idRlt, -0.000000 );

                  var idVrtc = charIDToTypeID( "Vrtc" );

                  var idRlt = charIDToTypeID( "#Rlt" );

                  desc20.putUnitDouble( idVrtc, idRlt, -0.000000 );

              var idOfst = charIDToTypeID( "Ofst" );

              desc19.putObject( idOfst, idOfst, desc20 );

              var idAngl = charIDToTypeID( "Angl" );

              var idAng = charIDToTypeID( "#Ang" );

              desc19.putUnitDouble( idAngl, idAng, -35.000000 );  <====================================================

              var idIntr = charIDToTypeID( "Intr" );

              var idIntp = charIDToTypeID( "Intp" );

              var idbicubicSmoother = stringIDToTypeID( "bicubicSmoother" );

              desc19.putEnumerated( idIntr, idIntp, idbicubicSmoother );

          executeAction( idTrnf, desc19, DialogModes.NO );

          • 2. Re: How to find angle of last transformation?
            vikramo53539272 Level 1

            Thnanx a lot sir for replying! but i want this -35 degrees with the help of script and don't want to execute it again.

             

            var transform  = executeAction(charIDToTypeID("Trnf", undefined,undefined));

             

            var angle = transform.getDouble(charIDToTypeID('Angl"));

             

            this gives me angle but dont want to execute its want angle of lst trnf.

            • 3. Re: How to find angle of last transformation?
              c.pfaffenbichler Level 9

              I think the transformation needs to be triggered within the Script then.

              var transform = executeAction(charIDToTypeID("Trnf", undefined,DialogModes.ALL));

              var angle = transform.getDouble(charIDToTypeID("Angl"));

              alert (angle);