40 Replies Latest reply on Dec 16, 2016 10:26 AM by Elmar Klammer

    linking feature tree item to custum properties?

    James Kashuba

      Hey Folks,

      Perhaps an odd request, but it there a way to link a tree feature, in a part, to the custom properties so that is can be called out on a drawing in a parts list (BOM)? I'm looking for it to function like that of an assembly with a BOM on the drawing calling out all the parts. Our company wants to track its raw material usage by placing the raw stock part into a part file and then have it called out on the drawing. So it is a part in a part with a one item BOM. I disagree with that idea, but it is what they want.

       

      I am open to other ideas on how to do this, but what I was thinking is some how have some script in the custom properties that would capture a part file in the feature tree of the part and call it up in the evaluated value. Then I could pull that into a BOM or table on the drawing.

       

      Hope that's descriptive  enough,

      Jim

        • Re: linking feature tree item to custum properties?
          John Stoltzfus

          You can easily setup a custom property in the Custom Property Tab Builder for what you need to do, it wouldn't be a part within a part, it would be additional information tied to the part, do it every day.....

          • Re: linking feature tree item to custum properties?
            Nilesh Patel

            Hi James,

            Are you planning to create a dummy body in the part using bounding box details and give it some name and then use this body details in the drawing?

             

            Could you attach a dummy part?

             

            Regards,

            • Re: linking feature tree item to custum properties?
              Solid Air

              I do not believe I understand what you are trying to do but you could make all your parts into weldments and your raw material would be in the <As Welded>.  You could use an indented BOM with a detailed cut list.  I realize this idea cannot even find the wall so I cannot even consider it an off the wall idea.

              • Re: linking feature tree item to custum properties?
                Deepak Gupta

                I do not see any direct option to grab the feature name and link to custom property value. So macro would be the final resource. A macro feature would be much better but I'm not sure how to do that.

                • Re: linking feature tree item to custum properties?
                  Mr Omkar Deshpande

                  i am not sure, i understood what u mean. But is this what u want?

                    • Re: linking feature tree item to custum properties?
                      Deepak Gupta

                      I think here is what James looking for

                       

                        • Re: linking feature tree item to custum properties?
                          James Kashuba

                          Thanks Everyone!

                          Sorry for not being clear enough. This is a little confusing. Typically, our material is called out in our custom properties and that property is linked and called out on our drawings in the title block. This has always worked in when dealing with our vendors. However, we are going to make a few small items in-house, and the material used will now get a part number in our system. Our administrators want a relationship to the parts with in our system so they can create a BOM from the finished part.

                           

                          So what it will be like is this: the raw material will have an actual size and a part number. That "part" will be the "base part" of all parts that use that specific material. Deepak, you are on the right track. How does the macro recognize and distinguish a part from a feature in the feature tree?

                          The .375 x 39 will have its own part number, and that part number will be called out on the drawing as material.

                           

                          Hope that's clearer,

                          Jim

                            • Re: linking feature tree item to custum properties?
                              Solid Air

                              What will the completed BOM look like?  Right now, I think making your part into a weldment and importing the custom properties from your inserted part would work.  What version of SolidWorks are you using?

                              • Re: linking feature tree item to custum properties?
                                Nilesh Patel

                                Hi James,

                                 

                                As per the image below, in your material part ".375 x 39 INCH, ROUND BAR" add a custom property "Material" and link it to "SW-FileName". I believe you already have a "Part No" custom property.

                                 

                                When you insert this material part into your design part e.g. Test Pin, make sure that "Custom Properties" check box is checked. (see image below).

                                 

                                and this is what the custom properties will look like for "Test Pin". Now you can link "Material" and "Part No" to your drawing title block.

                                This way both of these properties will be linked to your material part. If you ever change the name of the material or material part no, it will be always linked in all your new designed parts. You don't need a macro to do this.

                                 

                                Hope this helps.

                                 

                                Regards,

                                  • Re: linking feature tree item to custum properties?
                                    James Kashuba

                                    Good morning All,

                                    I thought Nilesh had the solution, but by using his method it overwrites existing properties in the new part. I thought about renaming the properties, but then that would led to mapping problems in our PLM system. In my original post I was looking to have a BOM like table on the finished part, but the more I thought about that the more I realized there is no need to do that, even though our BOM group wants me to do that.

                                     

                                    If the base part has its own part number than all that needs to be done is to have that part number populate the materials block on the title block of the drawing. There is still the need to capture the part number of the base part and apply that to the materials callout like Deepak illustrated.

                                      • Re: linking feature tree item to custum properties?
                                        Nilesh Patel

                                        Hi James,

                                         

                                        I agree with Jesse and therefore we use works order system at my work.

                                         

                                        When you say ' it overwrites existing properties in the new part', what properties are they, could you attach a screenshot of custom properties of your new part, if it is not a problem. I believe that the solution I provided you gets both the name and the part number of the base part as required and illustrated by Deepak.

                                         

                                        Regards,

                                          • Re: linking feature tree item to custum properties?
                                            James Kashuba

                                            Good Morning Nilesh,

                                            You are correct, it does get the part number of base part. However, in doing so it overwrites the existing part number in the custom properties. Both parts have a part number in their the custom properties. What needs to happen is the part number from the base part needs to populate the materials property in the new formed part. By doing this the part number from the base part will show on the drawing in the materials block, and the part number of the formed part will show up in the part number block on the drawing.

                                             

                                            I think the only way to do this is with a macro, but I don't even know where to begin. I wish there was some type of script code I could use like $PRP:"SW-File Name" that captures the file name in the custom properties, but instead it captures the base part's name because its name will be the part number.

                                              • Re: linking feature tree item to custum properties?
                                                Nilesh Patel

                                                Hi James,

                                                 

                                                I am slightly struggling to understand this: "What needs to happen is the part number from the base part needs to populate the materials property in the new formed part.".

                                                 

                                                Could you attach screen shots of custom properties of Base part and Formed Part? Could you change base part custom property "Part No" to "Base Part No" or something like that.

                                                 

                                                Regards,

                                                  • Re: linking feature tree item to custum properties?
                                                    James Kashuba

                                                    Good morning Nilesh,

                                                    Like I previously mentioned, it is an odd way of doing this. Although I think it is straight forward in concept, it is quite another to make it work. Here is a screen shot of how it should look and function.

                                                     

                                                    This is what base part should look like:

                                                    Notice that it has its own part number and material property.

                                                     

                                                    This is the derived part or semi-finished part made for the base part:

                                                    Notice this is a part in a part. The base part should feed the material's property in the custom properties. The file name of the base part is its part number.

                                                     

                                                    Now when that part goes onto a drawing it should look like this:

                                                    In this case everything would be automated. John suggested a macro that overwrites property values but if each engineer had to do this I think it would cause confusion. The easiest way "if it could be done" is to have a macro capture the name of the base part and apply that value to the material properties in the derived part.

                                                     

                                                    I hope that clears up any confusion,

                                                    Jim

                                                      • Re: linking feature tree item to custum properties?
                                                        John Stoltzfus

                                                        Even though you link it to the name "Material" it would need to be a different Custom Property then the SW-Material - I would recommend that you would use a custom property named "Raw Material" or something like that.  Materials are normally a physical mass of Stainless Steel, Glass, Wood etc... 

                                                         

                                                        As for the macro causing confusion, I really feel it could be a straight up way of reading the information, (by selecting the "Read" button), (STK10001) into the Excel spreadsheet and in that spreadsheet you would link that column to another and the header of that column would be "Raw Material", then all the that needs to be done is hit the "Write" button and it would push the "Raw Material" data where it belongs, you open the drawing and there it is. 

                                                         

                                                        If you're really interested in a macro, it sounds like you would need a Custom Macro and there are guys that offer those services for a fee, contact Keith Rice or some of the other guys on the forum, check the API section of the forum...

                                                          • Re: linking feature tree item to custum properties?
                                                            James Kashuba

                                                            Thanks John,

                                                            At this time we are not using the "SW-Material", rather just "Material" so there is no link to the mass properties. I have been fighting for years to create a custom material database that would be linked to our custom properties, but have not been successful. Especially from a FEA perspective. Concerning the macro, the problem is getting all the engineers on board. We have lots of engineers, but they have almost no experience with API. In fact, I am one of the few that even use macros. So if I presented that to them they may loathe the idea, but I am going to try anyway

                                                              • Re: linking feature tree item to custum properties?
                                                                John Stoltzfus

                                                                Either way - it will be a new workflow and with a bunch of stubborn die hard's even that can be tough, do they actually care if it takes more time to type it individually.... 

                                                                James Kashuba wrote:

                                                                . We have lots of engineers, but they have almost no experience with API. In fact, I am one of the few that even use macros. So if I presented that to them they may loathe the idea, but I am going to try anyway

                                                                 

                                                                Tough one

                                                            • Re: linking feature tree item to custum properties?
                                                              Nilesh Patel

                                                              Hi James,

                                                               

                                                              Now I get the full picture of what you are trying to do. As both parts have same custom properties, one will override other's. I guess in this case you would probably need a macro to read the name of the base part. Try following macro.

                                                               

                                                              Open a new macro in SolidWorks, delete everything and paste the contents from the macro attached. I have tried it and works OK. Let me know how you go.

                                                               

                                                              Regards,

                                                                • Re: linking feature tree item to custum properties?
                                                                  James Kashuba

                                                                  Nilesh,

                                                                  thank you, that worked - with a but - LOL. When I first ran the macro it didn't do anything. Then I deleted the Material property and reinstated it. Once I reinstated the property the macro worked. So I started playing with it by deleting the text expression that the macro populated. After doing so, the macro would not get the expression a second time. So I deleted the Material property again and reinstated it. After doing so, it worked again. I seems to work in one shot only and is not repeatable. I looked at the code and there doesn't seem to be anything that makes it behave like that. It is a good foundation that I could probably build on.

                                                                   

                                                                  You Guys in this Forum are the best! I have never been let down!

                                                                  Thank you!

                                                                    • Re: linking feature tree item to custum properties?
                                                                      Nilesh Patel

                                                                      Hi James,

                                                                       

                                                                      I have tried the macro my end and it works OK. You need to close the custom property dialog box for macro to work. If you keep the dialog box open, then macro won't add or update the value. I also made the assumption that your formed part has a  custom property 'Material'. If you try to run the macro in a part which doesn't have 'Material' custom property then you will get an error message.

                                                                       

                                                                      Could you also add a line in the macro: sBasePartName = ""

                                                                       

                                                                      Add this line inside the sub main (may be before 'Set swApp = Application.SldWorks'), this will initialise the value of 'sBasePartName ' to empty string every time you run the macro. I have added this variable so that if you run the macro in a part which doesn't contain the base part, then it will give you an error message.

                                                                       

                                                                      Hope it is clear now.

                                                                       

                                                                      Let me know if you still have a problem.

                                                                       

                                                                      Regards,

                                                                    • Re: linking feature tree item to custum properties?
                                                                      Nilesh Patel

                                                                      Hi James,

                                                                       

                                                                      Replace following lines:

                                                                      If swModel Is Nothing Or swModel.GetType <> swDocumentTypes_e.swDocPART Then

                                                                              swApp.SendMsgToUser2 "Open or activate part document.", swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk

                                                                              Exit Sub

                                                                      End If

                                                                       

                                                                      With these lines:

                                                                      If swModel Is Nothing Then

                                                                              swApp.SendMsgToUser2 "No document open. Open part document.", swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk

                                                                              Exit Sub

                                                                      ElseIf swModel.GetType <> swDocumentTypes_e.swDocPART Then

                                                                              swApp.SendMsgToUser2 "Open or activate part document.", swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk

                                                                              Exit Sub

                                                                      End If

                                                                       

                                                                      Previous lines will show an error and will take you into debug mode if the macro is run when no document is open.

                                                                       

                                                                      Regards,

                                                  • Re: linking feature tree item to custum properties?
                                                    Jesse Seger

                                                    I've seen this request come up many many times.  And I worked for a company that implemented something very similar.  However, after years of fighting this, we realized that specifying raw material part numbers on the drawing is a very bad way to go in many cases. 

                                                     

                                                    For example, if I specify the part number for our 1/4" 4'x8' Steel sheet to create my lasered part, if might seem like I've solved my manufacturing and inventory problem for good.  I've told the laser guy what material to use and I've told the PLM system to deduct that amount from inventory.  However, what if the production manager wants to use a bunch of 5'x10' sheets of the same grade he has laying around?  The 5'x10' sheets certainly have a different part number, but will work just fine.  Now I've created several problems.  First, my drawing is no longer relevant.  Next, my BOM in my PLM system needs a deviation.  Finally, I'm really confusing the history of this part unless I document all the changes that production is causing.

                                                     

                                                    So to eliminate the problems that production is causing upstream, I would not impose direct restrictions on production.  Rather, utilize the work order or picklist mechanism in your PLM system.  This will allow production to use the part number and/or revision that is best suited for the current run.  A production manager could then edit the work order if he needed to.  Then you'll have a documented history of the raw material that is being used.  You may be able to create a script or custom software to automatically set the work order raw material based on a custom property in the item card.

                                                     

                                                    What if the raw material part is semi-finished inventory?  The same idea holds.  You specify the piece you need by a defined nomenclature that your company agrees on so to reduce the ambiguity as much as practically needed.  Maybe it's the length and diameter and material grade.  This should be enough for you production manager, PLM system, or some script to determine the desired part number of the work order.

                                                     

                                                    I know this is different than your original question, but it's sometimes nice to look at it from a different perspective.  You can take it or leave it.

                                                      • Re: linking feature tree item to custum properties?
                                                        James Kashuba

                                                        I agree with John: Well Said!

                                                        I do not agree with what I'm being asked to do, but there are too many chiefs and I'm only one indian. Although our situation is a little different, at least at this time. Currently we are not purchasing full raw, rather partially finished items such as laser cut plates and sized rods that are being inventoried in that state. They become our raw part number, then after being bent or tapped or whatever, they get another part number. Yeah, this is a cluster, I have also been assigned to reverse model them. Some parts are easy, but the sheet-metal parts are making my hair fall out because of all the features in them. :-(

                                                          • Re: linking feature tree item to custum properties?
                                                            Jesse Seger

                                                            Yup, I know exactly what you are talking about.  Making one part into another part.  I'll make one last comment before I try and consider a way to solve your issue because it would appear you are not the only person who goes through this.  It seems like a natural progression of small/medium manufacturing companies who are trying to organize and streamline things.  However, they are mixing up product information with production information.

                                                             

                                                            The chiefs have resolved that the solution resides with engineering because the engineering department knows the most about the part, and probably the production too.  Not only that, but SOLIDWORKS is great at lettings us design just as we would build it.  So it seems natural that the problem and solution lie within the engineering department.  As I said earlier, it is not a problem with engineering.  You've designed the part and you don't care what they make it out of, that is until you put your manufacturing engineer hat on.  When you have the manufacturing hat on, you must solve manufacturing problems with manufacturing solutions.  Not engineering solutions.  Even though your engineering hat is sitting right there on your desk, you must refrain from picking it up.  Your engineering hat is for maintaining the integrity of your drawings and not letting manufacturing engineer mess them up.

                                                             

                                                            Imagine if you sent the drawing to another vendor to manufacture?  It's not that far-fetched.  You're already purchasing half-finished goods.  I certainly wouldn't make it out of your semi-finished parts specified on the drawing.  I'd have my own process, maybe very similar to yours, but my own none-the-less.

                                                             

                                                            So how can we communicate our intentions downstream without messing up the integrity of our drawings?  Well, one idea is to have an engineering release process through PDM.  This could allow you to complete a form that specifies the intended material or part to use and generates the appropriate documents and sends the correct information to your PLM system.  It could also list the used part in the bill of materials where you could edit the exact quantity required.

                                                             

                                                            Capture.PNG

                                                          • Re: linking feature tree item to custum properties?
                                                            Elmar Klammer

                                                            I would second Jesse's approach. Using a specific raw-material and inserting parts into parts is setting yourself up for failure. Guaranteed.

                                                            Anyone open to look at the pro's and con's would come to the same conclusion. You not only over-complicating a simple task
                                                            of populating material ID's but you also dictate how you have to model your finished component.

                                                            Nothing but red flag's throughout this whole idea. You're better off investing you energy in educating the people you work with or for instead of sheepishly following the blind herd.

                                                            I think as a society in general we tend to do the latter. Courage to stand up for something and developing the skill to get people to understand is what will get you ahead in a situation like this. Granted you can provide objective, measureable sound reason to support your solution. And if you are facing a situation dictated by ignorance, well there is a way to deal with that to. Have the person in charge put their name on it, in writing. If there solution works, great. If it doesn't, great too. Someone with a name owns this decision. And if this name pops in the wrong way often enough, well guaranteed something will change. In the worst case, the company goes out of business. That's one way to solve your task too.

                                                          • Re: linking feature tree item to custum properties?
                                                            John Stoltzfus

                                                            There is one way that may work for you..  But you will need to get creative to make it work...

                                                             

                                                            Attached is a macro written by Markku Lehtola - (you will need to change the custom property headers etc..).  Close all part, assembly and drawing files for that folder prior to selecting the "Read" button.  This macro reads an entire folder, so the parts used in a project need to be in one folder.  After you read all the custom properties in the part files and the are populated to the spreadsheet then add another column and use that to formulate the final property you want and then write that custom property back to the part files.  I think that would be really easy to do, but like I said you need to read the info and then take that info and have it combine and overwrite a custom property...

                                                            • Re: linking feature tree item to custum properties?
                                                              Bill Toft

                                                              What about using derived configurations for the part?

                                                              The base configuration ("Default" renamed to "Base") will be the purchased/raw material and will have its own part number assigned ($PRP:"BasePartNo").

                                                              Then create a derived configuration to add all the features needed for the finished part. Give it its own configuration-specific part number ($PRP:"PartNo")

                                                              You can use Property Tab Builder to ensure consistent entry of the numbers.

                                                              • Re: linking feature tree item to custum properties?
                                                                Tony Cantrell

                                                                Why not create your raw mat'l or base part as is, then start a new part and insert your base part and make your modifications.

                                                                • Re: linking feature tree item to custum properties?
                                                                  Elmar Klammer

                                                                  Just a heads up on your approach. I just did a quick test with two parts downloaded from the web. Open part 1 and try to add the Custom property "Material"..

                                                                  you won't be able to or at least I wasn't with 2016 sp5. When I originally inserted the part BlRo I had the option "import custom properties" checked. Then I edited the feature and unchecked the same options. The issue is that SW won't let you add a custom property that exists in the linked file. You can open the linked part itself and delete the custom property "Material" there. Now SW will allow you to add it in part 1. That however is a bug. As Solidworks locks by default locks all "linked to parent part" properties but seems to not release that lock when the option "import custom properties" is deselected.

                                                                   

                                                                  See also the post below.

                                                                  Unchangeable fromparent+ custom properties mirrored assemblies or parts

                                                                  This and other associate issues have been around for a long time spanning various SW major releases. The nature of this functionality is volatile and unreliable and doesn't lend it self to a reliable design practice. Or maybe I just happen to come across the only few bugs this functions has every time I test it.

                                                                  Imagine, if you were to base you whole modeling on some sketchy functionality. You just added a ticking time bomb as the base feature for all your parts.

                                                                   

                                                                  If I was you, I would test the living daylight out of your chosen workflow before implementing it into a life project.