V19 Table Functionality

Is any one familiar with the new V19 tables and what can be done with them. It appears that the intent of the tables and what is included OOTB is not quite up to the expectations set at the PLM World presentation. It appears (without custimization) that the attributes are not available to populate columns in this release. Looks like we'll need to wait and see what happens in V20.

 

With that in mind, what I wanted to do is consolidate some of our information on our drawing borders and hopfully be able to text wrap info for revision history and have formating available with carriage returns to "bulletize" lists or something like that. If this was available, like the "comments" property, then we'd be able to do away with an imense number of custom attributes we now carry in each file.

 

Has anyone done anything like this or have access to the new table API's to see what's even available? What direction would you go to accomplish something like this?

 

Kevin

 

Posted by: Kevin Baxter
Post date: 10/6/2006 5:45:33 AM

1 REPLY

RE: V19 Table Functionality

Here is some information that I got from tech support. Thought it may be helpful for someone to get into the V19 tables.

 

The original question was "is text wrapping available in V19 tables?" At least with the code below, you know what objects your're dealing with and aren't blind starting out.

 

 

 

***********************************************

What programming language are you using?

 

 

 

I haven’t tried this yet, but I assume that to force a new line in a table cell, you would access the appropriate TableCell object and write newline or linefeed character to the Value property. Have you tried this? In Visual Basic, this would look something like:

 

 

 

objTableCell.Value = “text” & vbNewLine & “more text”

 

 

 

(The developer of the Tables API just wrote to confirm that you can do this, though I still haven’t tested any code to get the syntax exactly right.)

 

 

 

The general object hierarchy you’d traverse is:

 

Get or create the SolidEdge object

 

Get or create a Draft document

 

Get or create that document’s Tables collection

 

Get or create a Table object

 

Within that table, get or create columns and/or rows

 

Within a column or row, get or create TableCell objects

 

 

 

You certainly have access through the API to any Solid Edge document’s file properties and custom properties. Have you used these APIs before? Access the properties you want, and write them as static strings to the table cells you’re interested in. If you want this data to be associative, you’d have to go through document events. Have you worked with event sets before?

 

 

 

Here is some VB 6.0 code a developer wrote to test the Tables API. You might find it useful:

 

 

 

Private Sub UserTables_Click()

 

 

 

Dim objApp As SolidEdgeFramework.Application

 

Dim objDoc As SolidEdgeDraft.DraftDocument

 

Dim objTables As SolidEdgeDraft.Tables

 

Dim objTable As SolidEdgeDraft.Table

 

Dim objTitles As SolidEdgeDraft.TableTitles

 

Dim objTitle As SolidEdgeDraft.TableTitle

 

Dim objColumns As SolidEdgeDraft.TableColumns

 

Dim objColumn As SolidEdgeDraft.TableColumn

 

Dim objRows As SolidEdgeDraft.TableRows

 

Dim objRow As SolidEdgeDraft.TableRow

 

Dim objCell As SolidEdgeDraft.TableCell

 

Dim str As String

 

 

 

Set objApp = GetObject(, "SolidEdge.Application")

 

Set objDoc = objApp.ActiveDocument

 

Set objTables = objDoc.Tables

 

Dim StrFail As String

 

 

 

 

 

 

 

StrFail = ""

 

 

 

Set objTable = objTables.Add

 

 

 

' table

 

objTable.ColumnHeaderPosition = igHeader

 

objTable.ShowColumnHeader = True

 

objTable.Margin = 0.00125

 

objTable.MaximumRows = 100

 

objTable.PageGap = 0.001

 

objTable.ReverseDisplayOrder = False

 

 

 

' titles

 

Set objTitles = objTable.Titles

 

Set objTitle = objTitles.Add

 

objTitle.Value = "1st. title"

 

objTitle.Position = igHeader

 

 

 

' columns

 

Set objColumns = objTable.Columns

 

 

 

Set objColumn = objColumns.Add(-1, True)

 

objColumn.Header = "Column 1"

 

