AutoCAD Inventor :: Setting Sub-component Appearances With ILogic?
Nov 7, 2013
I am trying to set the appearance of sub-components in an assembly using iLogic.
Dim oDoc As Inventor.AssemblyDocument = ThisApplication.ActiveDocument Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinitionDim oCompOcc As Inventor.ComponentOccurrence 'parts in the assemblyFor Each oCompOcc In oCompDef.OccurrencesoCompOcc.Definition.Document.ActiveRenderStyle = oCompOcc.Definition.Document.RenderStyles("HVGM")Next
What I am trying to do is insert a part into an assembly file using iLogic. I basically want to mimic Inventor’s “Place” command using ilogic, maybe something like this:
I'm trying to play around with iLogic for creating dynamically dimensioned subassemblies. I've created my dimensioning rules that link to the parts I wish to change dimensions on.
And I've tested this in the SubAssembly I've created and all appears fine. However when I go to insert the sub assembly into the main assembly I get the following error:
Parameter: The component named "Bridge Spine:1" was not found.
I've noticed that the new sub assembly has created new parts with the extension -01 on the end of each part (As expected) It appears that this link is being lost in the rule for the new sub assembly. i.e the rule is looking for Bridge Spine:1 instead of Bridge Spine-01:1
I have a code which I want to rotate a part. I have a text parameter 6 and 7. If one of the values is active I want to give the component a certain rotation.
Under the 'Hoekkoppeling' parameter is the angle constraint.
Below the
If Parameter ("KlemHoekstuk-01: 1", "KoppelingType") = 7 Then Hoekkoppeling = 60 deg ElseIf Parameter ("KlemHoekstuk-01: 1", "KoppelingType") = 6 Then Angle = -60 deg End If
I now get always an error on the second and fourth line.
I feel that the specify for the value is incorrectly.
I created a simple Part with some parameters to drive dimensions. Saved the part. I created an Assembly. Saved the assembly. Clicked Place iLogic Component. The Place iLogic Component window appeared Selected the Part. I can see the preview window (Part-01) & the parameter window... Used default values. Hit OK NO PART INSERTED! Using Inventor Pro 2014 64-BitLudesroc
How to modify the code below to delete suppressed parts in a pattern (entire pattern)?
Dim oComp As ComponentOccurrenceDim oComps As ComponentOccurrencesoComps = ThisDoc.Document.ComponentDefinition.OccurrencesFor Each oComp In oCompsIf Component.IsActive(oComp.Name) = False Then oComp.DeleteNext
Code works fine if there are single instances of the part. It throws a error when you have a suppressed pattern.
I have a wall of frames, if you will, and some frames within this wall are different sizes. When doing the BOM, I want to be able to combine anything that has the same stock number as well as the same cut length. The only way I have thought to do this so far is to cycle through each stock number and if the cut length is the same, I override the quantity of one and change the BOM Structure of the other to "Reference".
How can I change the BOM Structure to reference without selecting the part or going through the BOM Editor? Is there some VBA code I could utilize? I am striking out by solely using iLogic.
Is there code for changing the color (or other properties) of the visible edges of a component in a drawing view, the same way I can do it manually by right-clicking a component and choosing Properties?
I wrote this rule to change the color of each individual drawing curve:
Edit: Ignore the "<!". It's the only way I could get the iLogic code to successfully post in the message
Spoiler (Highlight to read)<!Dim drawViews AsDrawingView For Each drawViews In ThisApplication.ActiveDocument.ActiveSheet.DrawingViews occ3 = drawViews.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition.Occurrences.ItemByName("GF_Plenum:1") Dim newColor3 As Color newColor3 = ThisApplication.TransientObjects.CreateColor(0,255,255)
If I set this to true, then when I "place iLogic component", I don't get the form displayed or the parameter table or the model preview.
If set True, displays the form when placing this model as a component in an assembly. This setting affects Place Component and Place iLogic Component. If the template file has a form, this setting also affects Create In-Place Component.
The commented code does not work. I want to be able to open a part and change its size parameters before i open the assembly. this code will run as an external rule in a new empty file.
If i can do it without opening the part, that is even better. Test can I open a part, change a param, then close part.
Dim fname As String fname ="C:Workspacemy_progchanF_BB_L.ipt" Dim pDoc as PartDocument = ThisApplication.Documents.Open(fname,False) pDoc = ThisApplication.Documents.Open(fname)
These are just attempts to find a syntax that works. I need the method to change the parameter.
I have a simple code below trying to iterate through all the assembly component and copy the iProperties > Occurrece Name (i.e. "Part1:1") and paste it to iProperties > Project tab > Part Number field for each individual part in assembly.
' set a reference to the assembly component definintion. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences Dim oName As String oName = oOccurrence.Name iProperties.Value(oOccurrence.Name, "Project", "Part Number") = oName MessageBox.Show(oOccurrence.Name, "iLogic") Next
The Debug message shows the correct output for every iteration, but when I check each part's properties they all have the Occurrence Name of the last part in the aseembly.
So I have been going round and round in circles on this one iam trying to use replace component within ilogic which is fine with switching one part for another but I want a drop down of parts so it replaces which ever one is active the problem I am having is establishing which one is active. So below is what I have so far but the problem is you cant seem to reference a part that is not in the assembly so I keep getting the error
The component named "Flange 1" was not found for example. I just need a way of establishing which one is currently in the assembly but with out referencing components that are not there.
If Component.IsActive("Flange 1")=True Then current = 1 If Component.IsActive("Flange 2")=True Then current = 2 If Component.IsActive("Flange 3")=True Then current = 3 If part = 1 And current = 2 Then Component.Replace("flange 2", "Flange 1.ipt", True) End If If part = 1 And current = 3 Then Component.Replace("flange 3", "Flange 1.ipt", True) End If If part = 2 And current = 1 Then Component.Replace("flange 1", "Flange 2.ipt", True) End If If part = 2 And current = 3 Then Component.Replace("flange 3", "Flange 2.ipt", True) End If If part = 3 And current = 1 Then Component.Replace("flange 1", "Flange 3.ipt", True) End If If part = 3 And current = 2 Then Component.Replace("flange 2", "Flange 3.ipt", True) End If
I found this code to create a custom iProperty in the current, open document:
Dim propertyName As String = "MyProperty"Dim propertyValue as String = "Test Value"customPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")Try prop = customPropertySet.Item(propertyName)Catch ' Assume error means not found customPropertySet.Add("", propertyName)End TryiProperties.Value("Custom", propertyName) = propertyValue
I have a iLogic rule that goes through each component of an assembly, counts how many times it occurs in the assembly, and then assigns that value to an iProparty (i.e. it inserts the total quantity of the part in some iProperty). Currently, however, it assigns the value to a default iProperty value, "Authority". I'd like, instead, for it to assign it to a custom iProperty called "Total QTY". However, I don't know how to tell Inventor to do the above code for a component in the assembly rather than the assembly itself. Below is my entire code. I've labeled where I'm guessing the above code should go. How I'd modify the above code to create the iProperty in the component being processed by the rule at that point?
Current
''True comment: Begin '''Commented-out Begin '''PartDocumentObject = 12290''AssemblyDocumentObject = 12291Dim openDoc As DocumentopenDoc = ThisDoc.DocumentDim docFile As DocumentIf openDoc.DocumentType = 12291 Then''If the open document is an assembly:''For each document referenced in this document:For [code]......
I'm trying to create a rule in ilogic that would search through all child components (looking for both .ipt and .iam file types) looking for an ilogic rule within each child component with a particular name, and running that rule if it is found.
I am looking for a way to create an external rule that will allow me to turn off the visibility of bolt generator items in the model while I am looking at the drawing. Bolts may be buried several subassemblies (4 - 6) deep.
I'm finally wrapping up work on an iLogic Configurator project and have started to brainstorm the best workflow to get this "Smart Assembly" into the design group's hands. I had been anxiously awaiting the new "iLogic Design Copy" feature in IV2012, but just recently learned that users are unable to effectively rename any components with this command.
Is this really true? If we can add prefixes or suffixes, what's stopping us from changing the entire filename? We haven't upgraded to 2012 yet, but it seems like this may be a silly and unjustifiable restriction to a command that would otherwise save our designers hours of "file-management" (ie, manually renaming parts in Explorer, component replace in assy's, replace references in idw's, etc) each week.
Long story short, it seems that every workflow I've come across has had some sort of silly limitation that makes it undesireable for my application:
My top-level assembly contains all of the rules, and changes parameter values in the referenced skeletal parts. It also swaps standard parts for other standard parts as needed.I need access to rename ALL files (idw's, top-level assembly, subassemblies, and base components) while still maintaining/updating all internal hyperlinks between them.iLogic rules must be carried over to the new copied components (the existing "Copy Assembly" command strips the assembly of all rules). In light of the iLogic Design Copy's apparent shortcomings, any better workflow?
I'm trying to set a rule in which i have 2 i parts that i can change the length of . I want a rule where if i change one of them it changes the other to fit with it.
I have been looking around but have not been able to find examples of how (If I can) set the model views via iLogic.
What I am trying to do is to have the view change from "Master" to the view I have created for each part, so when I go to create drawing all I have to select the right view and the part changes to match view.
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 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.
We are having an issue when we replace a component in Inventor Pro 2012. When we replace a component, the name in the browser does not update to the new component. We've even tried to close and re-open the Inventor assembly and that does not work. We end up manual double clicking the name in the browser and type in the new component name.
Inventor Product Design Suite Ultimate 2012 Dell Precision T7500 Workstation Xeon Processor 16 GB of RAM Nvidia Quadro FX 5800 Windows 7 x64
II need a way to tell if a component occurence is a virtual component.
I'm using a For Each loop to cycle through all of the components in an assembly, and if the component is itself an assembly to set the LOD to "Custom". I'm using the definition document descriptor object for this. It all woks fine until the loop comes across a virtual component which doesn't have a definition document, so I need a way to check if the component is virtual and needs to be skipped.Here's the
Option ExplicitImports Inventor.LevelOfDetailEnumSub MainiLogicVb.UpdateWhenDone = TrueDim doc As AssemblyDocumentDim oLOD As LevelOfDetailRepresentationDim oAsmCompDef As ComponentDefinitionDim oComp As ComponentOccurrenceDim oComps As ComponentOccurrencesdoc = ThisDoc.DocumentIf. [code]....
When building wall styles and configuring cleanup priorities for components, what is the methodology? Do I sketch out a bunch of scenarios of various wall styles meeting each other at Ls and Ts and crosses and whatever, and then try to puzzle it all out: "if I set the outer airspace to 400, then when it gets to this T, the airspace will cut through the rigid insulation with its 600 priority, but will get cut through by the sheetrock with its 200 priority....". That seems like a recipe for headaches. So instead, do I just start from one side of a wall (the wall with the greatest number of components, I guess) and assign the lowest priority number (300, say) to the structural component, the highest number (1200, say) to the finish material component, and numbers in between for everything else, and then see how it works, tweaking by trial and error? The table of priority numbers for various materials provided is useful, but I'd like to have a better understanding of how those numbers might have been derived, so I can do a better job of assigning my own numbers to components that don't appear in the list.
Also, if a wall type contains two components of the same material (I'm thinking of the layers of rigid insulation on either side of the concrete in an Insulated Concrete Foundation system), should those two components have the same priority number (probably not), or different ones (seems more likely)?
I have a question pertaining to Inventor Drawings: Occasionally in an .IDW I make a change in the assembly and I notice that most parts do not update to the new size. More importantly, if I make a change to the color or appearance of a part it doesn't reflect in the .IDW. Is there a way that I can make this happen?
Inventor 2013 Windows 7 Professional 64-bit SP1 HP EliteBook 8470w Processor: Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz Memory: 16 GB AMD FirePro M2000 3D Connexion SpacePilot