Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - Rename hole description in a Hole Tabele

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
536 Views, 6 Replies

iLogic - Rename hole description in a Hole Tabele

Hi everybody, I have one question

 

I want to edit column "HOLE" with Ilogic

hole table.png

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

 

 

 

 

6 REPLIES 6
Message 2 of 7
rossano_praderi
in reply to: Anonymous

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

 

 



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 3 of 7
Anonymous
in reply to: 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

 

 

Message 4 of 7
rossano_praderi
in reply to: Anonymous

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



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------
Message 5 of 7
Anonymous
in reply to: 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

Message 6 of 7
Anonymous
in reply to: Anonymous

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

Message 7 of 7
rossano_praderi
in reply to: Anonymous

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



--------------------------------------
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
---------------

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report