iassembly generate files using external rule

iassembly generate files using external rule

cmcewanE2U82
Enthusiast Enthusiast
399 Views
2 Replies
Message 1 of 3

iassembly generate files using external rule

cmcewanE2U82
Enthusiast
Enthusiast

Looking to be able to generate files without selecting them (by highlighting) right clicking generate files and then having to hit ok during each factory member generation.

 

Is there a way I can bypass clicking ok on every file being generated?

 

I have a macro on my keyboard that repeatedly presses enter to sort of automate this but there has to be a more official way.

 

I want a button/external rule I can run that takes care of generating all the files so I can share it with my team so save monotonous button clicking/key pressing for dozens of files daily.

0 Likes
Accepted solutions (1)
400 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @cmcewanE2U82.  I do not currently use iAssemblies, but I think the following code example should work for a task like that.

Sub Main
	Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
	If oADoc Is Nothing Then Return
	Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
	Dim oFactory As iAssemblyFactory = Nothing
	If oADef.IsiAssemblyFactory Then
		oFactory = oADef.iAssemblyFactory
	ElseIf oADef.IsiAssemblyMember Then
		oFactory = oADef.iAssemblyMember.ParentFactory
	End If
	If oFactory Is Nothing Then Return
	'Dim sMembersFolder As String = oFactory.MemberCacheDir
	For Each oRow As iAssemblyTableRow In oFactory.TableRows
		oFactory.CreateMember(oRow)
	Next
End Sub

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

cmcewanE2U82
Enthusiast
Enthusiast

Thankyou I will give it a try and see how it behaves.

0 Likes