I've searched around a bit and could not find what i am looking for. I want to create a database with all the properties of the files on our server. To do so, i would like to write a program that reads the parts and send the data to the database.
I just checked all the SE references I could find (maybe i skipped a couple) and manage to run the following code. It does crash at some point :
Run-time error '-2147467259 (80004005)':
Method 'Value' of object 'IJProperty' failed
Sub GetFileProps() Dim objPropSets As PropertySets Dim objProps As Properties Dim objProp As Property Dim x As Integer x = 1 Set objPropSets = CreateObject("SolidEdge.application") Call objPropSets.Open("C:\PU-B015b.par") For Each objProps In objPropSets Sheets("Sheet3").Range("A" & x).Value = objProps.Name 'For Each objProp In objProps ' Sheets("Sheet1").Range("A" & x).Value = objProps.Name ' Sheets("Sheet1").Range("B" & x).Value = objProp.Name ' Sheets("Sheet1").Range("C" & x).Value = objProp.Value ' x = x + 1 'Debug.Print objProps.Name & ": " & objProp.Name & " = " & objProp.Value ' Next x = x + 1 Next End Sub
The code allows me to get
SummaryInformation : Title, Subject, Author, Keywords, Comments, Template, Last Author, Revision Number and crashes at Total Editing Time.
I would like to read an exposed variable that is in the "Custom" tab of the File Properties, and most importantly, the Material in the Material Table. I can't find out how to get those two properties. I found igMechModelingMaterial under PropertyIDs but i'm not sure it is what i want and how I can access it.
Posted by: Marc Turcotte
Post date: 6/7/2012 7:58:12 AM
I think you're going to want to Dim your application object as a SolidEdgeFramework.Application, and dim the document as a SolidEdgePart.PartDocument. Then, instead of iterating directly over the Part, get the PartDocument object's Properties collection, and go through its Items. Each of those is a SolidEdgeFramework.Properties object, and the one named Custom has two items of type SolidEdgeFramework.Property in the file I'm looking at, named Accuracy and Density.
Under MechanicalModeling, there's a Material, with a Type member that I believe indexes into a material table.
Also, note that the Item method accepts strings, so mypropertysets.Item("Custom") would give you the custom properties collection within the PartDocument properties.
I'm not sure exactly where that error came from. Perhaps you're dynamically trying to invoke the Value property on an object that doesn't expose a Value.
Hope this helps,
Posted by: Jay Carlton
Post date: 6/27/2012 10:46:28 AM
thanks for the reply. I managed to make it work. I will post the code when i will have it finalized a bit more.
Posted by: Marc Turcotte
Post date: 6/27/2012 10:55:53 AM