iLogic oFactory.DefaultRow > Activate next row in table

iLogic oFactory.DefaultRow > Activate next row in table

AntónioMC
Explorer Explorer
345 Views
2 Replies
Message 1 of 3

iLogic oFactory.DefaultRow > Activate next row in table

AntónioMC
Explorer
Explorer

Hi

 

I'm trying to create an iLogic that just activates the next/previous table row in current iPart or iAssembly. Nothing else.

 

I am unable to do the basics.

 

This is my current iLogic code. 

Dim oDoc As PartDocument = ThisDoc.Document 
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition 
Dim oFactory As iPartFactory = oDef.iPartFactory

oFactory.DefaultRow = oFactory.DefaultRow.Index + 1

iLogicVb.UpdateWhenDone = True

 

Any help?

0 Likes
346 Views
2 Replies
Replies (2)
Message 2 of 3

theo.bot
Collaborator
Collaborator
You have to define the row in your code, you where almost there :-).

Dim
oDoc As PartDocument = ThisDoc.Document Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition Dim oFactory As iPartFactory = oDef.iPartFactory Dim oRow As iPartTableRow If oDef.IsiPartFactory Then oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index+1) oFactory.DefaultRow = oRow End If

 

0 Likes
Message 3 of 3

AntónioMC
Explorer
Explorer

Thank you. Worked perfect!

 

What I wanted to do was to create a shortcut to cycle in the iPart table. 

 

Here is a screencast of it working: https://autode.sk/30kkegZ

 

This is the code I have. Any tip to improve the code?

 

'iPart Select Previous

Dim oDoc = ThisDoc.Document

If oDoc.DocumentType = 12290 'kPartDocument
	Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition 
	Dim oFactory As iPartFactory = oDef.iPartFactory
	Dim oRow As iPartTableRow 
	
	If oFactory.DefaultRow.Index = 1 Then Return
		
	If oDef.IsiPartFactory  Then 
		oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index - 1)
		oFactory.DefaultRow = oRow 
	End If
End If

If oDoc.DocumentType = 12291 'kAssemblyDocument
	Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 
	Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory
	Dim oRow As iAssemblyTableRow 
	
	If oFactory.DefaultRow.Index = 1 Then Return
		
	If oDef.IsiAssemblyFactory  Then 
		oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index - 1)
		oFactory.DefaultRow = oRow 
	End If
End If

 

 

'iPart Select Next

Dim oDoc = ThisDoc.Document

If oDoc.DocumentType = 12290 'kPartDocument
	Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition 
	Dim oFactory As iPartFactory = oDef.iPartFactory
	Dim oRow As iPartTableRow 
	
	If oFactory.DefaultRow.Index = oFactory.TableRows.Count Then Return
		
	If oDef.IsiPartFactory  Then 
		oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index + 1)
		oFactory.DefaultRow = oRow 
	End If
End If

If oDoc.DocumentType = 12291 'kAssemblyDocument
	Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition 
	Dim oFactory As iAssemblyFactory = oDef.iAssemblyFactory
	Dim oRow As iAssemblyTableRow 
	
	If oFactory.DefaultRow.Index = oFactory.TableRows.Count Then Return
		
	If oDef.IsiAssemblyFactory  Then 
		oRow = oFactory.TableRows.Item(oFactory.DefaultRow.Index + 1)
		oFactory.DefaultRow = oRow 
	End If
End If
0 Likes