I have a assembly with several locked design view reps.
I insert a couple of new parts to assembly.
Now, do i have to manually unlock each of the design reps to have these new parts visible in the each of then design view reps?
If yes, does any one have any macro or ilogic tool to do this?
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi CAD-One,
Here is a quick iLogic rule to find the active view rep, unlock all view reps, place a component, then relock all view reps, then unlock the active view rep. It's not perfect but should provide an example that you can tweek.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'set a reference to the assembly component definintion. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'define view rep Dim oViewRep As DesignViewRepresentation 'record the active view rep name Dim sActiveViewRep as String sActiveViewRep = oAsmCompDef.RepresentationsManager.ActiveDesignViewRepresentation.Name 'Unlock the View Reps For Each oViewRep in oAsmCompDef.RepresentationsManager.DesignViewRepresentations 'skip the master view rep If oViewRep.DesignViewType = DesignViewTypeEnum.kMasterDesignViewType Then 'do nothing 'skip any private view reps ElseIf oViewRep.DesignViewType = DesignViewTypeEnum.kPrivateDesignViewType Then 'do nothing Else 'unlock the View Rep If oViewRep.locked = True Then oViewRep.locked = False End If End If Next 'Place a component Dim oFileDlg As Inventor.FileDialog = Nothing InventorVb.Application.CreateFileDialog(oFileDlg) oFileDlg.Filter = "Inventor Files (*.iam;*.ipt)|*.iam;*.ipt|All Files (*.*)|*.*" oFileDlg.DialogTitle = "Select a File to Place" oFileDlg.InitialDirectory = ThisDoc.Path oFileDlg.CancelError = True On Error Resume Next oFileDlg.ShowOpen() If Err.Number <> 0 Then MessageBox.Show("File not chosen.", "Dialog Cancellation") ElseIf oFileDlg.FileName <> "" Then selectedfile = oFileDlg.FileName ' Set a reference to the transient geometry object. Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry ' Create a matrix. Dim oMatrix As Matrix oMatrix = oTG.CreateMatrix 'Iterate through all of the occurrences Dim oOccurrence As ComponentOccurrence 'place an instance of the component 'in this case at 0,0,0 oOccurrence = oAsmCompDef.Occurrences.Add(selectedfile, oMatrix) ' Set the translation portion of the matrix so the part will be 'positioned at the co-ordinates oMatrix.SetTranslation(oTG.CreateVector(0, 0, 1)) End If 'Re-Lock the View Reps For Each oViewRep in oAsmCompDef.RepresentationsManager.DesignViewRepresentations 'skip the master view rep If oViewRep.DesignViewType = DesignViewTypeEnum.kMasterDesignViewType Then 'do nothing 'skip any private view reps ElseIf oViewRep.DesignViewType = DesignViewTypeEnum.kPrivateDesignViewType Then 'do nothing Else 'lock the rest of the View Reps If oViewRep.locked = False Then oViewRep.locked = True End If End If Next 'unlock the last active View Rep oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(sActiveViewRep) oViewRep.Locked = False oViewRep.Activate iLogicVb.UpdateWhenDone = True
Thanks Curtis.
I get error on line 9, 12, 59 and 73.
Can you guide me on how to fix?
Hi CAD-One,
My guess is some copy/paste formating issue with the forum. Attached is the same code in the *.txt file that should work better.
If you still get the errors let me know and I'll try to have another look.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Curtis, You saved ton of my time. Thanks
Can't find what you're looking for? Ask the community or share your knowledge.