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

Hi Alan,

 

I am sorry to be a pain, but I have converted everything over to where it should be in terms of the large excel file and put the parts in where they should be and it does not seem to work. I have tried to add debugging into the rule to make sure it is looking at the correct place for which it seems to but it is not replacing parts at all. This is confirmed by looking at the iproperties. Have I done something wrong?

 

Dim AsmDoc As AssemblyDocument = ThisDoc.Document
Dim CompDef As AssemblyComponentDefinition = AsmDoc.ComponentDefinition

Dim ExcelFileLocation As String = "**************End Suction Pump Drawings\Pumps\Pump_Layout_Spreadsheet.xlsx"

'Automatic setting of Pump Model. 
MultiValue.List("PumpModel") = GoExcel.CellValues(ExcelFileLocation, "Sheet1", "A2", "A250")

'Intial List creation to ensure list is not blank on creation.
If PumpModel = "" Then : PumpModel = MultiValue.List("PumpModel").Item(0) : End If

Dim PumpModelRow As Integer = GoExcel.FindRow(ExcelFileLocation, "Sheet1", "Pump Model", "=", PumpModel)
Logger.Debug(PumpModelRow)
For Each Occ As ComponentOccurrence In CompDef.Occurrences
	
	Dim Path As String = System.IO.Path.GetDirectoryName(Occ.Definition.Document.FullFileName)
		Logger.Debug(Path)
	
	Select Case Occ.Name
	
	Case "Volute" 
		Try
			Occ.Replace(Path & "\Volutes\" & GoExcel.CurrentRowValue("Volute"), False)
			VoluteModel = GoExcel.CurrentRowValue("Volute")
'			Logger.Debug(VoluteModel)
		Catch
		End Try
		
	Case "Bellhousing" 
		Try
			Occ.Replace(Path & "\Bellhousings\" & GoExcel.CurrentRowValue("Bellhousing"), False)
			BellhousingModel = GoExcel.CurrentRowValue("Bellhousing")
'			Logger.Debug(BellhousingModel)
		Catch
		End Try
		
	Case "Motor" 
		Try
			Occ.Replace(Path & "\Motors\" & GoExcel.CurrentRowValue("Motor"), False)
			MotorModel = GoExcel.CurrentRowValue("Motor")
'			Logger.Debug(MotorModel)
		Catch
		End Try
		
	End Select
	
Next