iLogic looping through dimensions

iLogic looping through dimensions

Daan_M
Collaborator Collaborator
437 Views
1 Reply
Message 1 of 2

iLogic looping through dimensions

Daan_M
Collaborator
Collaborator

Hello,

 

I have a Excel datasheet with the annotation values..

F (column)
10
20
30

I have a drawing with overwritten annotations, the overwritten annotations are the same letter as the Excelcolumns, for example F for the width of a keyslot.

 

Capture as.PNG

 

I want to create a loop in which the annotation names of my drawings get compared to the Excel column names, if they match, i want iLogic to fill in the rowvalue of that column. I guess I need to create a loop inside a loop for this to work? I'm stuck at the point below, i think i need to create some type of collection or array?:

 

 

 

 

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDDoc.Sheets.Item(1)
Dim oDimension As DrawingDimension

'create some kind of collection with Excel headers? (A, B, ... Z)

For Each oDimension In oSheet.DrawingDimensions
	oDimension.HideValue = True

   'For Each oExcelHeader in oExcelHeaders collection?
   'If oDimension.Text.Text = oExcelHeader
   '	oDimension.Text.FormattedText = GoExcel.CellValue(Excelheader & currentrow)
   'Else
   'End if
   'Next

Next

 

 

 

 

 

Hope the goal is explained clear enough

0 Likes
438 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

There are still some things I don't understand about what you are trying to do.

- Is there a row that contains column titles, where you have named the columns "A", "B", "C",; or are you just referring to the built-in column address labels, and there isn't a column names row?

- Since the dimension's 'label' should match the column's label, we know which column to retrieve a value from for each dimension, but since there are multiple rows of data under each column, how do you intend to determine which row's value (under that column) to use for the dimension.

- Are you just trying to change the dimension's text from showing "F" to showing a numerical value from one of the rows under the matching column in the Excel sheet, or are you trying to override the dimension's actual model value.  I'm not sure what the intent is here.

Anyways, here is what I've put together so far:

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDDoc.Sheets.Item(1)
Dim oDim As DrawingDimension
GoExcel.Open("filename.xls", "Sheet1")
GoExcel.DisplayAlerts = False
GoExcel.TitleRow = 0
GoExcel.FindRowStart = 1
'Dim oCols() As String = {"A", "B", "C", "D", "E", "F", "G" }

'need to determine which row to retrieve value from
'Dim oRow As Integer = GoExcel.FindRow("filename.xls", "Sheet1", "columnName", "<=", 0.2, "columnName", "<=", 4.1)
Dim oRow As Integer = 1

Dim oLabel As String
For Each oDim In oSheet.DrawingDimensions
	If oDim.HideValue = True Then
		oLabel = oDim.Text.Text
		oDim.Text.FormattedText = GoExcel.CellValue(oLabel & oRow)
	End If
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you have time, please... Vote For My IDEAS 💡or you can Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes