iLogic Rule issue with iPart

iLogic Rule issue with iPart

mahleauto
Participant Participant
1,304 Views
7 Replies
Message 1 of 8

iLogic Rule issue with iPart

mahleauto
Participant
Participant

I am trying to use iLogic to facilitate part name engraving in an iPart model.

 

The part file name is for example 90045128.ipt

The iPart table is set up to use 90045128-0x as the Member Name

The iPart table is set up to use 90045128.0x as the Part Name

 

In the iLogic browser, I have the code:

rowNumber = iPart.RowNumber("90045128:1")

Parameter ("Part_Name") = iPart.CurrentRowValue ("Part Name")

 The parameter "Part_Name" is a text user variable

 

When the rule is ran however, I receive the following error:

 

Error in rule: Rule0, in document: 90045128.ipt

Object reference not set to an instance of an object

 

Which I interpret to mean there is a NULL value.  I have tried just running the rowNumber = iPart.RowNumber("90045128:1") and receive the same error.  I am not sure why this returns null when it seems to match the example in the help files.

Can someone clue me in as to why this does not work?

0 Likes
Accepted solutions (1)
1,305 Views
7 Replies
Replies (7)
Message 2 of 8

mcgyvr
Consultant
Consultant

@mahleauto  Are you trying to run that in an ipart or in an iassembly?



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 8

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @mahleauto 

 

I'm not sure that there isn't a better way to do this, but  what I have done it the past is to add a numeric "index" parameter and include that in the ipart table, then you can have the iLogic rule "watch" the index parameter and set the engraved text as needed.

 

Also, just as a reminder there is the Inventor Customization forum for programming and ilogic questions of this type:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I've asked the moderators to move this thread to that forum for you.

 

image.pngimage.png

 

'watch this parameter so when iPart member changes
'the rule is triggered
oTrigger = iPartIndex 

'set the engrave text parameter to be the part number
parameter("Part_Number_Engrave") = iProperties.Value("Project", "Part Number")

'update the part
InventorVb.DocumentUpdate()

 

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

EESignature

0 Likes
Message 4 of 8

mahleauto
Participant
Participant

I am trying to run this in an iPart. 

0 Likes
Message 5 of 8

mahleauto
Participant
Participant

Even if I just do the following from the snippets:

 

rowNumber = iPart.RowNumber("90045128:1")

I receive the same error.  Is the rule expecting some preliminary code before this snippet?  I tried to delcare the variable rowNumber as an integer just to see but it made no difference.

0 Likes
Message 6 of 8

Curtis_Waguespack
Consultant
Consultant

@mahleauto wrote:

Even if I just do the following from the snippets:

 

rowNumber = iPart.RowNumber("90045128:1")

I receive the same error.  Is the rule expecting some preliminary code before this snippet?  I tried to delcare the variable rowNumber as an integer just to see but it made no difference.


I don't do much in the way of combining ilogic and iparts, but I think most of the ilogic snippets are intended to work at the assembly level, acting on the iPart factory(parent file) to swap out members, etc... vs working at the part level to setup or configure the factory file.

 

I think that is the case with the lines you are trying to use... meaning I think those are meant to be used from an assembly file, and are expecting a component occurrence name.

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

EESignature

0 Likes
Message 7 of 8

mahleauto
Participant
Participant

That makes sense as to why the null variable error.  Thank you.  I guess I will have to try the above or go back to the old way I was doing this with CASE and putting the part name in a parameter. (clunky)

0 Likes
Message 8 of 8

majnalt
Contributor
Contributor

Hello SIr

may I as in what way you are using this funtction - to cnc cut codes to parts?

if so, may I ask how do you mass engrave the parts, you engarve each part manually?

0 Likes