AutoCAD Inventor :: How To Run Rule In Part File From Rule In Drawing File
Aug 21, 2012
I am trying to use iLogic to create the file types I need to give to my vendors once I have created a drawing.In the .idw file I have a rule that creates a .pdf file and .dwg file. I also want it to activate a rule I have in the .ipt file that creates a .dxf file.
trigger = iTrigger0oType=Left(ThisDoc.FileName(False),3)GoExcel.Open("S:DRAWINGSFolder Types.xlsx", "Sheet1")For rowPN = 1 To 200 If (GoExcel .CellValue("A" & rowPN) = oType) Then oFile = GoExcel.CellValue("C" & rowPN) Exit For End IfNextoFolder = "S:DRAWINGSNOT RELEASED" & oFileIf Not System.IO.Directory.Exists(oFolder) ThenSystem.IO.Directory.CreateDirectory(oFolder)End IfThisDoc.Document.SaveAs(oFolder & "" &
I 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?
I 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)
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;
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)
I`m looking for the iLogic code that can change one parameter (user defined) for each (ipt) part in assembly (iam)
The one below doesn`t work.
Sub Main Dim oApp As Inventor.Application = ThisApplication Dim oAssy As Inventor.AssemblyDocument = oApp.ActiveDocument For Each oSubDoc as Inventor.Document In oAssy.AllReferencedDocuments On Error Resume Next Parameter(oSubDoc, "FH") = 15.26 Next End Sub
I would like to make an External Rule that would make an iLogic Internal Rule (with the same code every time). I guess what I really need is a way to drive an Ilogic rule into every part that does not have the rule in the part already.
I know what you’re thinking and just using the External Rule doesn’t work for what I want to do. I need it to be an iLogic Internal Rule.
iLogic rule that will retrieve a part number(s) from an excel sheet. I work for a company that built vacuum trucks and I'm trying to make an . I am template where the user can select different lengths of shells to achieve the desire overall length. I have been able to achieve this using iLogic rules and forms and making the shell length parameter multi value.
But now I need to show predetermined SAP part numbers for the shells in BOM or part list. I all ready have an excel sheet with shell sizes with corresponding part numbers on file. I also thought about incorporating our custom CC parts/shells that already have the SAP part numbers set up as a custom iProperty but might be to complicated for a newbie iLogic user.
is it possible to rename the browser node on part level with an iLogic rule? I know that in the assembly environment is an Inventor OOTB functionality to rename the nodes to the filename, Part number or the default value.
Inventor Professional 2011 Windows 7 Enterprise 64bit Dell Precision M4500 Intel(R) Core(TM) i7 CPU Q 820 @ 1.73GHz 8 GB RAM
I have setup all our Sheet Metal Rules to be all of our stocked in house sheet metals. The sheet metal rules are named like:
ALUM 5052 H32 1/2" (Part Number) ST STEEL T304 3/8" (Part Number) STEEL 44W 1/8" (Part Number) etc.
And each rule has the proper thickness, material, and some standardized bend radius's. I've done this to introduce more uniformity in our designs, and to also allow the designer to put as much information into the model as possible, so that if someone else does the drawings, there is no question as to which material is used.
I now want to bring in the Sheet Metal Rule name into the drawing automatically. I can't seem to find a way to reference the Sheet Metal Rule directly from the drawing. What I need to do is pick a standard field in the i Properties (I used Stock Number), and put in =<Sheet Metal Rule> so that now the Stock Number references the Sheet Metal Rule, and then in the drawing I can just reference the Stock Number, and it will come in.
I don't like having to use the Stock Number as a middle man though, as none of our existing models are setup like this. Is it possible to reference Sheet Metal Rule in the drawing without having to use another field as a placeholder for the information?
In our drawing file we expose the mass of the part. So I have set the 'Update physical properties on save' in the 'Application Options'. This works fine when you save your file before switching to the drawing file. If you forget to save and go to the drawing file the mass is showed as: N/A.
Therefore I have created a rule which updates the mass of the part. This rule is activated with the 'Part Geometry Change' event trigger. This is done to update the mass in the drawing file even when the partfile is not saved. This works fine. If I make any changes to the model the mass is updated correct, EXCEPT for deleting features. When I delete a feature and switch to the drawing file the mass is shown as N/A again. So apparently deletion of any feature is not recognized as a 'Part Geometry Change' because the rule isn't triggered.
I would like a few rules to be triggered once the new drawing template is opened.select sheet size, I have been given a rule that already works, basically the rule selects a border and title block based on sheet size selection.
I would also like a rule to let me annotate in metric or imperial. this is where I require assistance. I am not sure the best way to achieve this rule. My programming is very basic.I have found some links here, but I can't seem to make them work in the drawing environment. Also these rules seems to change the units of an already created .ipt.
Rule #1 Link
Rule #2 Link
I am just looking for a rule to select either .in or mm from the styles library(i think) , before I even place a base view. Regardless of the original units used to make the model.
Currently have an iLogic rule in my drawing template that base on user input brings up the Drawing View dialog box (as though you click on base view). I want to know if there is some coding I can do to control or handle what happens if the user clicks the cancel command inside this dialog box. Possibly show a message box. Or even run another rule after the cancel button has been clicked?
I’m wondering if there is a rule-of-thumb that one can use to predict the approximate size when exporting a raw file in Lr to a jpeg file. For instance, would an average 25 Mb raw file convert to about 5 Mb jpeg with the Lr export quality set to 100? To about 3.5 Mb with a quality of 80? …
I know the size will vary, but when I am exporting a collection of raw files and I have set the max file size to a certain amount, Lr sometimes won’t convert all the images because I have limited the file size too small. I’d like to be able to get a handle on some sort of quality/file size relationship before I start the export process.
I sometimes create parts that are very similar to one another. (ie. - complex plate, but one part uses threaded holes, while an identical one has through holes, with all holes in the same location). So before now I would have built one part, made my drawing file. Then Copy/paste the part file into the same assembly folder, edit the hole feature of the newly copied part, then have to create an entirely new drawing file for the new copied part.
Is there a way to just copy my already created part drawing, and then just change the part file it used? They are basically the same part, but one uses threaded holes, the other uses through holes. My current way seems redundant and time wasting.
I 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.
I 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)