Place a Parts in a assembly using VB.Net

Place a Parts in a assembly using VB.Net

Anonymous
Not applicable
861 Views
1 Reply
Message 1 of 2

Place a Parts in a assembly using VB.Net

Anonymous
Not applicable

Hi is there any code to place a part in an existing assembly using VB.Net?

 

FileName.ipt

Place to a specific coordinate

Rotation

Grounded in place

 

Thank's in advance!

Alain

0 Likes
862 Views
1 Reply
Reply (1)
Message 2 of 2

bradeneuropeArthur
Mentor
Mentor
Dim a As Application
Set a = ThisApplication
Dim ba As AssemblyDocument
Set ba = a.ActiveDocument
'Set b = a.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim bp As PartDocument
Set bp = a.Documents.Add(kPartDocumentObject, , True)
'Call bp.SaveAs("D:\Test.ipt", False)
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oMatrix As Matrix
Set oMatrix = oTG.CreateMatrix
Call oMatrix.SetTranslation(oTG.CreateVector(3, 2, 1))
' Add the occurrence.
Dim oOcc As ComponentOccurrence
'Set oOcc = oAsmCompDef.Occurrences.Add("D:\Test.ipt", oMatrix)
Set oOcc = oAsmCompDef.Occurrences.AddByComponentDefinition(bp.ComponentDefinition, oMatrix)

ba.Activate

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes