Menu

Eagle - Variant support - can't quite get it to work...

Help
2024-03-31
2024-04-15
  • David Smart

    David Smart - 2024-03-31

    Hi Marni,

    As I gain knowledge (and use features I haven't used before), I occasionally make a new discovery. I think that is the case this time.

    In Eagle, I can create design variants:
    * Eagle Schematic | Edit | Assembly Variants...
    And then create a new variant or two and select a few parts to not be included in each.

    In a recent case, I had two different battery holders. They overlaid on the PCB, so of course only 1 can be populated at a time. With the eagle variant feature, the schematic shows a big X over top of the part that is not in that variant. In the pcb, the holes/pads are there, as they should be, but the other aspects of the non-variant part are not shown (tdoc, etc.).

    In the brd file, populate="no" is the attribute of interest. If that attribute does not exist (as with most parts), then it should be shown, or it could have a "yes" value. Only if it is "no", I think FreeCAD-PCB should skip the part and not show it.

    <element name="BAT1" library="ProjectLib" package="BATCON_9V_TH_RA_ONPCB" value="Keystone 593, 594" x="16.256" y="29.972" populate="no"/>
    

    FreeCAD renders both parts into the model. I went on a search for why, but I'm not sufficiently python skilled to figure it out.

    In eagle.py, I see:

            def getElements(self):
            ...
             self.elements.append({
                 'name': name, 
                 'library': i.getAttribute('library'), 
                 'package': package, 
                 'pathAttribute': '',
                 'value': i.getAttribute('value'), 
                 'x': float(i.getAttribute('x')), 
                 'y': float(i.getAttribute('y')), 
                 'locked': self.translateBoolValue(i.getAttribute('locked')),
                 'populated': self.translateBoolValue(i.getAttribute('populate')), 
                 'smashed': self.translateBoolValue(i.getAttribute('smashed')), 
                 'rot': rot, 
                 'side': side,
                 'dataElement': i
             })
    

    it appears to be picking up that attribute with
    'populated': self.translateBoolValue(i.getAttribute('populate')),

    Then in PCBpartManaging.py, I see:

                #################################################################
                # FILTERING OBJECTS BY SIZE L/W/H
                #################################################################
                if partMinX != 0:
                    minValue = partMinX
                    if step_model.Side == 'TOP':
                        minValue += gruboscPlytki
    
                    if step_model.Shape.BoundBox.XLength < minValue:
                        doc.removeObject(step_model.Name)
                        return
    

    So this looks like the area where it might additionally check the populated field and return before it does any work.

    I tried injecting the following in there, but it always shows "false" and doesn't do what I expect.

                self.printInfo("\nVar exists '{0}': ".format(var_exists))
                self.printInfo("\npopulated  '{0}': ".format(newPart['populated']))
                if var_exists and newPart['populated'] == false:
                    return
    

    Can you help me out?

     
  • Mariusz

    Mariusz - 2024-04-09

    Hi,
    check file from attachment (PCB\formats).

     
  • Anonymous

    Anonymous - 2024-04-10

    That almost works - the part is included/excluded properly. The "almost" part is that the pads for the part are also shown/not shown.

     
  • Mariusz

    Mariusz - 2024-04-10

    Hi,
    it should be ok now.

     
  • David Smart

    David Smart - 2024-04-11

    So close now - it shows the copper pads, but it also shows the tPlace. Mariusz, you are so responsive I hate to ask for more... Ideally: copper pads visible, tPlace not shown.

     

    Last edit: David Smart 2024-04-11
  • SeB30

    SeB30 - 2024-04-11

    Hi,
    I can't wait to see this new feature.
    My two cents : tPlace need to be shown on not mounted parts because this is what you will get on you fabricated PCB and it will be easier to identify missing part.

    Best regards.

     
    • David Smart

      David Smart - 2024-04-11

      SeB30 makes a very good point to ponder.
      * As noted, an assembled PCB would typically have both tName and tPlace, just the part would not be installed.
      * Eagle's representation removes both tName and tPlace, which makes it more obvious, particularly in hand assembly of the first prototypes. And my last comment was, perhaps blindly, focused on "it's not like Eagle".

      My perspective today is that this version is a definite improvement by not rendering the component, while showing the pads. Whether it would be better to add the tName back in, or remove the tPlace, or stay as shown; I can accept any of those alternatives.

       
  • SeB30

    SeB30 - 2024-04-11

    Hi,
    yes, for hand assembly, it's good to have only what need to be mounted. But for machine pick and place, the BOM say what need to be mounted or not following the variant needed. Time for a check box ?
    Nevertheless this is effectively a great improvment and thanks a lot for it !

     
  • Mariusz

    Mariusz - 2024-04-15

    Hi,
    check version from attachment.

     

Anonymous
Anonymous

Add attachments
Cancel