3 Replies Latest reply on Jun 4, 2016 1:09 AM by Alfred Jelinek

    VBA Macro Mate References

    Samantha Szkirpan

      Hello,

       

      I'm trying to automate the assembly of components to a rail. The issue with this is that the rail has U's meaning the holes where components are attached are not equally spaced. The holes come in sets of 3 evenly spaced holes and looks something like this:   o   o   o o   o   o o   o   o

      My first idea was to try and label each hole in each set with 1, 2, and 3 (hopefully using mate references) and the parts would have corresponding 1's, 2's, and 3's predetermined to be tangent mates. The issue arises when you import new parts to an open assembly using API, the predetermined mate references do not automatically line up like they do when you insert parts manually.

      How do I get the mate references to work as they do when inserted manually using VBA? Is there some caveat in the addcomponent4 method that enables the use of mate references that I'm missing? Any other ideas aside from mate references that would be more effective?

       

      Thank you

        • Re: VBA Macro Mate References
          Alfred Jelinek

          I have the same question....automating mate references sounds great... however I ended up only using them when manually placing components. Trying to figure out placement with a macro just got frustrating.

           

          1) Have you tried smart components? A great feature!!

          2) You could edit and add a point of insertion on the models and also the holes and do a pattern driven by a sketch using a design table and configurations.

          I hope these ideas help and I hope someone answers with some tips in automating the mate references it would be very helpful to the community.

            • Re: VBA Macro Mate References
              Samantha Szkirpan

              Thank you for your response. I was going to try and implement your smart components idea but I'm running into trouble turning components into smart components, saving that setting for future use, and then importing them into an open assembly file later on using the AddSmartComponent method. Can you give me some direction on turning my assembly components into smart components?

              Thank you

                • Re: VBA Macro Mate References
                  Alfred Jelinek

                  What I do is:

                  1) Create the part file that I would like to make a smart component.

                  2) create a temporary assembly.

                  3) insert the part file and mate or fix it.

                  4) add and mate all the other components you would like to come in with the original part.

                  5) save the temp assy

                  6) goto to tools ---> Make smart component

                  7) choose the original part as the smart component (blue area)

                  8) choose the other Components (pink area).

                  9) click configuration if necessary

                  10) click okay then save all.

                   

                  The original part is now a smart component which when activated will look in the locations of the components selected and then bring them in.

                   

                  If you insert it into an assembly you should be able to right click on it and add smart components or click the lightening bolt symbol to insert the components.

                   

                  I created a video at youtube.com to help:

                   

                   

                  creating a smart component - YouTube

                   

                  I hope this helps

                   

                  Al