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

Here  is some changes removing the ilogic snippets for iproperty and parameters for API versions. The tolerances retrieval may not be correct, so maybe check that section and test.  

Dim myList, mySelect As New ArrayList
Dim Instalacao

TolMax = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
TolMin = InputBox("Qual a tolerância superior do diâmetro de passagem do parafuso?", "Tolerância Superior")
myList.Add("Cemented")
myList.Add("Screwed")
myList.Add("N/A")
myList_selected = InputListBox("Cimentado, Parafusado ou N/A?", myList, myList(0), Title := "Selecione abaixo", ListName := "List")
mySelect.Add(myList_selected)
For Each Instalacao In mySelect
'	MessageBox.Show("Arquivo .txt gerado com sucesso! Todos os itens foram definidos como: " & Instalacao, "Sucesso!")
Next

oWrite = System.IO.File.CreateText(ThisDoc.Path & "\" & "VerificarConexoes" & ".txt")
Dim oDoc As Inventor.Document

For Each oDoc In ThisApplication.Documents.VisibleDocuments
	If oDoc.DocumentType = kAssemblyDocumentObject Then
		Dim oAssyDoc As AssemblyDocument = oDoc 'Declare as either an assembly or part to gain access to object collections. 
		Dim Params As Parameters = oAssyDoc.ComponentDefinition.Parameters
		Dim opn As [Property]
		opn = oAssyDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number")
		
		Try
			item = opn.Value.ToString   'cannot use ilogic snippet which is only valid in document the rule is ran from first 'iProperties.Value("Project", "Part Number")
			A = Params("Ap").Value' Value returned in system units cm   'Parameter("Ap")
			Emax = Params("DIA") + TolMax
			Emin = Params("DIA") - TolMin
			B = Params("B")
		Catch
		End Try
			oWrite.WriteLine(item & ";" & Round(A, 2) & ";" & Round(B, 2) & ";" & Round(Emax, 2) & ";" & Round(Emin, 2) & ";" & Instalacao)
	End If
Next

oWrite.Close()

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan