iLogic External Rule to Set parameter in component part

iLogic External Rule to Set parameter in component part

jholland3XDLM
Advocate Advocate
461 Views
1 Reply
Message 1 of 2

iLogic External Rule to Set parameter in component part

jholland3XDLM
Advocate
Advocate

I have an external rule that is recursively running through all parts within an assembly. Among other things, it sets a parameter I called "FileName" to a string that will then get saved as the new file name, replaced in the assembly, and so on. 

 

Here is a extract from the code that I am using. 

 

Dim oDoc As Document = RuleArguments("Document")

Dim CurFileName = oDoc.FullFileName

Logger.Trace("oDoc in FileNaming = " & CurFileName)							

Dim FileNamePara = Parameter(oDoc, "Series")
								
Logger.Trace("FileNamePara = " & FileNamePara)


Parameter(oDoc, "FileName") = Parameter(oDoc, "Series") & 
					Parameter(oDoc, "Family") &
					Parameter(oDoc, "OptionCode")

Logger.Trace("FileName after FileNaming rule = " & Parameter(oDoc, "FileName"))

 

 And a case of the logger. 

 

TRACE|Entering external rule: FileNameing (from 100-00003-0035.iam)
TRACE|oDoc in FileNaming = C:\_FCPWorkspace\Designs\Engineering Projects\15301-15400\15338\Outputs\Drawings\AngleRinforcement.iam
TRACE|FileNamePara = 100-
TRACE|OptionCode in FileNameing = 0010
TRACE|FileName after FileNaming rule = 100-00003-0010

 

The part AngleRinforcement.iam parameters are 

Series = 300-

Family = 00164-

Option Code = 0010

 

 

This issue is that it is setting the parameter in the parent file only. oDoc is the correct file name, The option code is correct for that file name, but when it comes to setting the parameter, it finds it only in the parent part number, ie 100-00003 instead of 300-00164 for the part. What am I doing wrong here?

0 Likes
462 Views
1 Reply
Reply (1)
Message 2 of 2

fullevent
Advisor
Advisor

Hello @jholland3XDLM,

 

What kind of parameter do you want to write? UserParameter?

I think that with 'Parameter(oDoc, "FileName")' you can only get to the first level of the assembly.

 

If oDoc is the current ipt then you can do something like

 

oDoc.ComponentDefinition.Parameters.UserParameters.Item("FileName").Value = oDoc.ComponentDefinition.Parameters.UserParameters.Item("Series").Value & oDoc.ComponentDefinition.Parameters.UserParameters.Item("Family").Value & oDoc.ComponentDefinition.Parameters.UserParameters.Item("OptionCode").Value

But it's hard to understand what exactly happens without seeing the code.

Perhaps this will help you anyway.

 

regards,

Aleks

 


Aleksandar Krstic
Produkt- und Projektmanager

0 Likes