Hi everybody, I have one question
I want to edit column "HOLE" with Ilogic
I need code like this:
If Row = "Ø3x2" in DESCRIPTION column Then write Row = "A1" in HOLE column
I found this thread: https://forums.autodesk.com/t5/inventor-forum/rename-holes-in-a-hole-tabele/td-p/5420234
but there is only the numbering of the rows there.
I cant read Descriprion property with use this function: HoleTableRow.ReferencedHole () As Object
Here are my holes:
A1 - Ø3x2 B1 - Ø5x12 B2 - Ø5x32 B3 - Ø5 - through B4 - Ø5x20 B5 - Ø5x34 C1 - Ø8x12 C2 - Ø8x25 C3 - Ø8 - through D1 - Ø15x12 D2 - Ø15x18 D3 - Ø15x20 E1 - Ø35x10
Solved! Go to Solution.
Solved by rossano_praderi. Go to Solution.
Hi,
with reference with the thread which you refer in your post, replace ""oHoleRow.HoleTag.Text" with "oHoleRow.Item(ColumnIndexBase1).Text" to get access on every column of holetable.
In your case "ColumnIndexBase1" = 2 and for "Quantity" = 3
See this link as reference.
Bregs
Rossano Praderi
Thank you very much for your help!
This code works well with the Column3 (Quantity)
But I need change Column1 if Column2 ="text" in my case "Ø3x2"
Now iLogic return me error: "Conversion from string "Ø3x2" to type 'Double' is not valid."
oDrwDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim i As Integer oSheet = oDrwDoc.ActiveSheet Dim oHoleTables As HoleTables oHoleTables = oSheet.HoleTables Dim oTable As HoleTable Dim oTableRow As HoleTableRow Dim oTableRows As HoleTableRows For Each oTable In oHoleTables For i = 1 To oTable.HoleTableRows.Count If Len(oTable.HoleTableRows.Item(i).Item(2).Text) = "Ø3x2" Then oTable.HoleTableRows.Item(i).Item(1).FormattedText = "A1" End If Next Next
Can anyone help me, please.
Thank you in advance
Hi,
if you would like to change only the text value as a simple text the use "Text".
Use "FormattedText" when you would keep/assign the format.
oTable.HoleTableRows.Item(i).Item(1).Text = "A1"
Bregs
Rossano Praderi
Thanks, is better:
oDrwDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim i As Integer oSheet = oDrwDoc.ActiveSheet Dim oHoleTables As HoleTables oHoleTables = oSheet.HoleTables Dim oTable As HoleTable Dim oTableRow As HoleTableRow Dim oTableRows As HoleTableRows For Each oTable In oHoleTables For i = 1 To oTable.HoleTableRows.Count If oTable.HoleTableRows.Item(i).Item(2).FormattedText = "Ø3x2" Then oTable.HoleTableRows.Item(i).Item(1).FormattedText = "A1" End If Next Next
but it still does not work with my Column2 - in my HoleTable it's written like this:
Ø<HDIA>x<HDPT>
I can't read: "<HDIA>", "<HDPT>" and sign "Ø" to use If functions.
Can anyone help me, please.
Thank you in advance
I got it:
oDrwDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet Dim i As Integer oSheet = oDrwDoc.ActiveSheet Dim oHoleTables As HoleTables oHoleTables = oSheet.HoleTables Dim oTable As HoleTable Dim oTableRow As HoleTableRow Dim oTableRows As HoleTableRows 'Dim oPR As HoleProperty 'Dim A11 As String = oPR.HolePropertyID(77581) 'A11 = "3" For Each oTable In oHoleTables For i = 1 To oTable.HoleTableRows.Count If oTable.HoleTableRows.Item(i).Item(2).Text = ("n"&"3"&"x"&"2") Then oTable.HoleTableRows.Item(i).Item(1).FormattedText = "A1" End If Next Next
Thank you very much Rossano Praderi
You are welcome.
And if you like to make your code short...
For Each oTable In oHoleTables For Each oTableRow in oTable.HoleTableRows If oTableRow.Item(2).Text = ("n"&"3"&"x"&"2") Then oTableRow.Item(1).FormattedText = "A1" End If Next Next
Bregs
Rossano Praderi
Can't find what you're looking for? Ask the community or share your knowledge.