Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

parameter extraction

26 REPLIES 26
Reply
Message 1 of 27
Anonymous
1203 Views, 26 Replies

parameter extraction

Hi all,

 

For a project of mine i want to export a variable parameter lets Call this X but this parameter is dependent of the Plane called Y_layer.

So when te the plane Y_layer moves 1mm the variable X changes the value of X needs to be exported in an excell file. When the Y_layer moves again 1 mm then the value of X changes and that value needs to be written in another excell cell. when the Y_layer moves again the value of X changes and needs to be written in a new cell. 

 

Could someone help me please

 

I use inventor 2017

 

Greetz Lowie

26 REPLIES 26
Message 21 of 27
Anonymous
in reply to: asiteur

Wel i tried it and i didnt get the save errors any more so thats good. But i the values in excel are still the same.

New code

:SyntaxEditor Code Snippet

If Start= True Then 

Do While Afstand_tot_center_Ruit <5
Afstand_tot_center_Ruit= Afstand_tot_center_Ruit+0.5
InventorVb.DocumentUpdate(True)

'Define the excel columns A to D to write to:
Cell_X1="A" & Row_no
Cell_X2="B" & Row_no
Cell_Y1="C" & Row_no
Cell_Y2="D" & Row_no
Cell_H1="E" & Row_no
Cell_H2="F" & Row_no

'Write the values
GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\X1.xls", "Blad1", Cell_X1) = X_Afstand_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\X2.xls", "Blad1", Cell_X2) = X_Afstand_2_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Y1.xls", "Blad1", Cell_Y1) = Y_Afstand_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Y2.xls", "Blad1", Cell_Y2) = Y_Afstand_2_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Hoek_1.xls", "Blad1", Cell_H1) = Hoek_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Hoek_2.xls", "Blad1", Cell_H2) = Hoek_2_Ruit
GoExcel.Save
GoExcel.Close
Row_no= Row_no+1
Loop
End If

 

But what i think seems to be odd is that when i delete this bit of code that automates the moving of Y_layer then it works. But when i add this code back to automate it doesnt work so it has nothing to do with my excel i also have no errors about saving or already being opend.

If Start= True Then 

Do While Afstand_tot_center_Ruit <5
Afstand_tot_center_Ruit= Afstand_tot_center_Ruit+0.5
InventorVb.DocumentUpdate(True)

 

 

If Dikte > 10 Then

While Dikte < 100

Dikte = Dikte +10
MessageBox.Show("Stap bijtellen","Nr 1")

num = num+1
cell = "A" + CStr(num)
GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\test123\test123456.xls", "blad1", cell) = Dikte


End While

End If

 

The code above is an automated piece when the dikte changes 1 mm above 10 mm then it wil add 10 mm in steps and write it down in excel in separte cells actually just like i want. But why doens't that work with the code underneath they are the same in theory not?

SyntaxEditor Code Snippet

If Start= True Then 

Do While Afstand_tot_center_Ruit <5
Afstand_tot_center_Ruit= Afstand_tot_center_Ruit+0.5
InventorVb.DocumentUpdate(True)

'Define the excel columns A to D to write to:
Cell_X1="A" & Row_no
Cell_X2="B" & Row_no
Cell_Y1="C" & Row_no
Cell_Y2="D" & Row_no
Cell_H1="E" & Row_no
Cell_H2="F" & Row_no

'Write the values
GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\X1.xls", "Blad1", Cell_X1) = X_Afstand_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\X2.xls", "Blad1", Cell_X2) = X_Afstand_2_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Y1.xls", "Blad1", Cell_Y1) = Y_Afstand_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Y2.xls", "Blad1", Cell_Y2) = Y_Afstand_2_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Hoek_1.xls", "Blad1", Cell_H1) = Hoek_1_Ruit
GoExcel.Save
GoExcel.Close


GoExcel.CellValue("C:\Users\lowie\Documents\Inventor\laser_cladder_Lowie\Hoek_2.xls", "Blad1", Cell_H2) = Hoek_2_Ruit
GoExcel.Save
GoExcel.Close
Row_no= Row_no+1
Loop
End If

 

Message 22 of 27
Anonymous
in reply to: Anonymous

Does it matter if the paramater that i try to write in excel is a reference parameter ? SyntaxEditor Code Snippet

X_Afstand_1_Ruit

 

Message 23 of 27
asiteur
in reply to: Anonymous

Hi,

 

Well there is a difference between Inventor parameters and variables so the difference in your small and real code might be in that.

 

What you could try is making the row_number a variable and remove it as parameter.

 

As said before, I have a lot issues less than you do. But you are saying that you only see 1 value in Excel or is it printing a whole list of identical values?

 

I'm really running out of ideas why this goes wrong.



Alexander Siteur
Project Engineer at MARIN | NL
LinkedIn

Message 24 of 27
Anonymous
in reply to: asiteur

Would you know if there is any way to make this happen in VBA ?

Message 25 of 27
Jon.Dean
in reply to: Anonymous

Hi Lowie,

Have you installed the SDK (software developers kit), once you do this, there is a Object Model PDF file.

Here you can see which objects you can manipulate within VBA.

Install from here: C:\Users\Public\Documents\Autodesk\Inventor 2017\SDK

Cheers

Jon.

 



Jon Dean

Message 26 of 27
Curtis_Waguespack
in reply to: Anonymous


@Anonymous wrote:

Would you know if there is any way to make this happen in VBA ?


Hi lowie.lesschaeve,

 

Also, just a reminder that, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 27 of 27

Hi Lowie,

Take a look at the following Blog site.

Cheers

Jon.



Jon Dean

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

Post to forums  

Autodesk Design & Make Report