iLogic event trigering, trying to switch to external rules only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello
I recently switched to 2021 release of Inventor (from 2015) so I got back to review some of my old iLogic rules.
I've always worked with file templates (part/assemblies) that had at least one rule embeded in the actual file/template trigered before save.
I had two seperate rules (part templates) that managed part naming in Title block, one in regular parts, one in sheet metal parts (adding a suffix of sheet metal extents to the description). So I merged them into one iLogic rule that checks if opened file is a regular or sheet metal part. The rule works correctly for a part file, when the part file is opened directly (as single part file), but the rule does not triger (in the part) from assembly level, even when I "browse through" the assembly tree, to that specific part, and force the rule to run. (It propably checks if the active document is a part/sheet metal, but the program returns that it's an assembly?).
1. What I want to achieve for that rule, to convert it to an external rule, that is managed by the new iLogic event trigering functionality, that trigers before save, on all part files, and thus updates file naming (among other things)
One rule that can be run either from the part level itself or assembly level. (Maybe some 'Select case' conditioning? in case the opened file is part doc do this... in case opened as assembly do this... ???)
2. an addition the above, a condition for the rule to skip Content Center generated parts (either screws/bolts etc. & Beams user created CC items and so on)
I'm not using Vault, never did. In the rule I'm using some iProperities fields and custom user parameters which are already in the template part file.
I want to rid of the embeded ilogic coding from the files, so I also will be able to update old projects to new coding ideas I come up in the future.
Any effort regarding my requiest is much appreciated.
Current state of the rule is as follows.
On Error Resume Next Dim curDoc = ThisApplication.ActiveDocument If curDoc.DocumentType = kPartDocumentObject Then 'This is a Part Drawing If curDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then 'This is a SheetMetal Part If SheetMetal.FlatExtentsLength>SheetMetal.FlatExtentsWidth Then Parameter("pY")= Round(SheetMetal.FlatExtentsLength,0) Parameter("pX")= Round(SheetMetal.FlatExtentsWidth,0) Else Parameter("pX")= Round(SheetMetal.FlatExtentsLength,0) Parameter("pY")= Round(SheetMetal.FlatExtentsWidth,0) End If Dim oSMDef As SheetMetalComponentDefinition oSMDef = curDoc.ComponentDefinition oSMDef.FlatPattern.ExitEdit iProperties.Value("Project", "Part Number")=iProperties.Value("Project", "Stock Number") & Round(pGrubość,1) & "x" & pX & "x" & pY Else iProperties.Value("Project", "Part Number")=iProperties.Value("Project", "Stock Number") '& Round(pGrubość,1) & "x" & pX & "x" & pY End If End If pNr=iProperties.Value("Project", "Description") pMasa=Round(iProperties.Mass,3) pObjetosc= Round(iProperties.Volume,6) pPowierzchnia= Round(iProperties.Area,5) 'Data utworzenia Rok=Mid(iProperties.Value("Project", "Creation Date"),7,4) Miesiac=Mid(iProperties.Value("Project", "Creation Date"),4,2) Nowa_data=Miesiac & "." & Rok iProperties.Value("Custom", "Data utworzenia")=Nowa_data iLogicVb.UpdateWhenDone = True
Regards
Marcin.
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.