7 Replies Latest reply on Apr 10, 2013 11:24 PM by ashkolnik

    How to get Points array from User Draft Layers ? (Expedition)

    ashkolnik

      Hi All ,

      I am a noob in VBS .

      I can get point array "Geometry" from poligons like in layers like "Board Outline" , "TestFixtureOutline" , "Panel Outline" ... (Objects) .

      Example Code (Working good) :

       

           Dim pcbAppObj

           Set pcbAppObj = Application

           Dim pcbDocObj

           Set pcbDocObj = pcbAppObj.ActiveDocument

           Dim pnts

           pnts = pcbDocObj.TestFixtureOutline.Geometry.PointsArray

       

      But how to get Points array (Polygon) from User Draft Layers with custom names ? and that difference between Objects to Child Object ?

      Thanks.

        • 1. Re: How to get Points array from User Draft Layers ? (Expedition)
          andrew.french

          You're going to have to grab the collection of user draft layers and iterate through them till you find the one(s) you are looking for. Then grab your points array.

           

          In C# it would look roughly like

           

          MGCPCB.FabricationLayerGfxs fabGfxs = ExpDoc.FabricationLayerGfxs;

                      foreach (MGCPCB.FabricationLayerGfx fabGfx in fabGfxs)

                      {

                              if (fabGfx meets some condition) {

                                    object pnts = fabGfx.Geometry.get_PointsArray();

                                    'Do something

                              }

                      }

          • 2. Re: How to get Points array from User Draft Layers ? (Expedition)
            ashkolnik

            Hi All ,

            Thank you for fast answ.

            Can you explaine what is it : MGCPCB.FabricationLayerGfxs ?

            Maibe in my case i need  MGCPCB.UserlayerGfxs ?

            • 3. Re: How to get Points array from User Draft Layers ? (Expedition)
              andrew.french

              Yes you're right, I meant to change that, you will want to use UserlayerGfxs.  The FabricationLayerGfxs are for things like silkscreen and assembly items.

              1 of 1 people found this helpful
              • 4. Re: How to get Points array from User Draft Layers ? (Expedition)
                ashkolnik

                Merci ,

                I think it will be helpful , i will check it .

                • 5. Re: How to get Points array from User Draft Layers ? (Expedition)
                  ashkolnik

                  Hi All ,

                  Code below it doesn't works , why ?

                  Dim userLayerObj

                  Set userLayerObj = pcbDocObj.FindUserLayer("Test")

                  pnts = userLayerObj.Geometry.PointsArray

                  Here i want to get points array (X,Y) from User layer that called Test . but it's ERROR.

                  Capture.PNG

                  thanks.

                  • 6. Re: How to get Points array from User Draft Layers ? (Expedition)
                    Head1

                    Hello A. Shkolnik,

                     

                    Your question is not logical.

                      You say:

                     

                        Here i want to get points array (X,Y) from User layer that called Test

                     

                    You can not get Coordinates from a layer.

                    You can get coordinates from entities ( objects ) that are located on a certain layer.

                      For example: You may say:

                     

                          I want to get the coordinates of all circles which are located

                           on User layer : My_Layer

                     

                      Or

                     

                       I want to get the coordinates of all texts which are located

                            on User layer : My_Layer

                     

                      But you can not ask for coordinates of the  layer itself.

                     

                      As in the example Andrew.French sent you:

                     

                                       if (fabGfx meets some condition) then

                                                     object pnts = fabGfx.Geometry.get_PointsArray();

                                            ' Do something

                                      end if

                     

                    In this case, the object you ask its array coordinates is:   FabGfx

                    FabGfx is just an object, one of many on you checked layer. 

                     

                    In general: You can loop through all objects in a specific layer by this loop

                     

                     

                    If All_Texts is a variable that represents all texts in a certain layer.

                       Curr_text is a variable that represents a certain text in a same layer'

                    then  the following loop goes through all text in that layer"

                     

                        For each Curr_text in all_texts

                          ' Do sonething with the object  Curr_text

                        next

                     

                    If you understand what I wrote you here, you did some progress.

                    If not: My advicd: start learning the basics of programing.

                    MentorGraphics supplies 2 books.

                     

                                   Start with the smaller one: 564 pages.

                    Later continue with the thicker one: 2397 pages.

                     

                     

                      Good luck,

                     

                       Head1.

                    --------------------------------------------------------------------------------------

                     

                     

                     

                     

                     

                              

                    1 of 1 people found this helpful
                    • 7. Re: How to get Points array from User Draft Layers ? (Expedition)
                      ashkolnik

                      Hi Head ,

                      Full answer to my question is :

                         Capture.PNG

                      it's Work.

                      Thanks .