Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
maxim.teleguz
in reply to: gconley

I Found a better method, hint: pay attention to errors and use them. 

 

'can use in drawing or model or part, doesnt matter

Try
	If (ThisDrawing.ModelDocument Is Nothing) Then Return
		modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
Catch
		modelName = IO.Path.GetFileName(modelName)
End Try

Try
	If iProperties.Value(modelName, "Custom", "Ref. Number") = Nothing Then
	'if not exist causes error
	End If
Catch
	'create it
	iProperties.Value(modelName, "Custom", "Ref. Number") = ""
End Try