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: 

Can't change column width in Custom Table

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
Skadborg.NTI
1026 Views, 9 Replies

Can't change column width in Custom Table

If I place a Custom Table (General Table) on an idw, I can easily change column width in the GUI.

According to API-help Column.Width is read/write.

But if I try to set the width in iLogic I get an "unspecified error."

 

Dim oSheet = ActiveSheet.Sheet
Dim oCustomTable = oSheet.CustomTables.Item(1)
oCustomTable.Columns.Item(1).Width=3.0

What is wrong in above code?

9 REPLIES 9
Message 2 of 10
dgreatice
in reply to: Skadborg.NTI

Hi,

 

I try your code, but no error happen.

 

Are you already have custom table in active sheet?

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 3 of 10
Skadborg.NTI
in reply to: dgreatice

File with table and rule attached

Error.png

Message 4 of 10
dgreatice
in reply to: Skadborg.NTI

Hi,

 

im upgrade you code with input field.

 

Dim oSheet = ActiveSheet.Sheet
Dim oCustomTable = oSheet.CustomTables.Item(1)

i = InputBox("Colomn Number?", "Colomn Input")
If i = "" Then
Exit Sub
End If

DefaultWidth = (oCustomTable.Columns.Item(Val(i)).Width) * 10
j = InputBox("Width?", "Input Width", DefaultWidth)

oCustomTable.Columns.Item(Val(i)).Width = (Val(j) / 10)

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 5 of 10
Skadborg.NTI
in reply to: dgreatice

Exact same error. Tried both 2017 and 2018, and on three different machines.

Message 6 of 10
dgreatice
in reply to: Skadborg.NTI

try This,

 

Dim oDwgDoc as DrawingDocument

oDwgDoc = Thisapplication.ActiveDocument

Dim oSheet as Sheet

oSheet = oDwgDoc.ActiveSheet
Dim oCustomTable as CustomTable

oCustomTable = oSheet.CustomTables.Item(1)

i = InputBox("Colomn Number?", "Colomn Input")
If i = "" Then
Exit Sub
End If

DefaultWidth = (oCustomTable.Columns.Item(Val(i)).Width) * 10
j = InputBox("Width?", "Input Width", DefaultWidth)

oCustomTable.Columns.Item(Val(i)).Width = (Val(j) / 10)

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 7 of 10
Skadborg.NTI
in reply to: dgreatice

Hi,

 

Found the problem. It is caused by Windows Regional Settings. If I change to English(USA) it runs without problems.

Message 8 of 10
sellvakumarmech
in reply to: dgreatice

it's working great, but I can't reduce the column width less the length of text(Column titel). when I use column width as 0.1. its returns as text length column width. could you please find a solution to this issue.

oCustomTable.Columns.Item(1).Width = .1

is there any possibility to kill the problem ASAP.

thanks in advance

Selvakumar v

Tags (1)
Message 9 of 10
dgreatice
in reply to: sellvakumarmech

try with comma maybe?

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 10 of 10
sellvakumarmech
in reply to: dgreatice

Hey,

Thanks for your involvement in this.

Based on your idea, I add the comma to the title Text value. but it's now working. instead on that, I have used the new line command. so I believe, it reduces the width of the columns. if you have two or more word sentence as the title I suggest using the new line to reduce the column width as below.

    oTitles(0) = "BRAND" & vbCrLf & "NAME"
    oTitles(1) = "CATALOG NO."
    oTitles(2) = "PART" & vbCrLf & "DESCRIPTION"

maybe I wrong with your idea, kindly drive me in the right direction.

 

Looking for your solution...

Selvakumar V

Tags (1)

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report