Skip navigation

community

174 Views 6 Replies Latest reply: Mar 26, 2012 7:22 AM by CSWalt RSS
Currently Being Moderated

Jan 11, 2012 12:31 PM

Schematic ULP ingroup() function

I have the following ULP code that fails to return any objects for the

ingroup() function in Eagle 6. Is this a bug or has something changed?

 

 

         SCH.parts(P)

         {

             if (ingroup(P))

             {

                 // make sure it has a package and name

                 if (P.device.package && P.name)

                 {

                     string disp;

 

                     if (fDisplay == 0)

                         disp = "OFF";

                     else if (fDisplay == 1)

                         disp = "VALUE";

                     else

                         disp = "NAME";

 

                     string tmp;

                     sprintf(tmp, "CHANGE DISPLAY %s;\n", disp);

                     strCmd += tmp;

                     sprintf(tmp, "ATTRIBUTE %s %s '%s';\n", P.name,

strAttrName, strAttrValue);

                     strCmd += tmp;

 

                     //dlgMessageBox(strCmd);

 

                     ++cnt;

                 }

             }

 

Thanks!

 

Bob Starr

 

Attributes

  • Currently Being Moderated
    1. Jan 11, 2012 4:00 PM (in response to rtzaudio)
    Re: Schematic ULP ingroup() function

    I have the same problem!

     

    Günther

  • Currently Being Moderated
    2. Jan 20, 2012 8:13 AM (in response to rtzaudio)
    Re: Schematic ULP ingroup() function

    On 01/11/12 19:31, Bob Starr wrote:

    I have the following ULP code that fails to return any objects for the

    ingroup() function in Eagle 6. Is this a bug or has something changed?

    This is a bug, honestly.

    Implemented this way, it also didn't work in Version 5.

    In Version 5 you have to go over the sheet context, like:

     

            SCH.sheets(SH)

               SH.parts(P)

                  if (ingroup(P))

                     dlgMessageBox("Part in group: " + P.name);

     

    We'll repair this.

     

    Regards,

    Walter Spermann

     

            SCH.parts(P)

            {

                if (ingroup(P))

                {

                    // make sure it has a package and name

                    if (P.device.package && P.name)

                    {

                        string disp;

     

                        if (fDisplay == 0)

                            disp = "OFF";

                        else if (fDisplay == 1)

                            disp = "VALUE";

                        else

                            disp = "NAME";

     

                        string tmp;

                        sprintf(tmp, "CHANGE DISPLAY %s;\n", disp);

                        strCmd += tmp;

                        sprintf(tmp, "ATTRIBUTE %s %s '%s';\n", P.name,

    strAttrName, strAttrValue);

                        strCmd += tmp;

     

                        //dlgMessageBox(strCmd);

     

                        ++cnt;

                    }

                }

     

    Thanks!

     

    Bob Starr

     

     

    --

    -


    Walter Spermann

    Softwareentwicklung

    CadSoft Computer GmbH

    Pleidolfweg 15

    84568 Pleiskirchen

    Tel.: 08635/6989-10

    www.cadsoft.de

    -


    Registergericht: Amtsgericht Traunstein HRB 5573

    Geschäftsführer: Thomas Liratsch

    -


     

  • Currently Being Moderated
    4. Feb 8, 2012 3:28 PM (in response to rtzaudio)
    Re: Schematic ULP ingroup() function

    On 02/08/12 17:01, Bob Starr wrote:

    On 1/20/2012 9:13 AM, Walter Spermann wrote:

    >> On 01/11/12 19:31, Bob Starr wrote:

    >>> I have the following ULP code that fails to return any objects for the

    >>> ingroup() function in Eagle 6. Is this a bug or has something changed?

    >> This is a bug, honestly.

    >> Implemented this way, it also didn't work in Version 5.

    >> In Version 5 you have to go over the sheet context, like:

    >>

    >>          SCH.sheets(SH)

    >>             SH.parts(P)

    >>                if (ingroup(P))

    >>                   dlgMessageBox("Part in group: " + P.name);

    >>

    >> We'll repair this.

     

    Hi Walter,

     

    Not sure I follow you on the above. My original ULP's work fine in v5.11

    with the following logic.

     

            SCH.parts(P)

            {

                if (ingroup(P))

                {

                }

            }

     

    What happens if the SCH.sheets enum is not used, does it use the current

    sheet being edited in the schematic?

    Yes. Obviously if all instances are on one sheet and if all these instances are in a

    group this works (ingroup is true then). This is a grey zone a bit.

    We have to make this straight and clear again.

     

     

    FWIW, I've tried both methods with v6 of Eagle and neither returns any

    results for ingroup(). I have a number of ULP's that use the ingroup()

    function that I use daily in my work, so I've not moved to v6 yet. Any

    idea when this might be addressed?

    In one of the next betas. I can't say exactly because we still have a number of

    other issues to fix. Sorry for that.

     

    Regards,

    Walter Spermann

     

    Regards,

     

    Bob

     

     

    --

    -


    Walter Spermann

    Softwareentwicklung

    CadSoft Computer GmbH

    Pleidolfweg 15

    84568 Pleiskirchen

    Tel.: 08635/6989-10

    www.cadsoft.de

    -


    Registergericht: Amtsgericht Traunstein HRB 5573

    Geschäftsführer: Thomas Liratsch

    -


     

  • Currently Being Moderated
    6. Mar 26, 2012 7:22 AM (in response to rtzaudio)
    Re: Schematic ULP ingroup() function

    Hi Bob,

     

    On 01/11/12 19:31, Bob Starr wrote:

    I have the following ULP code that fails to return any objects for the

    ingroup() function in Eagle 6. Is this a bug or has something changed?

     

     

            SCH.parts(P)

            {

                if (ingroup(P))

                {

                    // make sure it has a package and name

                    if (P.device.package && P.name)

                    {

                        string disp;

     

                        if (fDisplay == 0)

                            disp = "OFF";

                        else if (fDisplay == 1)

                            disp = "VALUE";

                        else

                            disp = "NAME";

     

                        string tmp;

                        sprintf(tmp, "CHANGE DISPLAY %s;\n", disp);

                        strCmd += tmp;

                        sprintf(tmp, "ATTRIBUTE %s %s '%s';\n", P.name,

    strAttrName, strAttrValue);

                        strCmd += tmp;

     

                        //dlgMessageBox(strCmd);

     

                        ++cnt;

                    }

                }

     

    Thanks!

     

    Bob Starr

    we fixed some issues in this area, but actually,

    the objects in the group are the instances, not the parts.

    Please consider this approach:

     

    SCH.parts(P)

       P.instances(I)

          if (ingroup(I))

             dlgMessageBox("Part " + P.name + " has selected Instance " + I.name);

     

    From V5 to V6 we changed the object hierarchy:

    Instances are no longer children of the according part but of the sheet where they are located.

    (this is like for all other objects that are located on a sheet).

    Like in V5, if an object is in a group, also the parent entities are assigned to the group.

    That's why the code

     

    SCH.parts(P)

       if (ingroup(P))

          dlgMessageBox("Part " + P.name + "is in group");

     

    doesn't work although you may have added some instances to a group.

    The code

     

    SCH.sheets(SH)

       if (ingroup(SH)

          SH.instances(I)

             if (ingroup(I))

                dlgMessageBox("Selected Instance " + I.name);

     

    works, because the parent sheet is in the group, if one of it's instances is in the group.

    To find out the parts related to instances in a group you have to use the first code snippet.

    Sorry for the confusion ! The new object hierarchy is also described in the online help

    (Section User Language/Object types). HTH.

     

    Regards,

    Walter

     

    --

    -


    Walter Spermann

    Softwareentwicklung

    CadSoft Computer GmbH

    Pleidolfweg 15

    84568 Pleiskirchen

    Tel.: 08635/6989-10

    www.cadsoft.de

    -


    Registergericht: Amtsgericht Traunstein HRB 5573

    Geschäftsführer: Thomas Liratsch

    -


     

Related Content


Related Products
Discussions
  • Retrieving data ...

Bookmarked By (0)