AutoCAD Inventor :: Changing Part Parameters From Assembly / ILogic
Jun 12, 2013
Is there a standard command or command sequence that allows for the changing of a parameter, say length, of a component from within an assembly. I'm looking to compile a code that allows for a template to be created, then that template will do changes based on text box input and then save out the modified parts with new part numbers.
Is there a way to work with parameters on a suppressed assembly using iLogic.Everything works fine, but when I suppressed a part ilogic rule give me an error: Parameter: The component named "xxxxx:1" was not found.
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 need to use parameters of a part in an assembly. How to do this? Do i need to define a rule? How is this done?
Can i do it without using an Excel sheet as a parameter source for both the assembly and the part? The target is to have inventor update an array of assets as soon as the width of a part is changed whether in Excel or in the Factory properties of the asset.
I am trying to control the parameters contained in a part that is not in my assembly. May sound odd, but I am using the multi body part modeling feature to create all of my bodies in a single part file, then making these components/sub assemblies, and pulling them into my assembly. However, I do not want to have the "control part" in my assembly, I just want it to drive the parts. I cannot figure out how to access these parameters without having the part included in the assembly...
I have the following problem. I design a simple part - an extruded base, so i have a parameter in this part that i can control the extrusion distance - i call this parameter D.
Then i create an assembly and place the part in it. How can i access the parameter D of the part from within the assembly?
I want to place multiple instances of this part in my assembly and control each parameter D of an instance using an excel worksheet that is linked with the assembly. How can i do it ?
My aim is to design a very simple manipulator. Each link has the same shape but a different length. I want to control each length from an excel worksheet and not from an ipart table. I want to have only one worksheet that controls the parameters of my assembly such as constraint angles , and link lengths.
My goal is to open have people go into a central assembly file, type in their specific parameters and the various part files update within the assembly. I wish to do this without the need for an excel sheet, but when I try to link the parameters from the assembly file to the part files, it will not allow me to insert these parts. I get an error about an "assembly can not be placed into itself."
Iparts will not work as this has an infinite amount of sizes.
I have two user parameters saved in a part template that are tied to the part volume and an overall estimated part weight. The user parameter Pc_Volume is the volume in cubic feet and calculated by pulling the part mass (in cubic inches) and converting to cubic feet via ilogic rule. This is then automatically run via event triggers before a file is saved and if the part geometry has changed to keep the volume up to date. These are exported because they get pulled into iproperties of our drawing files as well as used to create a parts lists showing the volumes and weights.
I have the property formats of the user parameters set to Number and to unitless and the unit display turned off so it does not show on the parts list, with a precision of 0.000 for Pc_Volume. The Pc_Weight is set the same way however with a precision rounded to the nearest whole number.
These are created this way so when we use the part file as the template when we select "Make Components" to separate our parts and tie them to an assembly all the files are then updated and the information saved for exporting.
The problem is, the Pc_Volume always comes in rounded to a whole number. The Pc_Weight Does as well, but that doesn't bother me since we want it to do that anyway. If I would go into the part file after it's created, double check the precision and then re-run the rule the volume will show up with the correct precision in the exported parameters. I don't want to have to open each partfile however to get this to update.
Attached are images of the parameters, ilogic rule, and exported results.
I have an assembly which contains a CComPtr<ComponentOccurrence> pThisCompOcc , and I'd like to do two things.
Get the name of the "base" object, not the display name of the occurence Change the model and user parameter values of the occurrence I suspect that I need to find the function or method which gives me a CComPtr<PartComponentDefinition> pPartCompDef which the occurrence points to for the Q1, but what about Q2?
Presumably the parameters are associated with the Component Occurrence and the "real" name is associated with the Part Component Definition?
How to run iLogic Rule which I created for .ipt file in assembly?
As I have a myPart.ipt file with iLogic Rules which could create part1.ipt, part2.ipt, ..... (hundreds of them).
Now, I want creats iLogic Rule in myAssembly.iam to run the iLogic Rules in myPart.ipt in order I could create correct .ipt file to be used in myAssembly.iam.
I have the same ilogic part placed in the same assembly, and i am trying to drive two different configurations of the same part and when i apply the configuration it changes both of the parts but to only one of the configurations.
Is there a way to drive them seperately even though they are the same part.
Before using iLogic, I created lot of iAssembly and iPart. I could change iPart factory member when I need in iAssembly.Now, I want to move everything to iLogic.
how could I change the part by iLogic code?
For example:
I generated "Part1.ipt" and "Part2.ipt",...... (I have hundred of member)
In my assembly, sometimes, I need use Part1.ipt, sometimes I need use Part2.ipt.
Which is the iLogic Code I should to use?
Inventor 2009, WIN XP. Autodesk Inventor Professional 2013 (64 Bit) SP2 Windows 7 Professional Service Pack 1 Intel(R) Xeon(R) CPU E5645 12.0 GB Memory
I have made an iLogic external module who copy the iProperties from an Excel files, when i open the module from the *.ipt file il works perfectly. But i need this function from *.iam files.
Something like this: when i click with right button in one selected part of assembly i can open the module only for this part and when i save it save the change for all modify part of *.
I'm trying to write a script which would process all the ipt files within assembly and launch certain functions according to a ipt file type.
I've already made such script for dimensioning parts which work for standart parts but not for metal sheets.
Here it is:
Sub Main Dim oApp As Inventor.Application = ThisApplication Dim oAssy As Inventor.AssemblyDocument = oApp.ActiveDocument For Each oSubDoc as Inventor.Document In oAssy.AllReferencedDocuments If oSubDoc.DocumentType = kPartDocumentObject Then Dim oPartPropset As Inventor.PropertySet = oSubDoc.PropertySets("Design Tracking Properties") Dim oPartParam As Inventor.PropertySet = oSubDoc.PropertySets("Inventor User Defined Properties") Dim oParameter As Parameter For Each oParameter In oSubDoc.ComponentDefinition.Parameters oParameter.ExposedAsProperty = True Next oParameter If oSubDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Dim d1 = Round(SheetMetal.FlatExtentsLength, 1) Dim s1 = Round(SheetMetal.FlatExtentsWidth, 1) Dim g1 = Round(Parameter("Grubość"),1) FindOrCreateProperty("Długość [mm]", d1, oSubDoc, True) FindOrCreateProperty("Szerokość [mm]", s1, oSubDoc, True) FindOrCreateProperty("Grubość [mm]", g1, oSubDoc,
[code]....
this code distinguishes parts from sheet metal, and launches appropriate functions to get their dimmensions. It just doesnt work for metal sheets somehow. Seems like SheetMetal.FlatExtentsLength is performed from within the assembly, not part as it should be. I must have the addressing wrong. I've tried many things and different functions but nothing works for sheet metal parts.
This code might also be useful for different purposes. I'm also trying to lunch some external scripts for each part within an assembly, but there is no direct function for that (there is one only for internal scripts , based within the file).
I have a multi body part that I componented into an assembly. I am trying to get the assembly parameter in this case, "Height" to drive the parameters in the part model. I think I am using the right code but I get an error when I run the rule.
I've done an Addin which contains a "Place iLogic Component" function. This funcion work properly and the iLogic form is opened at place component time. Now, i would like to be able to open the form after the insertion, for edition purpose. So, i'd like to open the iLogic form of an assembly component (occurence) with the context menu for example.
So, my question is : Is there a way to check if a part or an assembly contain an iLogic form and to open it through Inventor 2012 API ?
I have received a great solution from Bobvdd allowing ilogic control of the view rep in a part file (not an assembly file). The code below works brilliantly when the part file is the active document. However when the part is placed in an assembly and the ilogic is run with the assembly active, the code produces no result. How to modify the top 6 lines of code?
Dim oApp As Inventor.Application oApp = ThisApplication Dim oDoc As Document
When we send 3D models to customers, we always derive the assembly to make it 1 solid part, so the customer cannot disassemble it to copy our product, and then save it as a step file.
I want to Derive an assembly to a part and then save it as a *.step file with an ilogic rule.
I worked out the last part, but i cannot find the Derive assembly code anywhere.
Im not an experienced programmer, i can only Copy paste, so if the solution is already posted in a simular rule, i will not be able to pick what i need from the code
Wikihelp states that it's possible to get the COG of a part within an assembly.It doesn't seem to work anytime getting an error on some missing included references .do I need a Sub-Rule inside the single part?
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?
We have an iLogic assembly with to parts in it. Maybe to cylindrical parts. The iLogic rules should do the following.
1. Start a Rule after open document.
2. This Rule starts a Rule in the first cylindrical component.
3. This Rule ask the user for a diameter.
4. The assembly gives this new parameter value to the second component
5. Then the assembly calls another rule in the second component to change it with the new parameter
Everything is working fine when the following combinations are taking place:
1. I open up the assembly out of vault or from a local drive or an accessible server drive
2. I insert the assembly as sub assembly in another assembly from a local drive or an accessible server drive
It don't work with the following situation:
- I insert the assembly as sub assembly in another assembly out of vault
Then the user becomes the dialog "Choose a diameter" twice.
I don't know why, but I have the idea it has something to do with the functionality of inventor to insert a component more than once. If you insert a component in an assembly Inventor gives you the opportunity to add more than one occurence after each other.
change that behaviour? Maybe a switch to change that inventor "add more than one occurence" behaviour.
I want to be able to control the location/position of a component in an assembly. This is easy enough through the iProperties/Occurrence tab and then adjust the location of the X,Y, and Z offsets. Is this possible using iLogic? I have been unable to find a function to access via iLogic. Ultimately I am trying to translate a component about an axis not a pattern.
I'm having some difficulties with iLogic and reference parameters.
I have made a tube with a weird shape and I want to measure the longest length. So I have to cut the tube in a certain angle in relation with the center to measure the length.
The problem is that this angle is really hard to calculate.
So I tried making a rule where I can make my angle shift x degree and then measure the longest length. If the measurement is larger the previous measurement the angle will shift x degree again until the measurement is smaller than the previous.
So I made my starting angle 0 degree, I know this is for a fact not the longest length. And then I tried this rule. (before making a While rule).
And I noticed that on screen the measurement changes. But the reference - parameter stays the same. So it gives me the measurement on the starting angle & after rotating it again gives me the starting angle.
How can I get the parameter to update itself in between?
Dim measurement_length As DoubleDim measurement_length2 As DoubleMessageBox.Show("Start angle ", "My iLogic Dialog", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1)angle_measurement_spec = 0RuleParametersOutput()InventorVb.DocumentUpdate()measurement_length = [code].....
I would like to save parameters marked as Key to an XML-file (from an Inventor addin, VB.NET):
Dim addIn As ApplicationAddIn = m_inventorApp.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}") 'iLogic addin addIn.Activate() Dim iLogicAddin As Object = addIn.Automation iLogicAddin.ParametersXmlSave(invDoc, "c: emp ext.xml", iLogicAddin.XmlSaveOption.KeysOnly) This doesn't run: "Public member 'XmlSaveOption' on type 'iLogicAutomation' not found."
In the attached file there is a User Parameter, "Antal_ledekasser". Inventor has calculated its value to 2.
If you do the math by hand then you see the value should be 5.
Rebuild doesn't force recalculation.
There is an iLogic rule in the part, but this also fails to force recalculation: iLogicVb.UpdateWhenDone=True InventorVb.DocumentUpdate() ThisDoc.Document.Rebuild2 ThisDoc.Document.Update2
Manual work around is to change the formula, then the value is recalculated.
iLogic work around is to change a parameter-value - and run the rule TWICE.
Question: How do I force a real rebuild, that actually wil recalculate parameter-values the first time I run the iLogic rule?
Background: The attached file is a little subset of the skeleton in a large assembly that is controlled by iLogic. The rules are placed in the topassembly, and writes vaules to the skeleton-file.
After writing values to skeleton-parameters I try to force them through with this iLogic RuleParametersOutput() InventorVb.DocumentUpdate() iLogicVb.RunRule("Skeleton", "Update")
Later in the process I use calculated values to decide which components should be active. But my logic fails because my decisions are made on faulty values.
I did manage to get the updating work in 2011. But after migrating to 2012, it seems impossible to have it update correct. The user has to run rules several times, and doing manually updates to get a correct model.
I want to export reference parameters to an excel table using i-Logic
I found the function GoExcel.CellValues("filename.xls", "Sheet1", "A2", "A10") = MultiValue.List("d0")
It looks like the syntax calls for the file location and name if the xls file is not open and if open is not supposed to be required.
I have entered it both ways and with and with out the target file open and with the function GoExcel.Open("pathFilename.xls","sheet1") and continue to get the error:
we couldn't find C:AbellAbell VaultWorkSpaceDEVELOPMENTAC100-0100MRLTEST Table.xls. Is it possible it was moved, renamed or deleted?
Also, I was expecting that to fill in the sheet cell's would be MultiValue.List("d0","d1","d2")
but the system give me an error that says
Error on Line 3 : Overload resolution failed because no accessible 'List' accepts this number of arguments.