Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 516

Auto export driven dimension value to Excel

$
0
0

By Adam Nagy

Sometimes there could be a main dimension that causes the whole model to change, and so the values of the driven dimensions change as well. You could either monitor the main dimension for change using iLogic or one of the driven dimensions. In this case I'm going to do the latter.

Let's say we have the following part with a sketch that defines the Width and Height of the base of the model. We also have at the bottom a Driven Dimension associated with a Reference Parameter named DrivenWidth which changes when the Width changes:

Dims

I then create a rule named DrivenWidthRule which has DrivenWidth=DrivenWidth in it so it will be recognized as a Driving Rule for DrivenWidth - even though it's only affected by Width:

Params

DrivenWidthRule:

' To fake a "Driving Rule"
DrivenWidth=DrivenWidth

xlsFilePath = 
"C:\Users\Administrator\Documents\Inventor\MyProject\parameters.xls"' Write info to excel file
GoExcel.Open(xlsFilePath, "Sheet1")' Find the relevant parameter' (in case we store many of them)' Names are in column A with title "Name"
i = GoExcel.FindRow(xlsFilePath, "Sheet1", "Name", "=", "DrivenWidth")
If i > 0 Then' Found it' Values are in column B
  GoExcel.CellValue(xlsFilePath, "Sheet1", "B" + i.ToString()) = 
    DrivenWidth
End If

GoExcel.Save
GoExcel.Close

Now whenever Width changes, it will change DrivenWidth and so DrivenWidthRule will be called which then can update the values in the Excel file:

Excel

 


Viewing all articles
Browse latest Browse all 516

Trending Articles