0 Replies Latest reply on Aug 17, 2015 5:48 PM by Alien_impact

    Declaring vectors in VBScript?

    Alien_impact

      Hey everyone,

      I'm trying to write a very simplistic 3ds max-Photoshop interop so I'm making a class library and I've encountered a problem.

      First, my maxscript collects an array of UV vertex coordinates and passes them to Photoshop to fiddle with. These coordinates are vector variables, e.g. [1.0, 0.0]

      I tried to treat this data as double data type but the number of arguments is invalid. I tried importing it as Array but I keep getting a "No method found which matched the argument list" error.

      So how do I go about processing vectors in VB and what data type do I use? (I'm very new to this so I might be missing something painfully obvious, sorry)

      Thank you!

      Here's the code example (this one causes the "No method found" error):

       

      Imports Photoshop

       

      Public Class maxtoPS

       

          Public PSDapp As Photoshop.Application

       

          Public Sub New()

              PSDapp = CreateObject("Photoshop.Application")

          End Sub

       

          Public Sub Makepath(ByVal Coords() As Array)

              Dim lineArray(1), lineSubPathArray(0), Anchor1(2), Anchor2(2), docRef, myPathItem, fincoords(,)

              PSDapp.Preferences.RulerUnits = 1

              PSDapp.Preferences.TypeUnits = 1

              docRef = PSDapp.Documents.Add(1024, 1024, 72, "Simple Line")

              For index = 0 To Coords.GetUpperBound(0)

       

                  fincoords(1, 1) = Coords(index)

                  fincoords(1, 1) = CInt(fincoords(1, 1))

                  lineArray(index) = CreateObject("Photoshop.PathPointInfo")

                  lineArray(index).Kind = 2

                  lineArray(index).Anchor = fincoords(1, 1)

                  lineArray(index).LeftDirection = lineArray(0).Anchor

                  lineArray(index).RightDirection = lineArray(0).Anchor

       

              Next

       

              lineSubPathArray(0) = CreateObject("Photoshop.SubPathInfo")

              lineSubPathArray(0).operation = 2

              lineSubPathArray(0).Closed = False

              lineSubPathArray(0).entireSubPath = lineArray

              myPathItem = docRef.PathItems.Add("Line", lineSubPathArray)

          End Sub

       

       

      End Class