AutoCAD Inventor :: How To Create External ILogic Rule
Jul 3, 2012How to create external ilogic rule?
View 3 RepliesHow to create external ilogic rule?
View 3 RepliesI want to simply set a custom iproperty as the Description in each part file within my assembly. I can do this easily at part level with ilogic but I want to be able to run the rule from the assembly level and all the parts run the rule. I am struggling to find a way to do this.
I think this may be the best method I have found but I think it must be far easier?
[URL].......
I am working for customer with a simple item with his iLogic design. He has created a simple form to modify his iProperties. To modify the current material, a multi-value parameter was created and the following rule as a local rule;
"MultiValue.List("MATLIST") = iProperties.Materials
iProperties.Material = MATLIST"
He is now trying to make this an external rule but gets the following error
Error in rule: Mat2, in document: Mat2.iLogicVb
iProperties.Material: is probably a bad material name.
The more info tab says:
System.ArgumentException: iProperties.Material: is probably a bad material name.
at iLogic.CadPropertiesInRule.SetDocMaterial(Document doc, String matName)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Is there someway to launch an external iLogic rule with VBA?. I'd like to add a button to run the iLogic rule.
Inventor Pro 2013 (PDS Ultimate)
Vault Pro 2013
Windows 7 64
Xeon 2.4 Ghz 12GB
why this will not run as an external rule? It runs fine as an internal one.The error I get is object referance not set to an instance of an object?
'Updates rule when done
iLogicVb.UpdateWhenDone=True
'Creates input list dialog box & allows the user to choose the state
Product_Code=InputListBox("Enter Product Code", MultiValue.List("Product_Code"), Product_Code, Title :="Product Code", ListName :="Available Codes")
'Writes values to iProperty
iProperties.Value("Project", "Cost Center")=Product_Code
Created in the template sheet metal rule. Why External ilogic rule is not working? User-valued parameter is created, sheet metal rule does not change.
name = ""For Each par In ThisDoc.Document.ComponentDefinition.Parameters.UserParameters If par.Name = "SMR" Then name = par.Name Exit For End IfNextIf name = "" Then Dim MyArrayList As New ArrayList For Each st In ThisDoc.Document.ComponentDefinition.SheetMetalStyles MyArrayList.add(st.Name) Next ThisDoc.Document.ComponentDefinition.Parameters.UserParameters.AddByValue("SMR", "", UnitsTypeEnum.kTextUnits) MultiValue.List("SMR") = MyArrayList Parameter("SMR") = SheetMetal.GetActiveStyle()End IfSheetMetal.SetActiveStyle(Parameter("SMR"))iLogicVb.UpdateWhenDone =TruePS:
Is it possible to place an external iLogic rule under a specific Event Trigger in a file via the API?
Inventor Professional 2014 64 Bit
Windows 7 Professional
NVIDIA Quadro FX 4600
Dual Intel Xeon E5540 CPUs
16GB DDR3 Ram
I've made an External rule in Ilogic that must read a parameter value (Thickness) to set a value in a property (StockNumber).
The value is not written to the property by Using 'Select Case', see code. There is no error or something like that. So what am I doing wrong?
Tested in an internal rule, where Select Case = <Thickness> instead of Parameter ("Thickness") and that works fine.....
Select Case Parameter("Thickness")Case 2iProperties.Value("Project", "Stock Number")="686001"Case 4iProperties.Value("Project", "Stock Number")="686002"Case 3iProperties.Value("Project", "Stock Number")="686003"End SelectiLogicVb.UpdateWhenDone = True
I tried to read an environment with iLogic and to combine it with an external rule name and to pass the whole path over to iLogicVB.RunExternalRule.
StrPath = Environment.GetEnvironmentVariable("ILOGIC_DIR")ilogic_rule = "IPT__01_New_Document_EXT.iLogicVb"rule = StrPath & ilogic_rule'MessageBox.Show(rule, "iLogic Rule to execute")iLogicVb.RunExternalRule(rule)
The message box shows the correct path, but I allways receive a error massage:
'GetEnvironmentVariable' is not a member of 'Inventor.Environment'
My company has recently switched from the H drive to the G drive. This has resulted in a lot of old files still referring to the H drive where the External Ilogic rules used to be. I'm wondering if there's any automatic way to change that? Uploading a pic showing the event triggers as they are now.
Inventor 2014 Professional
Windows 7 Professional 64 bit
Intel Xeon E3-1240 @ 3.4 ghz
Nvidia Quadro 600
8.00 gb RAM
I need import all new params, rules and forms from a new template to older parts. I'm trying to use an external rule to create a new iproperties and import params from xml file but I can't assign these parameters with these iproperties.
I attach the code.
I'm trying to figure out how to create an iLogic rule that would create a Custom iProperties and put in what version of Inventor the file was last updated with.
View 8 Replies View RelatedI want to create a rule that will warn the user when the plate thickness they are using is not standard. I have already created a multivalue parameter for plate thickness, which lists all standard steel plate thickness's and also allows for custom values.
I was hoping I could create a rule that would prompt a dialogue box warning when the user creates a custom value for plate thickness.
I know this can be done, but like I said, Im bloody useless with iLogic and find it hard to come across relevent examples and/or tutorials online.
How to create a measurement between two planes using ilogic rules?
I have created the planes on the asssmbly parts but dont know how to directly pick them.
The measurement is going to be used as reference dimension.
How would I go about creating a rule in iLogic which would limit the minimum length of a pipe (parameter = Pipe_Length) to be half the outer diameter of the pipe (Pipe_OD), in other words "Pipe_Length ≥ Pipe_OD/2"
I know you can use the limits wizard in iLogic, but is that not only for numerical values as opposed to parameters?
Is there a way to invoke the iLogic Rule Editor and pass it an existing rule name or external rule for editing?
View 4 Replies View RelatedI need a way to run a rule which is saved in my top-level assembly using iLogic rule which is saved in a part file in the parent assembly.
I have even tried using an external rule in a txt file, but that gives the error "Component: This function can only be used in an assembly." - which makes no sense to me. I hope I am just missing something simple. I cant believe with all its other strengths, that iLogic would be so limited in that regard. Why is there not simply a snippet under the 'Run Other' that allows you to specify an assembly file and the rule name? (like there is for running a rule in a component from the assembly)
how can I close an iLogic Form from either an iLogic Rule, or a VBA Rule (VBA is the Preferred method)?
View 5 Replies View RelatedI have an ilogic external rule which contains functions that I use from rules in my local assembly document. I'm trying to access the value of a parameter in the document from the external rule's function. Attached is a simple version of what I'm trying to do. If I manually run the external rule, it seems to work just fine, but when I call on the function from a seperate rule, its unable to get the parameter value. I get an error stating, "'Parameter' is not declared. It may be inaccessible due to its protection level."
'this is the external rule. if I run this manually, it works
Public Class test_functionsSub Mainmyresult = ""thisisatest(myresult)MsgBox(myresult)End SubFunction thisisatest(ByRef resultcreated As String)resultcreated = "it worked - " & Parameter("ParameterInDocument")End FunctionEnd Class
'this is my rule in the assembly document trying to use the external rule's function
AddVbFile "z_testrule.iLogicVb"Dim external_rule As New test_functionsmyresult = ""external_rule.thisisatest(myresult)MsgBox(myresult)
Is it possible to run an external rule in assembly occurrences?
You have RunRule in Component, But it does not seem to work with external rules
I referenced to occurrences and opened it using ThisApplication.Documents.Open(filepath, False)
Then i tried calling the same external rule. I thought it would run the external rule in the opened file,
but I ended up with a infinite loop on the main assembly.
Is there a way to run your rule in every occurrence with external?
Is there any way to pass an array from an internal rule to an external rule in iLogic?
View 2 Replies View RelatedI'm currently using this rule for easy PDF making
SaveLoc = "C:Temp"FileName = ThisDoc.FileName(False)Revnr = " rev_" & iProperties.Value("Project", "Revision Number")PDFnaam = SaveLoc & FileName & RevnrThisDoc.Document.SaveAs(PDFnaam & (".pdf") , True)MessageBox.Show("PDF is aangemaakt in C:Temp", "Document creation",MessageBoxButtons.OK,MessageBoxIcon.Information)
The problem with this is that i want to save without lineweight? is there anyway to do this with this code?
I have an ilogic rule with multiple Subs. How could I run one specific sub contained in that rule from an iLogic form or another rule?
View 2 Replies View Relatedi have an iLogic rule in serveral files. Now this rule has to be deleted. This should be done with VBA. I can not find any function to delete a rule using VBA.
I found a function iLogicAuto.RunRuleDirect(rule), but not iLogicAuto.DeleteRule(rule) ...
I can not find any documentation for iLogic/VBA.
I have an iPart which includes iLogic Rule. When I change iPart by table, iLogic Rules are not triggered.
In iLogic Utilities, there is a button "Rules Triggered by Events", If I use "Any Model Parameter Change", the update need long time, looks like Inventor is "No Response". I like the way "Material Change", but I need "part Number" change to trigger the rules. How can I do it? I tried other events as After Open, Before Save, etc, they are does not work.
I have a rule setup for drawings. I need the rule to first determine if the there is a flat pattern view present. In other words, if there is no flat patter view, I want to the rule to stop.
I am very green to ilogic and VB. Running Inventor 2013.
I've caught glimpses of how to do this (For instance, this plugin (Inventor LinkParameters) [URL]...... when trying to actually find information on any documentation of how to get from point A to point B. I can't seem to find anything about ilogic automation / rule creation / ilogic in general, in the object browser at all.
I know code like this exists
Option ExplicitSub RuniLogicRule()Dim iLogicAuto As ObjectSet iLogicAuto = GetiLogicAddin(ThisApplication)If (iLogicAuto Is Nothing) Then Exit SubDim doc As DocumentSet doc = ThisApplication.ActiveDocumentDim ruleName As StringruleName = "Rule0"Dim rule As ObjectSet rule = iLogicAuto.GetRule(doc, "Rule0")If (rule Is Nothing) Then Call MsgBox("No rule named " & ruleName & " was found in the [code].......
(and even fixed the error it gave me due to the original code leaving something out) , but any info on the GetRule method is.
I would like to instantly launch an External Rule just by clicking on a button in the Global Forms area of the iLogic browser. Is this possible, and if so, how would I do it?
Product Design Suite Ultimate 2014 | Vault Basic 2014 (SP1)
Dell Precision M6600 | Intel i7-2820QM - 16GB
nVIDIA Quadro 4000M | Windows 7/64 Pro
Is there any way to create a rule to create a substitute on my weldment files?
what I need is something like:
If this document file type is weldment then create shrinkwrap substitute, go to the file (substitute) read the custom iproperty "area" and write to this document custom iproperty "area for sand-blasting" activate LOD Master then delete substitute LOD.
The propose is for purchase department to know the area of the assembly (only the area of visible surfaces).
Is there any command/option to add a keyboard shortcut for ilogic rule?
Config :: Intel (R) Xeon (R) CPU E31245 @ 3.30 GHz, 16.0 GB, 64bit win7
Inventor 2013 and Vault Basic 2013
When i trying to create a new ilogic rule i get window with this error:
Spoiler (Highlight to read)System.InvalidCastException: Невозможно выполнить приведение [A]iLogic.CodeSnippets к [B]iLogic.CodeSnippets. Источником типа A является "Autodesk.iLogic, Version=17.0.13800.0, Culture=neutral, PublicKeyToken=null" в контексте "Default" в расположении "C:PROGRA~1AutodeskINVENT~1BinAutodesk.iLogic.dll". Источником типа B является "Autodesk.iLogic, Version=17.0.13800.0, Culture=neutral, PublicKeyToken=null" в контексте "LoadFrom" в расположении
[code]..........