Is a weldbead a virtual component?

Is a weldbead a virtual component?

SharkDesign
Mentor Mentor
425 Views
4 Replies
Message 1 of 5

Is a weldbead a virtual component?

SharkDesign
Mentor
Mentor

Is a weldbead a virtual component and what is the best way to ignore them in an occurrence loop?

They keep messing up my code. 

  Inventor Certified Professional
0 Likes
426 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

Hi, it is known that the Try -Catch - End try instructions cannot coexist with on error resume next on the same line, however if you separate the code in subroutines you can implement them together and avoid errors in a loop.
Can you share an example of error to analyze it?
Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 3 of 5

SharkDesign
Mentor
Mentor

Well you can't do anything with a weldbead, so if you're trying to match iproperties for instance it'll crash. 

I even have weldments with no welds in at all and it still gives an error on weldbead occurances. 

  Inventor Certified Professional
0 Likes
Message 4 of 5

Sergio.D.Suárez
Mentor
Mentor

Here I show you a third method without functions that work with the error.
This rule works in a Weldment assembly.
Here I avoid the occurrences and those that have the same fullfilename as the assembly, and only take the remaining ones.
Then I execute an action on the remaining occurrences.

Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim oCD As WeldmentComponentDefinition = oDoc.ComponentDefinition
Dim doc As Document
Dim oFullName As String

For Each oCc As ComponentOccurrence In oCD.Occurrences
	doc = oCc.Definition.Document
	oFullName = doc.FullFileName
	If oFullName <> oDoc.FullFileName Then
		
		oPartNum = doc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
		
		MessageBox.Show(oPartNum)
		
	End If
Next

 I hope it works for your particular case, if not, see if you can share a basic example that throws an error.
Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 5 of 5

Curtis_Waguespack
Consultant
Consultant

Hi @SharkDesign

 

Here are some ilogic examples that might help.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Does report weld beads

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences.AllLeafOccurrences
	MessageBox.Show(oOcc.Name, "iLogic")
Next

Does NOT report weld beads

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences.AllLeafOccurrences
	If oOcc.Name.Contains("_Weldbead") = False Then
		MessageBox.Show(oOcc.Name, "iLogic")
	End If
Next

Does report weld beads

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences
	MessageBox.Show(oOcc.Name, "iLogic")
Next

 

Does NOT report weld beads

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences
	If oOcc.Name.Contains("_Weldbead") = False Then
		MessageBox.Show(oOcc.Name, "iLogic")
	End If
Next

 

Does NOT report weld beads

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
	MessageBox.Show(oOcc.Name, "iLogic")

Next

EESignature