7 Replies Latest reply on Dec 11, 2015 2:14 AM by Deepak Gupta

    Document manager API and component names

    Jack Feyes

      Using the document manager API, how can I get the component names in an assembly as they appear in the feature manager tree in Solidworks? For example:



      In order to be useful in my application I need the component names as it is in the component properties within SW.

      How do I get there with the DM API?

        • Re: Document manager API and component names
          Deepak Gupta

          Are you sure you've selected the correct component as two names can not be different.

            • Re: Document manager API and component names
              Jack Feyes

              Thank you for responding.

              Yes I am 100% sure, the excerpt of the debug code is opening the same assembly file as I have taken the component property dialog screen shots from.

              The break point is in the first iteration of the loop so the first component in the list.

              The model file name is a match and the ID is a match. Also there is no component in the SW feature tree with the name returned by the DM API?

              The DM API name is the file name minus the extension.


                • Re: Document manager API and component names
                  Digvijay Taunk

                  It is not the problem of DM API, as I can see the component name is overridden to "EN00|122949", which is different from the physical filename on that location. The overridden component name is only to display in feature manager tree and as I understand DM API works outside SolidWorks GUI, so there is no way you can see the setting for feature tree. The uncheck option of setting shown in image below will allow you to override component name to display in feature tree.

                  External ref option.jpg

                  Now coming to you problem of getting component name, I guess that you can access through traversing feature manager tree only. I am not sure whether is is possible with DM or not.

                    • Re: Document manager API and component names
                      Jack Feyes

                      I would think that the component name whether or not it's overridden, is persisted in the document and hence be the component name no matter the method of access. Why should I not expect the DM component name to actually return the components name?

                      So I believe it is a problem with the API (a bug) that needs correcting. If the property dialog for the component thinks the components name is "EN00|122949" shouldn't any function to retrieve this property get the same value as the property display within Solidworks?

                      Here is a little background of what I need to do:

                      The assembly being referred to here is being created with Solidworks Electrical 3D. When a component is inserted into the assembly it is automatically named according to it's electrical schematic component tag followed by the pipe and then it's bill of material id number as in "EN00|122949". The Solidworks Electrical 2D schematic design part of the software keeps and links a bunch of other information about each component such as manufactures catalog data, our MRP data etc. The problem is the folks at Solidworks didn't provide a way to get to all this data carried by the components from within the 3D environment. I have a requirement that the layout drawings produced from this model have item number ballooning, problem is the item number that needs to appear in the balloon is generated in our MRP system and is one of those data fields attached to the component in the 2D schematic design tool. The solution was to be to write a stand alone application that would parse through the assembly and for each component based on the components name decode the component tag and bill of material id  then using these two pieces of information an SQL query could retrieve the assigned item number and create and set a custom property with the value. Our ballooning setup would be set to use this custom property as it's value. The only way to link the 3D component to the SQL data is through those two pieces of information and the only place that that information is available in the 3D assembly is in the components name.