19 Replies Latest reply on Dec 29, 2010 4:09 AM by Deepak Gupta

    Overall Stock Size

      Is there a way for SolidWorks to automatically pick the overall sizes of a part (Boundry Box type of thing) and insert that size into the bill of material under "StockSize". This size to be used to purchase materials.

      Thanks for your help.
        • Overall Stock Size
          Wayne Tiffany
          You can go to http://www.kcswug.com/programs/macros/ and pick up the macro BoundingBox to see if it will do what you want. It works off the BoundingBox API call which is not always exact, and works relative to the coordinate system. Edit the macro inside SW and read the notes at the top of it where it explains the options.

          WT
            • Re: Overall Stock Size
              Aaron Larson
              I'm trying to get this to run in another macro that traverses an assembly and assigns custom properties.  Is it not possible for this macro to work in such a manner since it is acting on the part geometry itself? I can get it to work in the part environement - just not in assembly.
              • Re: Overall Stock Size
                Deepak Gupta

                Wayne thanks for the wonderful macro. Can this edited to work with assembly or multibodies part.

                 

                Thanks

                  • Re: Overall Stock Size
                    Wayne Tiffany

                    I just tried it on a multi-body part and on an assy and it seemed to work fine on both of them. Had you tried and had a failure?

                     

                      WT

                      • Re: Overall Stock Size
                        Deepak Gupta

                        Thanks, it works fine but it generates one bounding box but I need one each for the number of bodies in a part or one each for every part in assembly.

                          • Re: Overall Stock Size
                            Aaron Larson

                            Are you looking to include the bounding box information for the individual components in the assembly properties somewhere?  If you're only looking to run this on the assembly in order to get overall sizes for the components for BOM usage then why not just run the BB macro from a call in another that traverses the assembly.  I was looking to use this for the reason stated and doing this worked well.

                              • Re: Overall Stock Size
                                Deepak Gupta

                                Yes something similar so if you have something already done, can you share that.

                                 

                                Thanks

                                  • Re: Overall Stock Size
                                    Aaron Larson

                                    I've left out some other lines in here that I used to customize this for our workflow requirements.  For instance I had a line in there that skipped the component if it resided in my design library location (as we don't want this information on our DL parts).

                                     

                                    ----------------------------------------------------------------------------------

                                    Option Explicit


                                    Dim swApp As SldWorks.SldWorks

                                    Sub main()
                                    Dim swModel As ModelDoc2

                                    Dim vComps As Variant
                                    Dim swComp As SldWorks.Component2
                                    Dim swAssy As SldWorks.AssemblyDoc
                                    Dim i As Integer
                                    Dim RetVal As Boolean
                                    Set swApp = Application.SldWorks
                                    Set swModel = swApp.ActiveDoc
                                    Dim lErrors As Long
                                    Dim path As String

                                     

                                    If swModel.GetType = swDocASSEMBLY Then
                                        Set swAssy = swModel
                                        vComps = swAssy.GetComponents(False)
                                        For i = 0 To UBound(vComps)
                                            Set swComp = vComps(i)
                                            path = swComp.GetPathName
                                           
                                            
                                                  If swComp.GetSuppression = swComponentFullyResolved Then
                                                    Set swModel = swComp.GetModelDoc2
                                                    swApp.ActivateDoc2 swModel.GetPathName, True, lErrors

                                     

                                    'The following line calls another macro which also happens to call the BB macro.  Just replace this line with your BB macro location and arguments


                                                    RetVal = swApp.RunMacro("I:\ME\Tooling Standards\Solidworks\Macros\Filename to Desc, TN Parsed - Part.swp", "Macro11", "Main")
                                                    swApp.CloseDoc swModel.GetPathName

                                                     
                                                End If
                                        Next i
                                    End If

                                     

                                    End Sub

                                    ----------------------------------------------------------------------------------------------------------------------------

                        • Overall Stock Size
                          Kelvin Lamport
                          An alternative method is to start the main body of the model with the "stock size" piece of material and then manipulate or "machine" it as you would on the shop floor. The stock size lump xyz dimensions can then be referenced into the customized BOM or anywhere else you require.
                            • Overall Stock Size
                              Phil Marra
                              I have explored the Boundingbox macro, and it has limititations. For my application I am looking for a finished size that will propigate to the BOM.
                              With the BB macro mentioned you get a 3d sketch that generates the xyz values.
                              Works well on parts with planer characteristics but not so with an irregular surfaces which are common in mold design. Also cylindrical parts do not return a diameter by length rather you get a rectangle, but I could live with that.
                              I have requested this enhancement but have never had any luck. To me it seems like everyone could use this feature, a huge time saver. I know that in MasterCam they have just such an animal.
                                • Overall Stock Size
                                  Waylon Ainsworth
                                  I often use driven dimension added to my design table to show the "envelope" size of a piece of plate used to cut out particular shapes and those dimensions are shown in the description column of my BOM. I then use sw mass under configuration specific properties to give the actual weight of the finished piece in the BOM for inventory tracking purposes.

                                  Too bad $sw-mass isn't working correctly in design tables with the latest release.
                                  I hope it's fixed soon.
                              • Overall Stock Size
                                John Lhuillier
                                We have 2 sketches with X,Y, & Z that are in all of our part models with links back to the SIZE custom property. We add relations to these 2 sketches to show material size for the BOM. One of the rows we have it as a diameter and one as a rectangular part and just rename the field to SIZE for our BOM
                                • Re: Overall Stock Size
                                  Jeff Loeffelman

                                  Stock size (LxWxH) custom property created from a dynamic bounding box that updates on rebuild.

                                  I sent in this SR about 2 years ago and I finally received an e-mail the other day from SolidworksSupport that my SR has been updated to an enhancement Software Performance Request (SPR). "What this means is that our development team will be evaluating the enhancement request for possible inclusion in a future release of [Product]." .... So, maybe someday this will be implemented.

                                   

                                    • Re: Overall Stock Size
                                      Aaron Larson

                                      That would be great - thanks for the udpate.  I'm currently working on incorporating the existing bounding box macro into another macro I have that traverses an assembly and add all of my custom properties required for BOM creation (description, finished size, material).  It seems that the bounding box macro won't run because it needs to be called in a part document - not assembly.  This would be a major limitation for the bounding box macro.

                                       

                                      That's great that they're looking at the bounding box function.  I too recently submitted and ER for that.  I think it should act just like choosing "Mass" from the "Text Value/Expression" drop down in the custom property dialog.

                                        • Re: Overall Stock Size
                                          Matt Finley

                                          Perhaps a workaround might be to grab the list of part numbers from your BOM and iterate through all the parts and run that macro on them one. at. a. time. Would take a while but might be something to consider.

                                           

                                          I'm getting ready to do something very similar and am looking for a way to get envelope, mat'l, plating etc into a spreadsheet. Essentially I'll be putting all that data into an 8 digit code for each part number along with costing data and I've got thousands of part numbers to go through.