×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writing External Rule

Writing External Rule

Writing External Rule

(OP)
Dear EngAddict,

I managed to get the model to loft OK in the end and it updates OK when I change the MultiValue selection under the parameters in each of the files. So thank you so much.

My next task is to apply an external rule which will be activated upon opening say the top level file and the subsequent subordinate files, that will:

a: automatically load each of the lower assembly files.

b. Set the MultiValue selection in the respective user-parameters in each of the respective files.

I have loaded Microsoft Visual Basic 2010 to create the external file but wondered if you could possibly help me with the code for the Inventor Rule and if possible the *.vb file.

This is the existing header code within my Inventor Rule and I want the external rule to determine which of the model types is to be used.

MultiValue.SetList("ModelType", "OuterNormal", "OuterIntense", "InnerIntense", "InnerNormal",)

I think the extra code should look something like this but I am only guessing:

 localTrigger = iTrigger0
 AddReference "ModelType.DLL"

 
 localTrigger = iTrigger0
 
 Using dlg As New ModelType.Dialog1
 
 dlg.Parameter = Parameter
 dlg.MultiValue = MultiValue
 dlg.type_list = MultiValue.List("ModelType")
 dlg.type = Parameter("ModelType")
 
 dlg.ShowDialog()
 
 End Using
 End If

At the moment I get the following error message:

Error on Line 0 : could not find library 'ModelType.DLL'
Error on Line 0 : compiler initialization failed unexpectedly: 0x80070002

Your continued help would be greatly appreciated.

Finally I must thank you for your meaningful help. I may be a mere novice but nevertheless in the past week with your help I have made more progress than I have in the previous three/four months

So thank you once again.

cjj
 

RE: Writing External Rule

I am not too sure what you mean by "automatically load each of the lower assembly files", this is done when opening the assembly.

Do you have an external rule called ModelType?

I am not 100% clear on what you want to do but I think you can do it easier with an iLogic rule in your top assembly file.

I will use an example, you have a multivalue list called:

CODE

MultiValue.SetList("ModelType", "OuterNormal", "OuterIntense", "InnerIntense", "InnerNormal",)
In my example I have an equivalent list, corresponding to plate size in my assembly:

CODE

MultiValue.SetList("ModelType", "Large", "Largest", "Medium", "Small", "Smallest")

Now all I need to do is add an input list for my multivalue and a select case that can change the parameters in all the part files. Now add some code to update the assembly.

CODE

ModelType = InputListBox("Enter Size", MultiValue.List("ModelType"), "Smallest", Title := "Input", ListName := "Size")

Select Case ModelType
 Case "Smallest"
 Parameter("Plate:1", "Height") = 60
  Case "Small"
 Parameter("Plate:1", "Height") = 70
  Case "Medium"
 Parameter("Plate:1", "Height") = 80
  Case "Large"
 Parameter("Plate:1", "Height") = 90
  Case "Largest"
 Parameter("Plate:1", "Height") = 100
 End Select
 
 InventorVb.DocumentUpdate()

Now all that is left is to select Event Triggers and add your new rule to the After Open Document trigger. See attached sample files.

RE: Writing External Rule

(OP)
Dear EngAddict,

Thank you once again for your kind explicit explanation and sample model.

I have played around with your model for about a couple of hours, adding additional components and seem to have got the hang of it.

No doubt I will get confused as I build my assembly but once again without your clear and precise explanation and example I would be floundering in the dark.

So a big thank you.

cjj
 

RE: Writing External Rule

(OP)
Dear EngAddict,

Just a quick update to say that I am staggered that I am able to control all the various files/models from the one top level rule.

So to reiterate - thank you so much.

cjj

I have only really just started to build the assembly but this is what my code looks like thus far:


ModelType = InputListBox("Enter Size", MultiValue.List("ModelType"), " OuterNormal ", Title := "Input", ListName := "Size")

Select Case ModelType

Case "OuterNormal"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 581.2864022444 mm
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0 mm
Parameter("Full Pyramid:1", "AdjustedHeight") = 581.2864022444 mm
Parameter("Full Pyramid:1", "RipThickness") = 3.0 mm
Parameter("Solid Cap:1", "AdjustedHeight") = 581.2864022444 mm
Parameter("Solid Cap:1", "RipThickness") = 3.0 mm

Case "OuterIntense "
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 581.2864022444
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 581.2864022444
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 581.2864022444
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerNormal0"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 160.968
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 160.968
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 160.968
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerNormal2"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 160.968
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 160.968
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 160.968
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerNormal4"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 160.968
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 160.968
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 160.968
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense0"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense1"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense2"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense3"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense4"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense4"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0

Case "InnerIntense5"
Parameter("Pyramid without Summit:1", "AdjustedHeight") = 91.43118302
Parameter("Pyramid without Summit:1", "RipThickness") = 3.0
Parameter("Full Pyramid:1", "AdjustedHeight") = 91.43118302
Parameter("Full Pyramid:1", "RipThickness") = 3.0
Parameter("Solid Cap:1", "AdjustedHeight") = 91.43118302
Parameter("Solid Cap:1", "RipThickness") = 3.0
   
End Select
  
InventorVb.DocumentUpdate()
 

RE: Writing External Rule

Looks like you got it working ok. It is always easier to demonstrate with part files.

Just one other thing you can do, is instead of using the input list you can make the multivalue a key parameter. If you then place it in a new assembly with the 'Place iLogic Component' option it will prompt you to select any keyed parameters on placement. This will create a copy of the master iLogic assembly and all its parts. If you cancel the command and place it again you will get a new copy of your assembly.

This is similar to the functionality of an iAssembly if you made all your part files into iParts. I would use an iAssembly though if this is what you are after, provided it will do everything you need. If you have to start mixing a lot of code with iAssemblies then usually it is cleaner to just do everything with iLogic.

RE: Writing External Rule

(OP)
Dear EngAddict,

Thank you once again for your informative reply.

I am slightly bewildered by your suggestion and wonder if once again you have an example you could kindly let me have sight of; or failing that, the url of a tutorial on the process.

Thank you once again I am truly grateful.

cjj

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources