Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

X is not valid?

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
jletcher
505 Views, 10 Replies

X is not valid?

Hard to explain this but I wil do my best.

 

 Making a part that will have the size as an option to pick. Issue is Ilogic does not like it.

 

 I have a list that has sizes like:

3" X 2"

4" X 2"

4" X 4"

 

But when I put in the code

 

If Plate_Size = "3" X 2"" Then
	Parameter("Dim_X") = 3
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "A"

ElseIf Plate_Size = "4" X 2"" Then
	Parameter("Dim_X") = 4
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "B"

End If

 it gives me an error

Error on Line 4 : End of statement expected.

and highlight the If Plate_Size ="3" X 2"".

 

I know it has to do with the X but I an't remember what to do having brain fart.

 

 Can someone refresh me.....

10 REPLIES 10
Message 2 of 11
GavoGarmo
in reply to: jletcher

I think the " marks are messing you up. iLogic will see the string as divided because the " will be seen as the start and end of a string.

Message 3 of 11
jletcher
in reply to: GavoGarmo

Yes you are correct. Is there a way to keep them? I know it has to do with a double something if I remember correctly..

Message 4 of 11
GavoGarmo
in reply to: jletcher

My only solution is to go metric! lol... Sorry 🙂

 

Message 5 of 11
GavoGarmo
in reply to: GavoGarmo

I can see a workaround where you'd make addition parameters that have the value 3" x 2" and then write the code to say if PlateSize = NewParameter then ect.... It's a fudge but it should work and keep you moving forward.
Message 6 of 11
jletcher
in reply to: GavoGarmo

Metric lol that would flip these rednecks out they don't even know what a weld symbol is LOL.

 

 Yeah i was thinking the same thing about the new parameter I guess I will just take them out for now..

Message 7 of 11
thomaskennedy
in reply to: jletcher

You should be able to put an 'extra' quotation mark in the string like this :

 

If Plate_Size = "3"" X 2""" Then
	Parameter("Dim_X") = 3
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "A"

ElseIf Plate_Size = "4"" X 2""" Then
	Parameter("Dim_X") = 4
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "B"

End If

 

(The extra quotation mark will be ignored when the rule is compiled and run)

 

Cheers,

Tom

Message 8 of 11
jdkriek
in reply to: jletcher

Or you can use Chr(34) - less confusing programmatically IMO

 

If Plate_Size = "3" & Chr(34) & " X 2" & Chr(34) Then
	Parameter("Dim_X") = 3
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "A"
ElseIf Plate_Size = "4" & Chr(34) & " X 2" & Chr(34) Then
	Parameter("Dim_X") = 4
	Parameter("Dim_Y") = 2
	Parameter("Foot_Code") = "B"
End If
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 9 of 11
jletcher
in reply to: thomaskennedy

Thanks that worked.. I thoght I tried that but I gues I did not..

Message 10 of 11
jletcher
in reply to: jdkriek

Thanks jdkriek your solution will work too...

Message 11 of 11
jdkriek
in reply to: jletcher

Quite welcome! 😉

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report