9 Replies Latest reply on Jan 3, 2018 3:06 PM by Rob Edwards

    Virtual part input macro

    Paul Risley

      This is not my first time writing macros, but this is the first one I thought some other people might get some good use out of.

       

      I use virtual parts on almost every project we do. And I figured it should be easy enough to create a macro that inserts 10 parts at a time instead of manually inputting a new part over and over. Well this thing has worked pretty well for my needs over the past six months with a few tweaks here and there.

       

      I hope someone else can get some use out of it.

       

      BTW modify it however you want to suit your needs. I have no proprietary hold on this I hope a couple of people can get some use out of it.

       

      On a side note solidworks should allow hte ability to save an assembly with virtual parts as a template. I have tried the various methods of renaming file structure to create one and the like. Unfortunately they are not stable and corrupt pretty frequently.

        • Re: Virtual part input macro
          Solid Air

          Thanks for posting the macro.  I downloaded and hope to look at it sometime soon.

           

          You can always make your assembly a start part and put it in the design library instead of a template.

           

          Question: For the parts you make virtual, are they project specific or used in other projects?

            • Re: Virtual part input macro
              Paul Risley

              Solid Air wrote:

               

              Thanks for posting the macro. I downloaded and hope to look at it sometime soon.

               

              You can always make your assembly a start part and put it in the design library instead of a template.

               

              Question: For the parts you make virtual, are they project specific or used in other projects?

              Our assembly structure starts out as 1 main assembly. Each area of design is broken into a virtual sub assembly then those virtual sub assemblies are broken into further virtual subs if need be. Then in those subs all "new" parts are virtual. Existing stock parts or purchased parts are actual parts. This leaves the concepting of an assembly to be all inherent to the main assembly without a lot of file management required if the project goes no where after concept.Or if the design intent changes 180 degrees at the middle of a project and prior to final design approval there is no part designation required. A lot of times we do not even have a job number to assign to the project until approval so a numbering scheme for the project is always in flux.

               

              The main reason we went to this approach was because at the main assembly we only want the bare mates needed and the virtual assemblies and parts lent itself so well to this that it just became second nature to utilize them in this fashion. Now I can't imagine doing it the other way where every part was named and saved prior to approval. Our network folders are full of garbage parts over the years that have never been used.

               

              Prior to my coming in and establishing job numbering systems the basic part numbering scheme was whatever you think it is you should name it.So we have folders full of "mount tower, mount tower 2, mount tower 3 etc.." Great if you only have 1 project open at a time I guess.

               

              Little long winded. The parts are virtual until approval and then become saved parts where they can be used in other projects if needed.

            • Re: Virtual part input macro
              Scott Stuart

              I'll share one I did. This one works on an existing assembly and makes all of the component files virtual, including subassemblies and their components, then gives you the option of deleting the original files from disk. It is intended for virtualizing downloaded models of purchased parts such as air cylinders that are modeled as assemblies, so that you've only got one file to keep track of. It will also mark the components excluded from BOM so you only have one top level part number.

              • Re: Virtual part input macro
                Rob Edwards

                Hi Paul

                Great Idea! - it's a really useful macro.

                I took the liberty of 'tinkering' with it so that you can hold down a number key (normal or numpad) whilst starting the command and it will insert that number of parts

                • 0 counts as 10
                • SHIFT opens an input box so you can type a number
                • I defined two constants DEFAULT and MAX that you can edit in the file

                Scott That looks great too, nice 1 .  I've got the API bug at the moment and want to learn as much as I can.  It's awesome people sharing.

                 

                I've not given it a comprehensive workout,  but it seems provisionally ok for me on 2016

                  • Re: Virtual part input macro
                    Paul Risley

                    Rob Edwards wrote:

                     

                    Hi Paul

                    Great Idea! - it's a really useful macro.

                    I took the liberty of 'tinkering' with it so that you can hold down a number key (normal or numpad) whilst starting the command and it will insert that number of parts

                    • 0 counts as 10
                    • SHIFT opens an input box so you can type a number
                    • I defined two constants DEFAULT and MAX that you can edit in the file

                    Scott That looks great too, nice 1 . I've got the API bug at the moment and want to learn as much as I can. It's awesome people sharing.

                     

                    I've not given it a comprehensive workout, but it seems provisionally ok for me on 2016

                    That is pretty cool there Rob, I went with 10 originally because that is the limit we try to set for subs. The nice thing is if you reach 10 you just click the macro again and another 10 will populate in the assembly. Then we just delete the extra parts at release time save out our virtual sub assembly and all of its parts.

                     

                    On a side note when you go to save out the virtual assemblies and parts you can customize where each is going in the network pretty easily which makes managing network structure very easy.

                  • Re: Virtual part input macro
                    Scott Stuart

                    Paul, I like the concept of making parts virtual to start and only saving them to network if/when they become real part numbers. We also have lots of junk files on our network. I'm going to see if I can get our design group to start using this concept. Thanks for the tip, and the macro!

                    • Re: Virtual part input macro
                      Rob Edwards

                      The only problem I have had with virtual parts is that you have to make sure the assembly is saved, in order for the parts to be saved.  A crash can wipe out a lot of work!  Back in 2015 when I was still on subs my VAR advised me to get used to using Save All.

                      Is this a problem you have encountered?

                        • Re: Virtual part input macro
                          Paul Risley

                          This is an issue at first with virtual parts. The workflow you use drives how much of an issue.

                           

                          Example right now I have top level assembly. It has 9 virtual subs each one of those has at least 2 virtual subs in them. I have a timer on my computer to go off every 15 minutes. This reminds me to go back to the main "master" assembly and save there. Since I use a smart mouse I have built in mouse gestures for minimize, Ctrl Q and save in a circular pattern. I also have close in the same circle so what  I do is close the subs all of the way to the top assembly do my circle and when the computer is done saving go right back into my work. Sometimes I forego the 15 minute window and go a half hour(I am a bit of a daredevil that way).

                           

                          But to answer your question you can have loss of work if you do not set yourself up to save all in some fashion.

                           

                          I originally posted this for those that were already using virtual parts as a quick hit tool.

                           

                          There are many things to get used to when working in the virtual world. For instance technically you cannot directly make a drawing of a virtual part. There is a way to do it if you are creative. If your assembly is not virtual you can make an extra sheet and use a display state where only the virtual part exists and you now have the ability to detail it out. Works great for guarding and plumbing lines if you just want rough dimensions without the extra drawings floating around.

                          (I know in the wrong hands this information is a loaded gun.)

                           

                          Rob Edwards I know you work in the wood working industry I use this for most of my personal woodworking projects. It allows me to construct and detail my dovetails etc for routing in one drawing package file where if one thing changes the whole package updates. Kudos to John Stoltzfus on his master sketch method I use it for my home projects with some tweaks to make it in the virtual parts. Another great thing in Solidworks is the weldment profile when it comes to woodworking, make a bunch of sketches and use weldment for my wood sizes then use library features for all of my routing needs and finish work and when I a done i have a pretty easy to follow size list for all of my materials.

                           

                          Ok went way off topic for some of that. Bottom line is saving at the topmost level will save you headaches.

                            • Re: Virtual part input macro
                              Rob Edwards

                              Paul

                              That's magic, thankyou.  I like the idea of a timer.  I'm normally pretty good at saving and 'spider sensing' when some action might be a bit dodgy, but I'm sure you know how it is, when you get absorbed, time just disappears.

                              For me the main reason I would like to use virtual parts is so I can have nice compact 'starting point' assemblies along with a simple drawing to make a pretty pdf for the customer quickly.

                              And for production mostly I don't need to do 'proper' drawings - an elevation and a couple of cross sections is enough for our lads who will happily make something of the back of an envelope.  If you work with wood, I guess you know how it is not always possible to get out what the drawing specifies anyway and you just adjust the job on the go...

                              We have a policy of not putting too much detail on our drawings anyway, so they have to work it out for themselves

                               

                              Thanks again for making this psot, I'm exploring the api at the moment and am enjoyin reading code more than i ever thought was possible