Reply
Solved! Go to solution

Document properties unavailable when file is open

Greetings,

   I have noticed that the "Title" property is not available when an assembly is open in SE.  We have an old (c.2007) BOM extractor program that uses the Title property data and it would not function as expected sometimes and closer review showed an empty Title field to be the common thread.  So looking in windows explorer->File properties->Details tab shows the Title field as blank when I know there is data there.  If I look in file properties of the open document in SE envronment the Title data is displayed, but windows explorer will not display that data until I close the assembly. 

 

Is this behavior changed along the way?  We just updated from ST6 to ST9 a couple weeks ago.

8 REPLIES

Re: Document properties unavailable when file is open

Could you show some images of this problem?



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Document properties unavailable when file is open

(view in My Videos)

 

 

Apologies for failing to explain what I'm seeing. I thought a short vid clip might be the most helpful. 

First time screen recording, will do differently next time...

 

I understand that some file properties will be read only when the file is open, but they are not even readable.  I do not recall this behaviour in ST6, but maybe I just never noticed it.

 

Thank you

Re: Document properties unavailable when file is open

This is normal, on my computer the same thing happens.

 

(view in My Videos)

 

Is this hindering the development of some application or automation?



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Document properties unavailable when file is open

Thank you Kabir,

It is hindering, not in development, but in usage of a program I wrote to automate the process of moving data from SE to our EPR system.  The work around is obvious, just close any of the models that are needed.  However, it is a slight nuissance that we need to have the top assembly and all children closed before we run our BOM tool as it enforces that the Title and Document number be populated.  The Document number does not behave this way and I was surprised that some properties are hidden or not returned when the document is open.  Seems that it serves no function to have them hidden, but if that's the way it is supposed to be we'll live with it.

Re: Document properties unavailable when file is open

If you do not want to close the Solid Edge, you can modify the directing properties in active Solid Edge Document.

 

 

You can read / write the properties of each document. You can create a macro to read the properties of the selected documents. The only thing you can not do is move the Solid Edge documents to another folder, or rename them during this process.



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Document properties unavailable when file is open

I will need to watch your tutorial on my lunch break.  So your mention of a macro to read the title while the file is open in SE got me thinking that maybe I am using a less than ideal method to get that file property.  This is all being done in a C# program that does not write to the Title property, only reads it.  I had to look up how I accessed the Title property in my program. 

 

I didn't know how much code to include, but I assume

using SolidEdgeFileProperties;

and

 

title = ((SolidEdgeFileProperties.Property)fileProperties[0]).Value.ToString();

are the significant lines.

 

 

using SolidEdgeFileProperties;

namespace SE_BOM_Extractor
{
   public class PartData
   {
      private const int REV_LNGTH = 2;
      private const string DFT_EXT = ".dft";

      private string title;
      private int layer; // 0 = root asm...
      private int count; // number of instances in parent asembly
      private string[] dftPaths;
      private string partPath;
      private int dftRev;
      private string partCmmnts;
      private string partDocNum;
      private string errors;
      private static int partsCount; //total number of parts in contain

      public PartData()
      {
         title = partPath = partCmmnts =
            partDocNum = "blank";
         layer = count = dftRev = 0;
         errors = "";   
         count++;
         dftPaths = new string[1] {""};
      }

      public PartData(string path)
      {
         dftPaths = new string[1] {""};
         title = "Enter a Title!";
         partCmmnts = "blank";
         partDocNum = "Enter Document Number";  
         layer = count = 0;
         partPath = path;
         errors += GetPartProperties(path);
         count++;

      }

      private string GetPartProperties(string path)
      {
         if( !new System.IO.FileInfo(path).Exists )
         {
            return "Path does not exist";
         }
         PropertySets filePropertySets;
         Properties fileProperties;
         filePropertySets = new PropertySetsClass();
         try
         {
            filePropertySets.Open(path, System.IO.FileShare.ReadWrite);
         }
         catch (System.Runtime.InteropServices.COMException e)
         {
            return e.Message + e.ToString();
         }
         switch (System.IO.Path.GetExtension(path).ToUpper())
         {
            case ".ASM":
               fileProperties = (Properties)filePropertySets[0];
               // propertySets - properties of root assmebly:
               title = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               partCmmnts = ((SolidEdgeFileProperties.Property)fileProperties[4]).
                  Value.ToString();
               fileProperties = (Properties)filePropertySets[4];
               partDocNum = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               break;
            case ".PAR":
               fileProperties = (Properties)filePropertySets[0];
               // propertySets - properties of root assmebly:
               title = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               partCmmnts = ((SolidEdgeFileProperties.Property)fileProperties[4]).
                  Value.ToString();
               fileProperties = (Properties)filePropertySets[5];
               partDocNum = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               break;
            case ".PSM":
               fileProperties = (Properties)filePropertySets[0];
               // propertySets - properties of root assmebly:
               title = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               partCmmnts = ((SolidEdgeFileProperties.Property)fileProperties[4]).
                  Value.ToString();
               fileProperties = (Properties)filePropertySets[5];
               partDocNum = ((SolidEdgeFileProperties.Property)fileProperties[0]).
                  Value.ToString();
               break;
         }
         dftPaths = getDrafts(path);
         partPath = path; 
         return "OK";
      }// end of GetPartProperties method
Solution
Solution
Accepted by topic author bnemec
‎03-27-2017 10:07 AM

Re: Document properties unavailable when file is open

You can create a condition for running this code:
If the Solid Edge document is open, automate using the application (SolidEdgeFramework Application and SolidEdgeAssembly AssemblyDocument etc) as shown in the video.
If not, do it the way you already use it.

 

Below have a example how get active document:

 

// Register
OleMessageFilter.Register();

// Connect your Solid Edge
seApplication = SolidEdgeUtils.Connect(true);

 // Get your Document Collection
seDocuments = seApplication.Documents;

// Get Active Document, in this case, a Part Document
sePartDoc = (PartDocument)seApplication.ActiveDocument;


==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Re: Document properties unavailable when file is open

Thank you Kabir,

   It took me a bit to catch on to what you were geting at.  This will be a nice improvement.