Update iPart Author Table using iLogic

Update iPart Author Table using iLogic

Anonymous
Not applicable
1,679 Views
8 Replies
Message 1 of 9

Update iPart Author Table using iLogic

Anonymous
Not applicable

Hello all,

 

I have a iPart that has a couple of different size members in it. I have iLogic that says when the Length grows, add another hole to the pattern. This code works perfectly on its own.

 

The problem is that the only way to update the member is to manually expand the iPart Table in the browser and click on each member to activate the member and then accept the change in the table (see attached image). After the change has been accepted I can generate my parts.

 

The code below will iterate through each part and generate my members.

 

I need a line of code that tells the table to update, accept the change and then generate the file. Does anyone know if this is possible?

 

SyntaxEditor Code Snippet

ThisDoc.Save

Dim oDoc As PartDocument = ThisDoc.Document 
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition 
Dim initRowIndex As Integer
Dim oFactory As iPartFactory = oDef.iPartFactory
Dim currow As Integer
currow = oFactory.DefaultRow.Index

' Iterate All Rows of iPart
Dim oRow As iPartTableRow
For Each oRow In oFactory.TableRows
	' Generate the member and file, (overwrites member file or creates new file)
	'oFactory.CreateMember(oRow)

	oFactory.DefaultRow = oRow


	oFactory.CreateMember
Next

iLogicVb.UpdateWhenDone = True

 

0 Likes
1,680 Views
8 Replies
Replies (8)
Message 2 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Hoping that below iLogic code to update the value in iPart table. Make sure that proper column name should be updated in code.

Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
    
Dim oDef As PartComponentDefinition
oDef = oDoc.ComponentDefinition
    
Dim oFactory As iPartFactory
oFactory = oDef.iPartFactory

Dim oRow As iPartTableRow
For Each oRow In oFactory.TableRows
    oFactory.DefaultRow = oRow
    oRow.Item("LENGTH").Value = oRow.Item("LENGTH").Value + 1'need to update column name of Length
    oRow.Item("Hole_Number").Value = oRow.Item("Hole_Number").Value + 1 'need to update column name of hole pattern number
Next

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 9

Anonymous
Not applicable

chandra.shekar.g

 

Thank you for replying to my post. The code you supplied works for parameters that are actually in the model. But if I have a parameter in the iPart Table that is a User Parameter, this code doesnt work. Do you know of any work around?

0 Likes
Message 4 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Can you please provide sample iPart file to test? Please make sure that file is non confidential.

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 9

Anonymous
Not applicable

Sure! Please see attached.

 

This example has other iLogic code in it that changes information in the table. But the information in the table only changes if you activate a member and accept the change. As previously mentioned, your code works for Model Parameters, but unfortunately not for User Parameters or Custom iProperties. The columns in the table that need to still change are: Description, ProNumber1 and Venture 7 1.

 

Please let me know if you have any questions

 

--Thanks!

 

 

0 Likes
Message 6 of 9

Anonymous
Not applicable

Looking further into the code you supplied, I dont think it actually works. I am supplying another sample part that has iLogic that controls Model Parameters and User Parameters. If you manually click each iPart member you have to accept the change made to the table from the iLogic.

 

Your code just makes each cell equal to itself. I need code that will make it equal to what the other iLogic rule tells it to be.

 

Please look through this sample part instead and let me know if you have questions.

 

Thanks!

0 Likes
Message 7 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Hoping that suggestions provided in the below blog article may help.

 

http://adndevblog.typepad.com/manufacturing/2013/02/manipulate-rows-and-columns-of-ipart-1.html

http://adndevblog.typepad.com/manufacturing/2013/03/manipulate-rows-and-columns-of-ipart-2.html

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 8 of 9

Anonymous
Not applicable

@chandra.shekar.g,

 

I have read these articles before. This is what makes me believe what I want to do is possible. These articles refer to making an iPart table using VBA. This is not my question. Please refer back to my actual question.

 

My table has already been created using iLogic code. The problem is that I have to manually click on each iPart member for the table to accept the change. 

 

I have supplied a sample part above with all of the code that controls the iPart table. 

0 Likes
Message 9 of 9

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Suppressing prompt while changing iPart member through UI (Manually) is not allowed through API. It is workflow of UI for iPart member change. Please log a wish list at idea station using below link.

 

https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes