I'm pretty new to SE programming, but am experienced at SQL, VB.NET and VBA programming.
I have been assigned the task of creating a logistics management system to organize the way our business designs, orders and ships out parts for our projects. Our engineers use SE v20 (soon to upgrade to ST3) for design before they send off to our fabricator.
I have created a SQL Server 2008 database for the backend using some MS Access forms for the frontend - the model is still in development in part because I need to determine exactly what I can glean from the part/assembly files from SE.
I was thinking if I could have the engineer point the DB at a part file, having Access (the DB front end) read the file properties and populate tables in the database would be a good start (VBA programming).
Does anyone have experience with this? Am I barking up the right tree? Any help/advice on where to start would be greatly appreciated.
Posted by: Chris Bloom
Post date: 5/25/2011 3:52:24 AM
From VBA, you can "Add Reference" to the "Solid Edge File Properties Object Library". From there, you create an instance of the PropertySets object and call the Open() method to read a file. This API is lightweight and does not automate full Solid Edge. I would imagine that there are some examples in these forums and Developer Conference Material (2005 - 2007).
Posted by: Jason Newell
Post date: 5/25/2011 1:39:04 PM
OK - thanks. I did what you said, and I'm able to get it to work! A couple problems with the "Total Editing Time" and "Last Print Date" properties - for some reason they are failing, but when I test for them and filter them out, everything seems to work fine.
I specifically now want to look at assemblies - and how to list all the "children" parts of an assembly.
Thanks for the help. I'll take a look at your materials.
I'll go ahead and post my VBA code here (for future users) for a Function in a module that will return the properties of a part. I'm using Access 2010, but also tried in Excel 2010 and it works there too.
Public Function GetFileProperties(PartFile As String) As SolidEdgeFileProperties.PropertySets'Returns in the debug window all file properties that are NOT NULL, ZERO or'empty string (as a value) of a specific part.Dim objPropSets As SolidEdgeFileProperties.PropertySetsDim objProps As SolidEdgeFileProperties.PropertiesDim objProp As SolidEdgeFileProperties.PropertyDim strDocName As StringSet objPropSets = CreateObject("SolidEdge.FileProperties")'Get the FilestrDocName = CStr(PartFile)objPropSets.Open (strDocName)'Loop thru the property set through each of the property categoriesFor Each objProps In objPropSets 'Loop through each property of the category For Each objProp In objProps 'For some unknown reason, the API returns an error on the following three Properties... 'In order to get this to work, I had to test and filter out these three properties If objProp.Name = "Total Editing Time" Or objProp.Name = "Last Print Date" Or objProp.Name = "Origination Date" Then 'do nothing Else If objProp.Value = 0 Or objProp.Value = Null Or objProp.Value = "" Then 'do nothing Else Debug.Print objProp.Name, " = ", objProp.Value End If End If NextNextSet GetFileProperties = objPropSetsobjPropSets.CloseEnd Function
Posted by: Chris Bloom
Post date: 5/26/2011 3:19:55 AM