Hi folks,
I have the below snippet 'Select Beam' which pulls through the parameters of a frame gen beam and holds them locally in the assembly level parameters.
Dim doc = ThisApplication.ActiveDocument Dim BeamPick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter,"Select Beam") If (Not BeamPick Is Nothing) Then oBeamName = BeamPick.Name End If 'Beam parameters are extracted to local assembly parameters If (Not BeamPick Is Nothing) Then Beam = BeamPick.Name SPL_W1 = Floor(Parameter(Beam, "G_W")/2 - (Parameter(Beam, "G_T")/2))-SetBack SPL_L1 = Floor(Parameter(Beam, "G_H") -(2 * (Parameter(Beam, "G_T1")))) -HSetBack DPL_H = Parameter(Beam, "G_H") Web = Parameter(Beam, "G_T") Flange = Parameter(Beam, "G_T1") Rad = Ceil(Round((Parameter(Beam, "G_IR") + 2)) / 5) * 5 End If RuleParametersOutput() InventorVb.DocumentUpdate() ThisApplication.ActiveView.Fit
If the incorrect component is selected I get the following error -
What I'm looking to achieve is a means of rather than getting an error is to exit the rule.
Can anyone suggest something I can add to my snippet that can do this? Would this pull some kind of detail from the iproperties?
I also have a similar rule called 'Select SHS' that I would like to achieve the same thing with.
Any help is appreciated!
Solved! Go to Solution.
Solved by nstevelmans. Go to Solution.
Hi, Maybe this can help
Dim doc = ThisApplication.ActiveDocument Dim oCC As ComponentDefinition Dim oPartdoc As PartDocument Dim BeamPick As ComponentOccurrence BeamPick = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select Beam") Try 'Beam parameters are extracted to local assembly parameters If (Not BeamPick Is Nothing) Then Beam = BeamPick.Name SPL_W1 = Floor(Parameter(Beam, "G_W")/2 - (Parameter(Beam, "G_T")/2))-SetBack SPL_L1 = Floor(Parameter(Beam, "G_H") -(2 * (Parameter(Beam, "G_T1")))) -HSetBack DPL_H = Parameter(Beam, "G_H") Web = Parameter(Beam, "G_T") Flange = Parameter(Beam, "G_T1") Rad = Ceil(Round((Parameter(Beam, "G_IR") + 2)) / 5) * 5 End If Catch MsgBox("Missing Parameters in " & BeamPick.Name & ".ipt" &" Open the Part en check if G_IR,G_T1,G_H,G_W exist",MsgBoxStyle.Critical, "Missing Parameters") End Try RuleParametersOutput() InventorVb.DocumentUpdate() ThisApplication.ActiveView.Fit
Can't find what you're looking for? Ask the community or share your knowledge.