objColumn.Width = 0.035

 

objColumn.DataAlignment = igTextHzAlignRight

 

objColumn.HeaderAlignment = igTextHzAlignRight

 

objColumn.Show = True

 

objColumn.SortPrecedence = 1

 

objColumn.SortAscending = True

 

 

 

Set objColumn = objColumns.Add(-1, True)

 

objColumn.Header = "Column 2"

 

objColumn.Width = 0.05

 

 

 

'rows

 

Set objRows = objTable.Rows

 

 

 

Set objRow = objRows.Add(-1, True)

 

Set objRow = objRows.Add(-1, True)

 

Set objRow = objRows.Add(-1, True)

 

Set objRow = objRows.Add(-1, True)

 

 

 

' cell

 

objTable.Cell(1, 1).Value = "a"

 

objTable.Cell(2, 1).Value = "b"

 

objTable.Cell(3, 1).Value = "c"

 

objTable.Cell(4, 1).Value = "d"

 

 

 

objTable.Cell(1, 2).Value = "1"

 

objTable.Cell(2, 2).Value = "2"

 

objTable.Cell(3, 2).Value = "3"

 

objTable.Cell(4, 2).Value = "4"

 

 

 

'update

 

objTable.Update

 

 

 

objTable.SetOrigin 0.1, 0.1

 

 

 

' VALIDATE

 

Set objTable = objTables(1)

 

 

 

' table

 

If (igHeader objTable.ColumnHeaderPosition) Then

 

StrFail = "ColumnHeaderPosition"

 

End If

 

 

 

If (True objTable.ShowColumnHeader) Then

 

StrFail = "ShowColumnHeader"

 

End If

 

 

 

If (0.00125 objTable.Margin) Then

 

StrFail = "Margin"

 

End If

 

 

 

If (100 objTable.MaximumRows) Then

 

StrFail = "MaximumRows"

 

End If

 

 

 

If (0.001 objTable.PageGap) Then

 

StrFail = "PageGap"

 

End If

 

 

 

If (False objTable.ReverseDisplayOrder) Then

 

StrFail = "ReverseDisplayOrder"

 

End If

 

 

 

' titles

 

Set objTitle = objTable.Titles(1)

 

 

 

If ("1st. title" objTitle.Value) Then

 

StrFail = "Value"

 

End If

 

 

 

If (igHeader objTitle.Position) Then

 

StrFail = "Position"

 

End If

 

 

 

 

 

' columns

 

Set objColumn = objTable.Columns(1)

 

 

 

If ("Column 1" objColumn.Header) Then

 

StrFail = "Header"

 

End If

 

 

 

If (0.035 objColumn.Width) Then

 

StrFail = "Width"

 

End If

 

 

 

If (igTextHzAlignRight objColumn.DataAlignment) Then

 

StrFail = "DataAlignment"

 

End If

 

 

 

If (igTextHzAlignRight objColumn.HeaderAlignment) Then

 

StrFail = "HeaderAlignment"

 

End If

 

 

 

If (True objColumn.Show) Then

 

StrFail = "Show"

 

End If

 

 

 

If (1 objColumn.SortPrecedence) Then

 

StrFail = "SortPrecedence"

 

End If

 

 

 

If (True objColumn.SortAscending) Then

 

StrFail = "SortAscending"

 

End If

 

 

 

' cell

 

If ("a" objTable.Cell(1, 1).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("b" objTable.Cell(2, 1).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("c" objTable.Cell(3, 1).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("d" objTable.Cell(4, 1).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("1" objTable.Cell(1, 2).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("2" objTable.Cell(2, 2).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("3" objTable.Cell(3, 2).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If ("4" objTable.Cell(4, 2).Value) Then

 

StrFail = "Cell"

 

End If

 

 

 

If (StrFail "") Then

 

StrFail = "failed!!!"

 

End If

 

 

 

 

 

End Sub

 

 

 

Posted by: Kevin Baxter
Post date: 10/12/2006 4:07:52 AM