8 Replies Latest reply on Jan 29, 2017 2:25 AM by Patrick.Cashman

    Setting SetupParameter.Unit property

    navita@rafael.co.il

      Hi,

      According to the API's manual I understand that it's not an option to change the value of the unit using automation.

      I was wondering if anyone has an idea how can i change the unit of the output i get from the ExportIDF using MGCPCBEngines.IDFExport.

      I would like to change the unit of the output prior to exporting to match to the units I received from the MCAD.

       

      Thanks,

      Navit

        • 1. Re: Setting SetupParameter.Unit property
          Patrick.Cashman

          I looked into this.  There is no way I can find to change the IDF units to anything other than the current design units.  I checked documentation and all the functions available to the IDFExport object in the COM - nothing in either place.

           

          It is possible to change design units at runtime in a script.  Use the document.currentunit function.  But be aware that it applies only to the script it is used in.  It does not change the setting in Setup>Setup Parameters or on the units displayed in the upper right corner of the Xpedition window. Also no other script or built-in function knows the units are changed when you do it in a script, so you cannot count on anything other than the currently operating script to use the units you specify with document.currentunit function.

          • 2. Re: Setting SetupParameter.Unit property
            navita@rafael.co.il

            Thank you very much for the quick respond.

            I know about the document.currentunit function, but it doesn't help for this purpose. I tried it and failed.

            It doesn't affect the outcome of the IDF export.

            I used it when I needed to find plane shape using coordinate and the coordinate I had was not in the same units as in the active document.

            I'll probably need to change the file by myself using some math hoping that the utility.convertunit function will work as expected...

            • 3. Re: Setting SetupParameter.Unit property
              Patrick.Cashman

              Yes you can edit the file after it's created with automation.  I recommend doing your own unit conversions - you will need to parse the file somewhat to make sure you are changing the correct items and not some other bit of numeric text in the file. Adding a unit conversion function is only a few more lines of code.  It ensures that you get exactly what you want and don't get surprised at some future time.

               

              I do a similar thing with the IDF output to pass Variant information to the MCAD systems our mechanical engineers use.  They use SolidWorks, with the CircuitWorks addin.  It recognizes the placed/unplaced IDF marker for components.

               

              Which brings up an interesting point - we do designs in both English and metric units, and CircuitWorks handles the input either way. Is there a way to avoid the units conversion entirely by doing something with your MCAD tool that would be easier?

               

              As always with the PCB Engines, make sure you set the engine to nothing when done with it to avoid hanging up your design database.

              • 4. Re: Setting SetupParameter.Unit property
                navita@rafael.co.il

                Thank you patrick,

                The reason they asked me to change the units it's not because the system doesn't know how to read it correctly.

                They want to to be able to talk with each other (ECAD eng. and MCAD eng.) in the same units when there is a problem with the import/export without thinking of unit conversion.

                It's a little bit of user pampering if you ask me...It could all be solved if they have just change the unit in the xPCB settings.

                 

                I'm interested in what you implemented for solid works.

                If it's possible, I would like you to share with me the obstacles you solved using automation.

                This is going to be the next interface I'm going to implement.

                • 5. Re: Setting SetupParameter.Unit property
                  Patrick.Cashman

                  I have two things that help our mechanical engineers:

                  1.  I add variant data to the IDF file.

                  There is an automation interface to the Variant Manager in the Xpedition flow.  As part of my Export IDF routine, I use that to get 2 lists of parts - installed and not installed.  After the IDF file is created, I open it and modify the lines that pertain to components.  There is a descriptor at the end of each component line which indicates PLACED or UNPLACED.  I just change that text according to the status of each part from the variant manager data. The IDF file is a simple text file so the methods for editing it with automation are basic text string parsing and standard file I/O.

                   

                  2. I create what I call 'Hot Net' data.

                  The mech engineers want to see what parts of the board they can touch with metal chassis connection mounting or contact features, and what board metal they have to avoid touching with the chassis.  This really comes down to identifying the entire chassis ground net and then everything else separately.  Then they also want to see where the solder mask is.  And they want all this as SolidWorks parts that can be added to the PCB Assembly model they make from the IDF data.

                  So how is this done?  I have a GUI that allows the user to specify the ground (chassis) net, and then to choose which data to output, and which side of the board to get the data from.  A ground net is chosen, then the user selects to output Chassis Ground, Hot Nets (everything that's not Chassis Ground) or Solder Mask data.  Then there's a button to execute the function.  What happens in the background is this:

                  - I collect everything in the appropriate data set - traces, pins, vias, conductive shapes, teardrops, etc.

                  - I invoke the mask engine and set up a mask object to receive all the collected shapes.

                  - I cycle through all the objects, and add them to the mask shapes collection

                  - I do boolean operations on the shapes so that everything connected to another object ends up in a single shape, and cutouts are removed as approprate.

                  - Once the mask engine is done, and all the shapes are collected and redrawn in as few objects as possible, I draw all the shapes on a user layer.

                  - When everything has been drawn on the user layer, I execute the DXF Export engine, and create a DXF file with the shape data in it.

                  - Now I switch the interface to SolidWorks, and run a series of functions that create a solid part from the DXF file.

                  - The result is a SolidWorks part file with a single sketch and single feature, with all the shapes included in that feature. We end up with 6 total parts: top and bottom chassis, top and bottom hot nets, and top and bottom soldermask.

                   

                  Here is a video of an early effort at making the SolidWorks parts from board data.  The method was way too slow, so I replaced it with the process above.  But you can get an idea of what the part files end up looking like when they are done. Expedition to SolidWorks - YouTube

                   

                  I'm in the process of making a video of the new process.  I'll post it soon, and reply here again when I do.

                   

                  Edit: Video link added

                  • 6. Re: Setting SetupParameter.Unit property
                    Patrick.Cashman

                    Updated video added here: Create Hot Net data - YouTube

                    1 of 1 people found this helpful
                    • 7. Re: Setting SetupParameter.Unit property
                      navita@rafael.co.il

                      Hi, Thank you very much for your sharing.

                      Do you have a description of all functionality you implemented in the Post Processing application?

                      We have just started working in xpedition in production mode (after many years in board station), so we are still at the beginning of automation, and understanding how to work in expedition.

                      I don't have any background in PCB layout (I am a software engineer) so I'm learning the technical data on the way...

                       

                      Thanks,

                      Navit

                      • 8. Re: Setting SetupParameter.Unit property
                        Patrick.Cashman

                        In the video I linked above, you can see the main window of the Post Processor tool.  Most of the functions are self-explanatory.  You can see the Panel Wizard here, and other functionality in my other videos in this playlist. I can share more complete information with you offline.  Please contact me directly by email at patrick@exactcad.com