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: 

Illogic: Defining variable in name

3 REPLIES 3
Reply
Message 1 of 4
WernerBeek
264 Views, 3 Replies

Illogic: Defining variable in name

Hello,

 

I'm an Inventor 2011 user and I'm writing a Ilogic script to update an assembly. For this I want to use a variable in a name.

For example d1 till d10 will be given the value 25.

 

Is it possible to define "d" combined with a variable "n" . The script should be something like this:

 

n=1

for n<11

dn=25

n=n+1

end

 

Thank you in advance

3 REPLIES 3
Message 2 of 4
MjDeck
in reply to: WernerBeek

You can't do it directly with variable names. But you can do it with the Parameter function:


For n = 1 To 11
  Parameter("d" & n) = 25
Next


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 4
WernerBeek
in reply to: MjDeck

Thank you for your reply.

 

I've given the wrong example. "d" is not a parameter, but just a name. It could be everthing. Is it still possible?

 

The Ilogic part containing my problem has been listed below:

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

Con_MLA1 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B2")

Con_MLA2 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B3")

Con_MLA3 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B4")

Con_MLA4 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B5")

Con_MLA5 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B6")

Con_MLA6 = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B7")

 

If Con_MLA1 =  "MLA270L"  Or Con_MLA1 = "MLA270L_centered" Or Con_MLA1 = "MLA270Lslinger" Or Con_MLA1 = "MLA270LERC" Or Con_MLA1 = "MLA270LERCcentered" Or Con_MLA1 = "MLA270LERC+slinger" Then

 Floc = "C:\Work\Samenwerken\Master\_MLA270Links\"

 Else Floc = "C:\Work\Samenwerken\Master\"

End If

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

 

The lower part I want to run 6 times

Message 4 of 4
rjay75
in reply to: WernerBeek

You can't do it with the name itself but you can use an array and try that.

 

Dim Con_MLA(6) as String
Con_MLA(0) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B2")
Con_MLA(1) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B3")
Con_MLA(2) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B4")
Con_MLA(3) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B5")
Con_MLA(4) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B6")
Con_MLA(5) = GoExcel.CellValue("Samenwerken.xls", "Blad1", "B7")

For i As Integer = 0 To 5
If Con_MLA(i) =  "MLA270L"  Or Con_MLA(i) = "MLA270L_centered" Or Con_MLA(i) = "MLA270Lslinger" Or Con_MLA(i) = "MLA270LERC" Or Con_MLA(i) = "MLA270LERCcentered" Or Con_MLA(i) = "MLA270LERC+slinger" Then
	Floc = "C:\Work\Samenwerken\Master\_MLA270Links\"
Else 
	Floc = "C:\Work\Samenwerken\Master\"
End If
Next i

 

 

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

Post to forums  

Autodesk Design & Make Report