Place a component with a specific representation

Place a component with a specific representation

rbertoletti
Enthusiast Enthusiast
126 Views
1 Reply
Message 1 of 2

Place a component with a specific representation

rbertoletti
Enthusiast
Enthusiast

Hi,

I'm facing a problem as per i'm not able to place a component (assembly) in an assembly with a specific representation (The following in the picture).

How can i set this type of representation in the rule which place the component?

 

Note that i need to place the component in specific coordinates and then make it grounded.

 

Thanks in advance

0 Likes
Accepted solutions (1)
127 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Hi @rbertoletti.  To do that, you would need to use the ComponentOccurrences.AddWithOptions method, instead of the standard ComponentOccurrences.Add method.  The one with options lets us specify up to 5 additional settings that the other one does not.  Below is a very basic example of how to use it.

Sub Main
	Dim oInvApp As Inventor.Application = ThisApplication
	Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
	If oADoc Is Nothing Then Return
	Dim oADef As AssemblyComponentDefinition = oADoc.ComponentDefinition
	Dim oOccs As ComponentOccurrences = oADef.Occurrences
	Dim oConsts As AssemblyConstraints = oADef.Constraints
	Dim sFileName As String = "C:\Temp\MySubAssembly.iam"
	Dim oPosition As Inventor.Point = oInvApp.TransientGeometry.CreatePoint(3, 6, 9)
	Dim oOptions As Inventor.NameValueMap = oInvApp.TransientObjects.CreateNameValueMap()
	oOptions.Add("DesignViewRepresentation", "Default")
	oOptions.Add("DesignViewAssociative", True)
	Dim oNewOcc As ComponentOccurrence = oOccs.AddWithOptions(sFileName, oPosition, oOptions)
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)