I have put together some code to execute in excel sheet.
Basically a place to enter revision letter and description fo the rev.
When the button is pressed to execute the macro in excel, it sorts the revisons by letter
and puts the latest revision up at the top and is view on the draft.
Our templates are setup to pull the revision from the R1 associated file on the draft.
I have been able to use newell's code to automate the changing of the revison on the draft
but i want it to also change the revision level on the associated file(s) that are linked to
the draft with the same file name. (.par,psm,asm)
Sub ModifyRevisionNumber(objPropertySets As SolidEdgeFramework.PropertySets)
Dim objProperties As SolidEdgeFramework.Properties
Dim objProperty As SolidEdgeFramework.Property
' Get reference to the ProjectInformation property set.
Set objProperties = objPropertySets.Item("ProjectInformation")
Set objProperty = objProperties.Item("Revision")
objProperty.Value = Cells(3, 1).Value
Set objProperty = Nothing
Set objProperties = Nothing
Any help would be much appreciated.
Solved! Go to Solution.
Access the modellink of your active draft.
Dim objmodellinks As SolidEdgeDraft.ModelLinks
Dim objmodellink As SolidEdgeDraft.ModelLink
then open the part properties using,
Dim AobjPropSets As SolidEdgeFileProperties.PropertySets
objPropSets = CreateObject("SolidEdge.FileProperties")
use objmodellink.filename ( .psm or .par or .asm)
apply your revision value to opened part property.
Make sure part file not opened in active screen. if part file opened, then code will consider it as "Read-only" file.
thanks for you reply
i am very new to working with vba and solid edge.
Can you give me a little more detail as to how to code this?
i get the premise of what you are doing but i am not sure exactly how
to achieve getting the file name of the linked object to the draft file and
then changing its revision.
Here ya go. I also attached the Excel spreadsheet I used in creating the sample.
Option Explicit Sub UpdateModelLinks() Dim objApplication As SolidEdgeFramework.Application Dim objDraftDocument As SolidEdgeDraft.DraftDocument Dim objPropertySets As SolidEdgeFramework.PropertySets Dim objProperties As SolidEdgeFramework.Properties Dim objProperty As SolidEdgeFramework.Property Dim objModelLinks As SolidEdgeDraft.ModelLinks Dim objModelLink As SolidEdgeDraft.ModelLink Dim i As Integer Dim strRevision As String Set objApplication = GetObject(, "SolidEdge.Application") Set objDraftDocument = objApplication.ActiveDocument Set objPropertySets = objDraftDocument.Properties Set objProperties = objPropertySets.Item("ProjectInformation") Set objProperty = objProperties.Item("Revision") strRevision = objProperty.Value Set objModelLinks = objDraftDocument.ModelLinks For i = 1 To objModelLinks.Count Set objModelLink = objModelLinks.Item(i) Call UpdateModelLink(objModelLink, strRevision) Next Set objModelLink = Nothing Set objModelLinks = Nothing Set objProperty = Nothing Set objProperties = Nothing Set objPropertySets = Nothing Set objDraftDocument = Nothing Set objApplication = Nothing End Sub Sub UpdateModelLink(objModelLink As SolidEdgeDraft.ModelLink, strRevision As String) Dim objPropertySets As SolidEdgeFileProperties.PropertySets Dim objProperties As SolidEdgeFileProperties.Properties Dim objProperty As SolidEdgeFileProperties.Property Dim strFileName As String strFileName = objModelLink.Filename Set objPropertySets = New SolidEdgeFileProperties.PropertySets Call objPropertySets.Open(strFileName, False) Set objProperties = objPropertySets.Item("ProjectInformation") Set objProperty = objProperties.Item("Revision") objProperty.Value = strRevision Call objPropertySets.Save Call objPropertySets.Close Set objProperty = Nothing Set objProperties = Nothing Set objPropertySets = Nothing End Sub
I have been working with programming SE with VB.Net for a few months. For an application I am designing, I need to access the date on which a part was created. I have been pulling info from a custom properties date field but this date is not acurate. (The date I am pulling does not get updated with new part number generation).
I would like to be able to get the following property but do not know the strings to put into the Item property.
This is what I tried and I couldn't find anything to point me in the right direction for non-Custom property fields.
objProperties = objPropertySets.Item("General") objPropertytitle = objProperties.Item("Created")
Thanks for your help,
the file creation and last modified date are part of the standard windows file attributes and not of any file properties. You may use the .Net FileInfo object to access the date information.