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: 

Error on line 5 in rule: Get File And Path Name

9 REPLIES 9
Reply
Message 1 of 10
Dulli2
295 Views, 9 Replies

Error on line 5 in rule: Get File And Path Name

Hello.

 

When generating parts from the part factory I get the error message "Error on line 5 in rule: Get File And Path Name". I can click "ok" and it continues to the next part where the message is displayed again. I checked the rule "Get File And Path Name" and it contains actually just three lines.

Very strange. What might cause this issue?

9 REPLIES 9
Message 2 of 10
CGBenner
in reply to: Dulli2

@Dulli2 

Can you share the code for the rule?  Also, I'm moving this to the iLogic forum so that the right people can take a look at it.


Chris Benner
Industry Community Manager – Design & Manufacturing


If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.


Also be generous with Likes!  Thank you and enjoy!


Become an Autodesk Fusion Insider
Inventor/Beta Feedback Project
Message 3 of 10
Dulli2
in reply to: CGBenner

Hello again @CGBenner 

The rule is this:

 

1   iLogicVb.UpdateWhenDone = True
2   Parameter("FileName")=ThisDoc.FileName(True)
3   Parameter("FilePath")=ThisDoc.Path

 

Message 4 of 10
WCrihfield
in reply to: Dulli2

Hi @Dulli2.  When an error message pops up from an iLogic rule, there are usually 2 tabs to that little dialog.  Could you please post what both of them say here, so we can bet a better understanding of what may be going wrong.  If it is not in English, would you mind posting the text here, instead of just screen captured images?  The most common problems with the lines of code you are showing are:

  • if the document that the rule is acting upon has not been saved yet, it will not have a file name or path yet.
  • a parameter with the specified name(s) may either not exist within the document that the rule is acting upon, or the parameter may not be set to 'Text' type units, so trying to set text value to it would fail.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 10
A.Acheson
in reply to: Dulli2

You mentioned part factory. If the rule is an ipart factory and then it runs on the member file this will be read only. The result will be the rule trying to write the filename to the parameter which result in error. Let us know what document your running the rule in. And if it is modifiable. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 6 of 10
Dulli2
in reply to: A.Acheson

Hello @A.Acheson and @WCrihfield .

 

Below the error box that pops up.

 

1) I opened the ipart and generated parts from it. It works, but the message pops up for every generated part of the family.

2) When placing such parts in an assembly and when  saving the assembly the same box appears.

 

Parts are not read-only.

Actually, one of the iparts where this happens does not contain this rule.

 

Dulli2_0-1670573510250.png

 

Message 7 of 10
A.Acheson
in reply to: Dulli2

I suggest to remove the internal rule from the ipart factory completely. You can run it as an external rule in the factory to perform the parameter population by looping over all members. iParts are not designed to have ilogic rules in them. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 8 of 10
Dulli2
in reply to: A.Acheson

@A.AchesonTo clarify one thing, when you talk about the iparts, do you mean the members or the parametric model the members are created with?

I get the same result after deleting the rule. The error is actually related to the members in the list and not the governing one.

Message 9 of 10
A.Acheson
in reply to: Dulli2

Simply deleting the rule doesn’t remove it from existing members. Remove the rule and event trigger in the factory file.  The factory is the main part with the table the members are derived from. It has all the keys used to select a specific member. 

Generate the members

Select rebuild all and then generate the member. You will get a save dialogue box this is the new member overwriting the old on the desktop location. If you want open the member file location and you can see the time changing on the file save. You know then it is overwritten. Open this file and there should be no trace of ilogic rule. 

Here is the iPart factory object if you ever want to work with the factory directly using the API. 

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 10 of 10
Dulli2
in reply to: A.Acheson

Thanks for leading to the right direction. It was not enough to do the rebuild. I had to delete all members from the folder and generate them again. After the error has disappeared.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report