Updating Project Information Properties

Valued Contributor
Valued Contributor

Hi,

I'm trying to write some code to modify the properties on the Projects tab for a large number of SE files, I have the following code but it doesn't seem to do anything (no errors - but no changes to the properties!), is there something obvious I'm doing wrong? 'Function to set file properties for a Solid Edge document. Dim objPropertySets As SolidEdgeFileProperties.PropertySets = Nothing Dim objProperties As SolidEdgeFileProperties.Properties = Nothing Dim objProperty As SolidEdgeFileProperties.Property = Nothing Dim objMyProperty As SolidEdgeFileProperties.Property = Nothing Try objPropertySets = New SolidEdgeFileProperties.PropertySets objPropertySets.Open("C:\part.par", True) objProperties = objPropertySets.Item("ProjectInformation") objMyProperty = objProperties.Item("Document Number") objMyProperty.Value = "TESTVALUE" objPropertySets.Save() objPropertySets.Close() Finally If Not (objMyProperty Is Nothing) Then Marshal.ReleaseComObject(objMyProperty) objMyProperty = Nothing End If If Not (objProperty Is Nothing) Then Marshal.ReleaseComObject(objProperty) objProperty = Nothing End If If Not (objProperties Is Nothing) Then Marshal.ReleaseComObject(objProperties) objProperties = Nothing End If If Not (objPropertySets Is Nothing) Then Marshal.ReleaseComObject(objPropertySets) objPropertySets = Nothing End If End TryI'm using SE ST3 32bit with MP01 installed on Win7 64bit (I've set the target platform in Visual Studio to x86)Any ideas??

I have also tested the following code to add a Custom Property and this works fine: 'Function to set file properties for a Solid Edge document. Dim objPropertySets As SolidEdgeFileProperties.PropertySets = Nothing Dim objProperties As SolidEdgeFileProperties.Properties = Nothing Dim objProperty As SolidEdgeFileProperties.Property = Nothing Dim objMyProperty As SolidEdgeFileProperties.Property = Nothing Try objPropertySets = New SolidEdgeFileProperties.PropertySets objPropertySets.Open("C:\part.par", False) objProperties = objPropertySets.Item("Custom") objProperties.Add("MyCustomProp", "Test Value") objPropertySets.Save() objPropertySets.Close() Finally If Not (objProperty Is Nothing) Then Marshal.ReleaseComObject(objProperty) objProperty = Nothing End If If Not (objProperties Is Nothing) Then Marshal.ReleaseComObject(objProperties) objProperties = Nothing End If If Not (objPropertySets Is Nothing) Then Marshal.ReleaseComObject(objPropertySets) objPropertySets = Nothing End If End TryAny help greatly appreciated!! Thanks.Alex.

 

Posted by: Alex Lush
Post date: 1/19/2011 2:52:20 AM

6 REPLIES

RE: Updating Project Information Properties

Valued Contributor
Valued Contributor

See the 2nd parameter of the Open method. It's a Boolean readonly flag and you're passing True in the first example.

 

Posted by: Jason Newell
Post date: 1/19/2011 3:12:53 AM

RE: Updating Project Information Properties

Valued Contributor
Valued Contributor

Duh!!! You know that feeling when you've been starring at code so long that you don't see the blindingly obvious!!

Thanks Jason

 

Posted by: Alex Lush
Post date: 1/19/2011 3:17:55 AM

RE: Updating Project Information Properties

Valued Contributor
Valued Contributor

No worries.  We all need a 2nd set of eyes sometimes.  That's what is great about collaboration with colleagues whether it be at work or online.

 

I'm famous for having what I call "Walk away moments".  It usually involves me slamming my headphones down, pounding my fist on my keyboard and cussing as I walk away from my desk for awhile.   Most times I come back with ideas that end up resolving the problem.

 

Posted by: Jason Newell
Post date: 1/19/2011 4:30:34 AM

Highlighted

Re: RE: Updating Project Information Properties

Experimenter
Experimenter

Hello Sir,

 

i'm new to vb script, i too want the same type of script to update the file poperties in project tab, but about this script i think it is prepared in VB.net, i dont know how to edit this, will you please provied the script which is related to the excel vba.

 

Thanks in advance.

Sudheer v

Re: RE: Updating Project Information Properties

@VSudheer,

 

Your request is covered in the Community Examples. 

 

See:  https://community.plm.automation.siemens.com/t5/Solid-Edge-Developer-Forum/Useful-Solid-Edge-Develop...

 

===================================================
Matt Johnson
Solid Edge Certified Professional (ST7 & ST8)
Solid Edge ST9 (SEEC) - Production
NX10 (Tc Integration) Pre-Production Testing
Teamcenter 10.1.6

Re: RE: Updating Project Information Properties

Experimenter
Experimenter

Thanks for your valuable answer and valuable time Johnson.

 

finally i got the code and i have used, works well.