Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

 

Thanks for the reply. My badness: after struggling few hours, I rushed to post for help.

Files are attached here to and code is shown below;

Sub main()
oCust_Prop_Sub()
End Sub

Sub oCust_Prop_Sub()
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

'Look at the model file referenced in the open document
Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
docFile = ThisDoc.ModelDocument
Else
MessageBox.Show("NOT OK, This drawing has no model reference", "iLogic")
Return
End If

'oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'format model file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 

'define the property set
customPropertySet = docFile.PropertySets.Item("Inventor User Defined Properties")

oName_Prop1 = "TOTAL QTY"
oName_Prop2 = "ROLLING_ALLOWANCE"

Dim oCustiProperties_Array As New ArrayList	
oCustiProperties_Array.Add(oName_Prop1)	
oCustiProperties_Array.Add(oName_Prop2)

For i = 0 To oCustiProperties_Array.Count-1
	'look for the custom propety and add it if not found 
	Try
		prop = customPropertySet.Item(oCustiProperties_Array.Item(i))
		MessageBox.Show(prop.Name & ": EXISTS" _
		& vbLf & prop.Name & " (VALUE): " & prop.Value, "CUST PROP")
		oPrompt = "EDIT/ASSIGN DATA"
	Catch
		customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))
		MessageBox.Show(prop.Name & ": ADDED" _
		& vbLf & prop.Name & " (VALUE): " & prop.Value, "CUST PROP")
		oPrompt = "ASSIGN DATA"
	End Try
	prop.Value = InputBox(oPrompt, prop.Name, prop.Value)
Next i
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()
End Sub

Roy Wickrama