Autodesk Inventor Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Trigger iLogic rule on change of parameters in Assembly, 'Link Parameters ' tool
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I'm having fun experimenting with the Autodesk Labs 'Link Paramneters' addin.
The addin maps the parameters between my assembly file and part file perfectly. However, when I change parameter values in my Assembly file, I need to run the rule again to push the parameter values down to the part file.
Is there any way to make the rule run as soon as the parameters are changed in the assembly document?
Thanks in advance for any help you can offer.
Paul
@CadSetterOut
Please use the
Re: Trigger iLogic rule on change of parameters in Assembly, 'Link Parameters ' t
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Bump!
I am running windows 7 64 Bit, and Inventor 2012.
I've tried adding the code to the 'Model Paremetrs' event trigger - no luck. Any more suggestions?
@CadSetterOut
Please use the
Re: Trigger iLogic rule on change of parameters in Assembly, 'Link Parameters ' t
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You may need to fire an event within the assembly that activates an ilogic rule within the part.
E.g. insert a rule within your part and call the rule from the assembly rule.
Re: Trigger iLogic rule on change of parameters in Assembly, 'Link Parameters ' t
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks PACdrafting. That's exactly the kind of thing I would like to do. Can you point me to any exmaples of how to do this?
@CadSetterOut
Please use the
Re: Trigger iLogic rule on change of parameters in Assembly, 'Link Parameters ' t
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I've knocked up a bit of code to make it happen.
It's not very elegant though. If you have an opionion - please wade in!
Option Explicit
Private WithEvents oModelingEvents As ModelingEvents
Private paramExpression As String
'Run code in back ground as soon as the document opens
Sub AutoOpen()
OnParamChange
End Sub
'Look out for parameter changes
Public Sub OnParamChange()
Set oModelingEvents = ThisApplication.ModelingEvents
End Sub
'If a a parameter changes - run the "Table Rule"
Private Sub oModelingEvents_OnParameterChange(ByVal DocumentObject As Document, ByVal Parameter As Parameter, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)
RuniLogic "Table Rule"
End Sub
'This stuff runs an iLogic rule from inside VBA
Public Sub RuniLogic(ByVal RuleName As String)
Dim iLogicAuto As Object
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
If oDoc Is Nothing Then
MsgBox "Missing Inventor Document"
Exit Sub
End If
Set iLogicAuto = GetiLogicAddin(ThisApplication)
If (iLogicAuto Is Nothing) Then Exit Sub
iLogicAuto.runrule oDoc, RuleName
End Sub
'This function gets the iLogic API
Function GetiLogicAddin(oApplication As Inventor.Application) As Object
Dim addins As ApplicationAddIns
Set addins = oApplication.ApplicationAddIns
'Find the add-in you are looking for
Dim addIn As ApplicationAddIn
On Error GoTo NotFound
Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79 -2179-4b11-8a5a-257b1c0263ac}")
If (addIn Is Nothing) Then Exit Function
addIn.Activate
Set GetiLogicAddin = addIn.Automation
Exit Function
NotFound:
End FunctionI have this saved in the document VBA module.
I wish iLogic had more event hooks to make this sort of thing happen.
Paul
@CadSetterOut
Please use the
