Define filename on subpart with rule

Define filename on subpart with rule

LSA-skan
Advocate Advocate
1,870 Views
24 Replies
Message 1 of 25

Define filename on subpart with rule

LSA-skan
Advocate
Advocate

Hi All

 

I have an assembly which serves as a configurator. This Assy, needs to be copied many times. The assy contains 2 parts, which also must be copied. but when copied, the parts must have a new filename, and then the Rule cannot find them anymore. Therefore my plan is to define the filename with the configurator rule..

 

Example.:

Assy = Module.iam

Part1 = Module-1.ipt

Part2 = Module-2.ipt

 

I have this so far, but is doesn't work.. what do i put before the .ipt??..:

Filename = ThisDoc.FileName(False) 'without extension
[Filname-1 inserted here].ipt.Diameter = "30"
0 Likes
Accepted solutions (1)
1,871 Views
24 Replies
Replies (24)
Message 21 of 25

jdkriek
Advisor
Advisor

Glad you got it sorted! 

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


0 Likes
Message 22 of 25

LSA-skan
Advocate
Advocate

Hi again Jonathan

 

Im posting in this thread again, since i think the code i got from you is causing some kind of error...

 

Like described in this other thread.:

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Run-rule-twice-to-fix-error-in-rule/m-...

 

... i have isolated this bit to cause the error... i have no idea to make any sence of the error message 😞

 

'Parameter.Quiet = TrueDim oAsmCompDef As AssemblyComponentDefinition
    oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrencesDim oOcc As ComponentOccurrence
Dim oName As String

 Error message.:

System.Runtime.InteropServices.COMException (0x80020003): Medlemmet blev ikke fundet. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Any ideas?

 

/LSA

0 Likes
Message 23 of 25

xiaodong_liang
Autodesk Support
Autodesk Support

Hi LSA-skan,

 

do you mean only the lines you posted here caused the error ? I just copied pasted to an assembly, it works well. If you meant others, please do post complete demo code. Thanks.

 

In addition, I would suggest you log a new post and add a referece to this thread. It sometimes would be hard to jump into a case with a long history.

0 Likes
Message 24 of 25

jdkriek
Advisor
Advisor

I agree with xiaodong.liang, start a new thread and just link back to this one for REF.

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


0 Likes
Message 25 of 25

LSA-skan
Advocate
Advocate

Hi both of you 🙂

 

The thread i linked to in my previous post, is actually  a new one where i also link to this one. however, the topic may not be very describing... "Run rule twice to fix error in rule..?" it started out as that when i found out that my rule sometimes stopped, and didn't complete the rule, then if i ran it again, most of the times it did what it was suposed to (finished the rule), but the error still came up. Now im kind of hunting the cause of the error, as I found out i actually pops up every now and again when using this assy in another assy...

 

From now on all new posts will be in the other thread..!

 

/LSA

0 Likes