4 Replies Latest reply on Dec 6, 2011 10:44 AM by daniel74

    PADS Layout macro problem

    rdziendziel

      Greetings.

      I'm trying to make a tricky PADS Layout macro, that draws a polyline based on variables.

      For example:

       

      x=0

      y=0

      Application.ExecuteCommand("Add 2D Line Polyline")
      Application.ExecuteCommand("Drafting Path Mode")
      Application.ExecuteCommand("Add Corner To Drafting", 0mil, 0mil)

      x=x+5

      y=y+10

      xm=x&"mil"

      ym=y&"mil"

      Application.ExecuteCommand("Add Corner To Drafting", xm,ym)

       

      [...]

       

      Application.ExecuteCommand("Complete Drafting")
      Application.ExecuteCommand("Select Mode")

       

      Unfortunately, it doesn't work. What's the proper type of a variable, that can be passed to Application.ExecuteCommand() ?

      I haven't found any section in the reference maual, that covers this issue.

        • 1. Re: PADS Layout macro problem
          matija.golar

          you need to pass whole string inside parentheses to execute command

           

          Application.ExecuteCommand("Add Corner To Drafting", xm,ym)

           

           

          'chr(34) represents "

           

          apo=chr(34)

          command=apo & "Add Corner To Drafting" & apo & "," & xm & "," & ym

           

          if you send command to msgbox it should look exactly as above, but with actual numbers

           

          like

          "Add Corner To Drafting", 15, 20

           

          then say

           

          Application.ExecuteCommand(command)

           

          cheers,

          Matija

          • 2. Re: PADS Layout macro problem
            daniel74

            I am experiencing a similar issue but I can not get it going with the solution proposed by matija.

             

            My code:

             

                x=2

                y=4

                xc1=x &"mm"

                yc1=y&"mm"

                xc2=x+1 &"mm"

                yc2=y+1 &"mm"

                Application.ShowBar("Drafting Toolbar")

                Application.ExecuteCommand("Add 2D Line Polyline")

                Application.ExecuteCommand("Drafting Rectangle Mode")

                cmd = chr(34) & "Add Corner To Drafting" & chr(34) & ", " & xc1 & ", " & yc1

                MsgBox cmd

                Application.ExecuteCommand(cmd)

                cmd = chr(34) & "Add Corner To Drafting" & chr(34) & ", " & xc2 & ", " & yc2

                MsgBox cmd

                Application.ExecuteCommand(cmd)

                Application.ExecuteCommand("Cancel")

             

            The message boxes show:

             

            "Add Corner To Drafting", 2mm, 4mm

             

            and

             

            "Add Corner To Drafting", 3mm, 5mm

             

             

            If I put the literal values in the Application.ExecuteCommand statement it works. e.g. Application.ExecuteCommand("Add Corner To Drafting", 2mm, 4mm) works perfectly.

             

             

            Both PADS version 9.3 and 9.3.1 both show this behaviour.

             

            What am I missing here?

            • 3. Re: PADS Layout macro problem
              jduquette

              What behavior?  Report an error?  Do nothing?  What does Layout do?

              • 4. Re: PADS Layout macro problem
                daniel74

                PADS does nothing. No error message, no change on the screen. Nothing.