Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
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: 

iLogic Rule Issue

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
362 Views, 3 Replies

iLogic Rule Issue

Hello There,

 

I have written a multi-value parameter code populating a few things in the custom i-properties. The rule runs well and fine when created inside a part and it populates the custom i-property as well. However, it throws an error when ran as an external rule. The error definition is stated below :

 

"Error in rule: Section Code, in document: Solid27.ipt

 

Object reference not set to an instance of an object."

 

Can anyone help me with this.

Thanks in advance.

Tags (2)
3 REPLIES 3
Message 2 of 4
Lewis.Young
in reply to: Anonymous

Hi Aman,

 

Would it be possible to copy and paste your code here so that i can have a look?

That sort of error is relatively easy to fix, but i won't know exactly where it is without seeing it

 

Lewis Young
Windows 7 x64 - 32GB Ram
Intel Xeon E5-1620 v2 @ 3.70GHz
nVidia Quadro M2000 - 4GB
Inventor Professional 2017.3
Vault Basic 2017
3ds Max 2018

Message 3 of 4
Anonymous
in reply to: Lewis.Young

MultiValue.SetList("SectionCode", "CHS", "CONE", "PL", "WBEAD")
Parameter("SectionCode") = SectionCode
iProperties.Value("Custom", "Section-Code") = SectionCode

 

If SectionCode = "CHS" Then
MultiValue.SetList("CHS", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("CHS") = CHS
iProperties.Value("Custom", "Section Type") = CHS


Else If SectionCode = "CONE" Then
MultiValue.SetList("CONE", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("CONE") = CONE
iProperties.Value("Custom", "Section Type") = CONE


Else If SectionCode = "PL" Then
MultiValue.SetList("PL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("PL") = PL
iProperties.Value("Custom", "Section Type") = PL

 

Else If SectionCode = "WBEAD" Then
MultiValue.SetList("WBEAD", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("WBEAD") = WBEAD
iProperties.Value("Custom", "Section Type") = WBEAD

End IF 

 

iLogicVb.UpdateWhenDone = True

 

"THE CODE WORKS WHEN RUN WITHIN THE PART BUT FAILS WHEN RUN AS AN EXTERNAL RULE"

 

Message 4 of 4
Anonymous
in reply to: Lewis.Young

MultiValue.SetList("SectionCode", "CHS", "CONE", "PL", "WBEAD")
Parameter("SectionCode") = SectionCode
iProperties.Value("Custom", "Section-Code") = SectionCode

If SectionCode = "CHS" Then
MultiValue.SetList("CHS", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("CHS") = CHS
iProperties.Value("Custom", "Section Type") = CHS


Else If SectionCode = "CONE" Then
MultiValue.SetList("CONE", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("CONE") = CONE
iProperties.Value("Custom", "Section Type") = CONE


Else If SectionCode = "PL" Then
MultiValue.SetList("PL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("PL") = PL
iProperties.Value("Custom", "Section Type") = PL

 

Else If SectionCode = "WBEAD" Then
MultiValue.SetList("WBEAD", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
Parameter("WBEAD") = WBEAD
iProperties.Value("Custom", "Section Type") = WBEAD

End IF

iLogicVb.UpdateWhenDone = True

 

Here is the code. Thanks

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

Post to forums  

Autodesk Design & Make Report