iProperties Project, Title & Description population on Save

G60Dub
Advocate
Advocate

iProperties Project, Title & Description population on Save

G60Dub
Advocate
Advocate

Hi everybody

 

I'm sure something like this has been asked (or a permutation of) a million times before but I'm having trouble conceptualizing what code I need to employ for my particular application.

 

I'm running Inventor 2019 Pro in a Vault environment and I'm having difficulty with certain users not populating Project, Title & Description prior to saving and checking into Vault.  

 

To police or prevent this I'd ideally like to author a single iLogic rule that would incorporate ipt, iam and ipn files and do the following on save:

 

If saving a single ipt or ipn (active document) then prompt for Project, Title & description of blank iProperties.

 

If saving an iam (active document) then prompt for project, title & description (only if blank) & write these to the iam ONLY but also silently write the prompted description to every sub ipt and iam with a blank description that exists in the same workspace path.   As you can imagine wanton prompting for all sub assemblies or parts on saving an iam could prove to be exceptionally frustrating hence the behavior noted above. 

 

I am comfortable with almost all aspects of the coding except for what I expect is the most important in this case - the requirement to navigate or step through the object model which, to date, I have not yet got my head around.  I think I could really leverage my coding if I could get to grips with this.

 

Hence, are there any concrete and well commented examples of object model navigation in the wild for performing this in iLogic?

 

TIA 

0 Likes
Reply
318 Views
1 Reply
Reply (1)

martin_winkler
Advisor
Advisor

Hi @G60Dub

try this iLogic Rule. This is a sample of one possibility. You can start it from your main assembly.

Sub Main
Dim oDoc As Document = ThisApplication.ActiveDocument
Dim oPropSummaryInf As PropertySet = oDoc.PropertySets("Inventor Summary Information")
Dim oPropDesignTracking As PropertySet = oDoc.PropertySets("Design Tracking Properties")
Dim oRefDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments
Dim oRefDoc As Document

If oPropSummaryInf("Title").Value = "" Then
	oPropSummaryInf("Title").Value = InputBox("Title","Forgotten iPropety!")
End If

If oPropDesignTracking("Project").Value = "" Then
	oPropDesignTracking("Project").Value = InputBox("Project","Forgotten iPropety!")
End If

If oPropDesignTracking("Description").Value = "" Then
	oPropDesignTracking("Description").Value = InputBox("Description","Forgotten iPropety!")
End If

For Each oRefDoc In oRefDocs
	Call UpdateProperties(oRefDoc,oPropSummaryInf("Title").Value,oPropDesignTracking("Project").Value,oPropDesignTracking("Description").Value)
Next
	
End Sub

Sub UpdateProperties (oDoc As Document,oPropTitel As String ,oPropProject As String, oPropDescription As String)
oDoc.PropertySets("Inventor Summary Information")("Title").Value = oPropTitel
oDoc.PropertySets("Design Tracking Properties")("Project").Value = oPropProject
oDoc.PropertySets("Design Tracking Properties")("Description").Value = oPropDescription
End Sub

Best Regards