- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is it possible for Inventor to create assemblies from a template assembly from an excel list? The files would be named as such and would all be in the same folder? I have some base code setup that will separate the name into meaningful variables that will, in theory, change out the parts inside the assemblies once created. I just need help with getting Inventor to create the assemblies from excel.
NOZLC2-RF150-8-40-AUX.iam
NOZLC2-RF150-8-40-BV.iam
NOZLC2-RF150-8-80-AUX.iam
NOZLC2-RF150-8-80-BV.iam
NOZLC2-RF150-10-40-AUX.iam
NOZLC2-RF150-10-40-BV.iam
NOZLC2-RF150-10-80-AUX.iam
Thanks,
Daniel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
You should be able to create empty iam, ipt files with the name in excel.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
iLogic, macro, Add-in, Apprentice.
Depends on how you want to do it.
Even in excel.
Create an empty iam. Copy and rename the file using macro in excel. You can even use Windows script or batch file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Oh ok, I see what you are saying now.
My current thoughts are to run the ilogic code from an inventor assembly that will create all the assemblies and then when each is created it will switch out the parts inside the assemblies to configure the part the correct way.
For this example, there are about 3000 assembly variations that need to be created. Each assembly has a pipe and a flange, and based off the file name it is either a raised face slip on or a weld neck. I already have the code working that will take the file name and determine what the parts inside should be, and it is switching the parts out based on this data. I just need a way to create the assemblies that will enable this other rule to be activated, I don't want it to be an event trigger as I would rather not have the rule run each time that the file is opened or saved or whatever. Ideally, when the assembly is created it would run the subroutine and go ahead and change out the flanges and pipes then. I think I will be able to do most of that, I just don't know how to get started on inventor creating the assemblies.
Attached is a sample of a nozzle that has the pipe and the flange and the assembly file with the ilogic inside. I have them saved in a 2019 folder in my public folder, if you duplicate this setup, you can delete the parts inside the assembly and run the rule to see what it is doing. I have downloaded a flange from the content center just as a test, once I get it all ready, I will be pulling from the content center, I don't want to edit the families until I know it will work.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below code in the main assembly to create new assembly. After that, two components are added. To add constraints, face entities are needed. Which can be done through adding attribute set to faces.
Dim path As String
path = "D:\Chandra\Autodesk Cases\Inventor\Aug-2018\14537574\"
Dim oList As ArrayList
oList = GoExcel.CellValues(path + "Assembly_List.xlsx", "Sheet1", "A1", "A7")
For Each name In oList
Dim oNewAssy As AssemblyDocument
oNewAssy = ThisApplication.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject)
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix()
Dim componentA As ComponentOccurrence
componentA = oNewAssy.ComponentDefinition.Occurrences.Add("D:\Chandra\Autodesk Cases\Inventor\Aug-2018\14537574\NOZLC2-RF150-8-40-AUX\PIPES\PIPEC2-40-8.ipt", oMatrix)
componentA.Name = "Pipe"
Dim componentB As ComponentOccurrence
componentB = oNewAssy.ComponentDefinition.Occurrences.Add("D:\Chandra\Autodesk Cases\Inventor\Aug-2018\14537574\NOZLC2-RF150-8-40-AUX\FLANGES\RF150-2.ipt", oMatrix)
componentB.Name = "Flange"
Call oNewAssy.SaveAs(path + name, False)
Call oNewAssy.Close
Next
Before running this code, update the paths of excel file, RF150-2.ipt and PIPEC2-40-8.ipt
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
YOU ARE AMAZING!! Thank you so much. The only thing I had to change was adding the file extension to the code!
Call oNewAssy.SaveAs(path + name + ".iam", False)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks again for the assistance. Whats the line to add a component from the content center and the line for adding an insert constraint?
I tried these, to no avail.
SyntaxEditor Code Snippet
Dim componentA As ComponentOccurrence componentA = oNewAssy.ComponentDefinition.Occurrences.Add("C:\Users\Public\2019\PIPES\PIPEC2-40-16.ipt", oMatrix) componentA.Name = "Pipe" Dim componentB = oNewAssy.ComponentDefinition.Occurrences.AddContentCenterPart("Flange", "Tube & Pipe:Fittings:Flanges", "ASME B16.5 Flange Slip-On Welding - Class", {"ND",oNozSize},position := Nothing, grounded := False,visible := True, appearance := Nothing) oNewAssy.ComponentDefinition.Occurrences.Constraints.AddInsert("Insert1", "Pipe", "Flange Face", "Flange", "Flange Face", axesOpposed := Axis, distance := InsertDis, lockRotation := True, biasPoint1 := Nothing, biasPoint2 := Nothing)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below iLogic code to add content center file to assembly file. It is considered for below example.
Sub PlaceContentCenterPart()
' Set a reference to the active assembly document.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
' Set a reference to the ContentCenter object.
Dim oContentCenter As ContentCenter
oContentCenter = ThisApplication.ContentCenter
' Get the content node (category) "Fasteners:Bolts:Hex Head"
Dim oContentNode As ContentTreeViewNode
oContentNode = oContentCenter.TreeViewTopNode.ChildNodes.Item("Fasteners").ChildNodes.Item("Bolts").ChildNodes.Item("Hex Head")
' Get the "ISO 4015" Family object.
Dim oFamily As ContentFamily
For Each oFamily In oContentNode.Families
If oFamily.DisplayName = "ISO 4015" Then
Exit For
End If
Next
' Create a member based on the first row of the family.
Dim Error1 As MemberManagerErrorsEnum
Dim strContentPartFileName As String
Dim strErrorMessage As String
strContentPartFileName = oFamily.CreateMember(1, Error1, strErrorMessage)
' Dim oMat As Matrix
' oMat = ThisApplication.TransientGeometry.CreateMatrix
' Insert an instance of the content center member in the assembly.
'Call oDoc.ComponentDefinition.Occurrences.Add(strContentPartFileName, oMat)
' Set a reference to the transient geometry object.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
' Create a matrix.
Dim oMatrix As Matrix
oMatrix = oTG.CreateMatrix
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
'place an instance of the component
'in this case at 0,0,0
'positioned at the co-ordinates
oMatrix.SetTranslation(oTG.CreateVector(0, 0, 0))
oOccurrence = oAsmCompDef.Occurrences.Add(strContentPartFileName, oMatrix)
oOccurrence.Grounded = False
End Sub
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks for your assistance, the code I've been working on is just about complete. I've figured out a way for a workaround for placing content center parts, I have switched to simply placing them from their respective content center windows explorer folder locations, since iLogic cannot currently place custom item, such as pipes where we can pick various lengths.
Basically, what I am wanting for this code, is to place 2 parts from an excel list, and use their named faced, the new 2019 assign name feature, to constrain with an insert constraint that the value varies based off of their sizes. Also, I will need this code to add some custom iproperties to the new assembly before closing it and moving onto the next assembly. The assembly is used in our ASME vessels, and by having a custom iproperites it greatly reduces the amount of time in our drawing creations, mainly the schedule of openings. I just about have the code together, just missing the constraints and the custom iproperties.
Ive attached some sample parts where they have the named faces and an excel file. Ive also attached the entire code that I have been working on. The iproperties assigned are the part number, description and a custom named Service. If I could get some assistance with these last few things, I think that I would be able to finish the code and start creating all these assembly variations. Notice the excel file has 36,937 variations, really its around 210,000 but I changed it to only do the most popular assembly variations, lol, having this code will enable us to create all these, in sections as I doubt my computer could handle all of them at once lol.
SyntaxEditor Code Snippet
Dim path As String path = "C:\Users\Public\2019\" NolzPath = "C:\Users\Public\2019\NZLS\" Dim oList As ArrayList oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsx", "Nozzles", "O2", "O3") 'oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsm", "Nozzles", "O2", "O3") Dim FlangeFolder as String For Each name In oList Dim oNewAssy As AssemblyDocument oNewAssy = ThisApplication.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject) oNozSize = Split(name, "-")(0) 'MessageBox.Show(oNozSize, "SIZE") oNozSch = Split(name, "-")(1) 'MessageBox.Show(oNozSch, "SCH") oNozLen = Split(name, "-")(2) 'MessageBox.Show(oNozLen, "LEN") oFlgTypeRtng = Split(name, "-")(3) 'MessageBox.Show(oFlgTypeRtng, "") oNozServ = Split(name, "-")(4) 'MessageBox.Show(oNozServ, "SERVICE") ''remove 1st 5 charachters from file name - ie. NOZLC oNozSize = Right(oNozSize, Len(oNozSize) - 5) 'MessageBox.Show(oNozSize,"size") 'create values for the rating and type of flange. ie RF150 is RF and 150 oFlgType = Left(oFlgTypeRtng, Len(oFlgTypeRtng) - 3) oFlgRtng = Right(oFlgTypeRtng, Len(oFlgTypeRtng) - 2) 'MessageBox.Show(oFlgType, "FLNG TYPE") 'MessageBox.Show(oFlgRtng,"FLNG RATING") Try oNozSize = (oNozSize).Replace("/", "_") Catch End Try Dim oMatrix As Matrix oMatrix = ThisApplication.TransientGeometry.CreateMatrix() FlangePath = "Tube & Pipe:Fittings:Flanges" If oFlgType = "RF" Select Case oFlgRtng Case "150" FlangeFolder = "ASME B16.5(21)\" Case "300" FlangeFolder = "ASME B16.5(23)\" Case "600" FlangeFolder = "ASME B16.5(25)\" Case "900" FlangeFolder = "ASME B16.5(26)\" End Select Axis = "False" InsertDis = .5 Else If oFlgType = "WN" Select Case oFlgRtng Case "150" FlangeFolder = "ASME B16.5(38)\" Case "300" FlangeFolder = "ASME B16.5(41\" Case "600" FlangeFolder = "ASME B16.5(43)\" Case "900" FlangeFolder = "ASME B16.5(44)\" End Select Axis = "True" InsertDis = .125 End If 'MessageBox.Show(FlangeFolder, "Title") '\\\ here are the paths where the flanges and pipe are saved at. PipePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\ASME B36.10M(1)\" & "PIPEC" & oNozSize & "-" & oNozSch & "-" & oNozLen & ".ipt" FlangePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\" & FlangeFolder & "FLNGC" & oNozSize & ".ipt" Dim componentA As ComponentOccurrence componentA = oNewAssy.ComponentDefinition.Occurrences.Add(PipePath, oMatrix) componentA.Name = "Pipe" Dim componentB As ComponentOccurrence componentB = oNewAssy.ComponentDefinition.Occurrences.Add(FlangePath, oMatrix) componentB.Name = "Flange" '////////Here is where I need the insert constraint and the iproperties modifications. ' Dim componentC As ComponentOccurrence ' componentC = oNewAssy.ComponentDefinition.Occurrences.Add.Constraints("Insert1", "Pipe", "Flange Face", "Flange", "Flange Face", ' axesOpposed := Axis, distance := InsertDis, lockRotation := True, biasPoint1 := Nothing, biasPoint2 := Nothing) ' oNewAssy.ComponentDefinition.Occurrences.Constraints.AddInsert("Insert1", "Pipe", "Flange Face", "Flange", "Flange Face", ' axesOpposed := Axis, distance := InsertDis, lockRotation := True, biasPoint1 := Nothing, biasPoint2 := Nothing) Try name = (name).Replace("/", "_") Catch End Try Call oNewAssy.SaveAs(NolzPath + name + ".iam", False) Call oNewAssy.Close Next
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below iLogic code to add Insert constraint and custom iProperty.
Dim path As String
path = "C:\Users\Public\2019\"
NolzPath = "C:\Users\Public\2019\NZLS\"
Dim oList As ArrayList
oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsx", "Nozzles", "O5", "O6")
'oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsm", "Nozzles", "O2", "O3")
Dim FlangeFolder As String
For Each name In oList
Dim oNewAssy As AssemblyDocument
oNewAssy = ThisApplication.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject)
oNozSize = Split(name, "-")(0)
'MessageBox.Show(oNozSize, "SIZE")
oNozSch = Split(name, "-")(1)
'MessageBox.Show(oNozSch, "SCH")
oNozLen = Split(name, "-")(2)
'MessageBox.Show(oNozLen, "LEN")
oFlgTypeRtng = Split(name, "-")(3)
'MessageBox.Show(oFlgTypeRtng, "")
oNozServ = Split(name, "-")(4)
'MessageBox.Show(oNozServ, "SERVICE")
''remove 1st 5 charachters from file name - ie. NOZLC
oNozSize = Right(oNozSize, Len(oNozSize) - 5)
'MessageBox.Show(oNozSize,"size")
'create values for the rating and type of flange. ie RF150 is RF and 150
oFlgType = Left(oFlgTypeRtng, Len(oFlgTypeRtng) - 3)
oFlgRtng = Right(oFlgTypeRtng, Len(oFlgTypeRtng) - 2)
'MessageBox.Show(oFlgType, "FLNG TYPE")
'MessageBox.Show(oFlgRtng,"FLNG RATING")
Try
oNozSize = (oNozSize).Replace("/", "_")
Catch
End Try
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix()
FlangePath = "Tube & Pipe:Fittings:Flanges"
If oFlgType = "RF"
Select Case oFlgRtng
Case "150"
FlangeFolder = "ASME B16.5(21)\"
Case "300"
FlangeFolder = "ASME B16.5(23)\"
Case "600"
FlangeFolder = "ASME B16.5(25)\"
Case "900"
FlangeFolder = "ASME B16.5(26)\"
End Select
Axis = "False"
InsertDis = .5
Else If oFlgType = "WN"
Select Case oFlgRtng
Case "150"
FlangeFolder = "ASME B16.5(38)\"
Case "300"
FlangeFolder = "ASME B16.5(41\"
Case "600"
FlangeFolder = "ASME B16.5(43)\"
Case "900"
FlangeFolder = "ASME B16.5(44)\"
End Select
Axis = "True"
InsertDis = .125
End If
'MessageBox.Show(FlangeFolder, "Title")
'\\\ here are the paths where the flanges and pipe are saved at.
PipePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\ASME B36.10M(1)\" & "PIPEC" & oNozSize & "-" & oNozSch & "-" & oNozLen & ".ipt"
FlangePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\" & FlangeFolder & "FLNGC" & oNozSize & ".ipt"
Dim componentA As ComponentOccurrence
componentA = oNewAssy.ComponentDefinition.Occurrences.Add(PipePath, oMatrix)
componentA.Name = "Pipe"
Dim componentB As ComponentOccurrence
componentB = oNewAssy.ComponentDefinition.Occurrences.Add(FlangePath, oMatrix)
componentB.Name = "Flange"
Dim oFace As Face
Dim oFlangeFace_Pipe As Face
Dim oInsideFace_Pipe As Face
For Each oFace In componentA.Definition.SurfaceBodies.Item(1).Faces
If oFace.InternalName = "{D2F0749E-CD50-6222-9FD3-82A95937E2C7}" Then
oFlangeFace_Pipe = oFace
ElseIf oFace.InternalName = "{34E025BE-9958-2F5D-43C5-4A4EDECF143F}" Then
oInsideFace_Pipe = oFace
End If
Next
Dim oFlangeFace_Flange As Face
For Each oFace In componentB.Definition.SurfaceBodies.Item(1).Faces
If oFace.InternalName = "{F5A66A0A-37CA-1154-750F-3BE821568F9F}" Then
oFlangeFace_Flange = oFace
Exit For
End If
Next
Dim oFaceProxy_pipe As FaceProxy
If Not oFlangeFace_Pipe Is Nothing Then
Call componentA.CreateGeometryProxy(oFlangeFace_Pipe, oFaceProxy_pipe)
Else
Exit Sub
End If
Dim oFaceProxy_Flange As FaceProxy
If Not oFlangeFace_Flange Is Nothing Then
Call componentB.CreateGeometryProxy(oFlangeFace_Flange, oFaceProxy_Flange)
Else
Exit Sub
End If
Call oNewAssy.ComponentDefinition.Constraints.AddInsertConstraint(oFaceProxy_pipe, oFaceProxy_Flange, False, InsertDis)
Dim oCustomProp As Inventor.Property
Try
oNewAssy.PropertySets.Item(4).Item("Custom Prop").Value = "Custom Value"
Catch
oCustomProp = oNewAssy.PropertySets.Item(4).Add("Custom value", "Custom Prop")
End Try
oNewAssy.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = "123456"
oNewAssy.PropertySets.Item("Design Tracking Properties").Item("Description").Value = "Description"
Try
name = (name).Replace("/", "_")
Catch
End Try
Call oNewAssy.SaveAs(NolzPath + name + ".iam", False)
Call oNewAssy.Close
Next
Note : currently, internal names are determined from attached parts. Internal name of face varies from part to part. If you are using new part, need to identify internal name by below code. After selection of face, run below code to get internal name of face.
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oFace As Face oFace = oDoc.SelectSet.Item(1) MessageBox.Show(oFace.InternalName, "Internal name")
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks again. How do I add a mate constraint between the pipe and the flange XZ origin planes, it looks like both of their Internal names are the same - {5DF8608B-6B16-11D3-B794-0060B0F159EF}?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below iLogic code.
Dim path As String
path = "C:\Users\Public\2019\"
NolzPath = "C:\Users\Public\2019\NZLS\"
Dim oList As ArrayList
oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsx", "Nozzles", "O5", "O6")
'oList = GoExcel.CellValues(path + "ASSEMBLY GENERATOR.xlsm", "Nozzles", "O2", "O3")
Dim FlangeFolder As String
For Each name In oList
Dim oNewAssy As AssemblyDocument
oNewAssy = ThisApplication.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject)
oNozSize = Split(name, "-")(0)
'MessageBox.Show(oNozSize, "SIZE")
oNozSch = Split(name, "-")(1)
'MessageBox.Show(oNozSch, "SCH")
oNozLen = Split(name, "-")(2)
'MessageBox.Show(oNozLen, "LEN")
oFlgTypeRtng = Split(name, "-")(3)
'MessageBox.Show(oFlgTypeRtng, "")
oNozServ = Split(name, "-")(4)
'MessageBox.Show(oNozServ, "SERVICE")
''remove 1st 5 charachters from file name - ie. NOZLC
oNozSize = Right(oNozSize, Len(oNozSize) - 5)
'MessageBox.Show(oNozSize,"size")
'create values for the rating and type of flange. ie RF150 is RF and 150
oFlgType = Left(oFlgTypeRtng, Len(oFlgTypeRtng) - 3)
oFlgRtng = Right(oFlgTypeRtng, Len(oFlgTypeRtng) - 2)
'MessageBox.Show(oFlgType, "FLNG TYPE")
'MessageBox.Show(oFlgRtng,"FLNG RATING")
Try
oNozSize = (oNozSize).Replace("/", "_")
Catch
End Try
Dim oMatrix As Matrix
oMatrix = ThisApplication.TransientGeometry.CreateMatrix()
FlangePath = "Tube & Pipe:Fittings:Flanges"
If oFlgType = "RF"
Select Case oFlgRtng
Case "150"
FlangeFolder = "ASME B16.5(21)\"
Case "300"
FlangeFolder = "ASME B16.5(23)\"
Case "600"
FlangeFolder = "ASME B16.5(25)\"
Case "900"
FlangeFolder = "ASME B16.5(26)\"
End Select
Axis = "False"
InsertDis = .5
Else If oFlgType = "WN"
Select Case oFlgRtng
Case "150"
FlangeFolder = "ASME B16.5(38)\"
Case "300"
FlangeFolder = "ASME B16.5(41\"
Case "600"
FlangeFolder = "ASME B16.5(43)\"
Case "900"
FlangeFolder = "ASME B16.5(44)\"
End Select
Axis = "True"
InsertDis = .125
End If
'MessageBox.Show(FlangeFolder, "Title")
'\\\ here are the paths where the flanges and pipe are saved at.
PipePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\ASME B36.10M(1)\" & "PIPEC" & oNozSize & "-" & oNozSch & "-" & oNozLen & ".ipt"
FlangePath = "C:\Users\dfitting\Documents\Inventor\Content Center Files\R2019\en-US\" & FlangeFolder & "FLNGC" & oNozSize & ".ipt"
Dim componentA As ComponentOccurrence
componentA = oNewAssy.ComponentDefinition.Occurrences.Add(PipePath, oMatrix)
componentA.Name = "Pipe"
Dim componentB As ComponentOccurrence
componentB = oNewAssy.ComponentDefinition.Occurrences.Add(FlangePath, oMatrix)
componentB.Name = "Flange"
Dim oFace As Face
Dim oFlangeFace_Pipe As Face
Dim oInsideFace_Pipe As Face
For Each oFace In componentA.Definition.SurfaceBodies.Item(1).Faces
If oFace.InternalName = "{D2F0749E-CD50-6222-9FD3-82A95937E2C7}" Then
oFlangeFace_Pipe = oFace
ElseIf oFace.InternalName = "{34E025BE-9958-2F5D-43C5-4A4EDECF143F}" Then
oInsideFace_Pipe = oFace
End If
Next
Dim oFlangeFace_Flange As Face
For Each oFace In componentB.Definition.SurfaceBodies.Item(1).Faces
If oFace.InternalName = "{F5A66A0A-37CA-1154-750F-3BE821568F9F}" Then
oFlangeFace_Flange = oFace
Exit For
End If
Next
Dim oFaceProxy_pipe As FaceProxy
If Not oFlangeFace_Pipe Is Nothing Then
Call componentA.CreateGeometryProxy(oFlangeFace_Pipe, oFaceProxy_pipe)
Else
Exit Sub
End If
Dim oFaceProxy_Flange As FaceProxy
If Not oFlangeFace_Flange Is Nothing Then
Call componentB.CreateGeometryProxy(oFlangeFace_Flange, oFaceProxy_Flange)
Else
Exit Sub
End If
Call oNewAssy.ComponentDefinition.Constraints.AddInsertConstraint(oFaceProxy_pipe, oFaceProxy_Flange, False, InsertDis)
Dim xzPlaneA As WorkPlane
xzPlaneA = componentA.Definition.Workplanes.Item("XZ Plane")
Dim xzPlaneA_proxy As WorkPlaneProxy
componentA.CreateGeometryProxy(xzPlaneA,xzPlaneA_proxy)
Dim xzPlaneB As WorkPlane
xzPlaneB = componentB.Definition.Workplanes.Item("XZ Plane")
Dim xzPlaneB_proxy As WorkPlaneProxy
componentB.CreateGeometryProxy(xzPlaneB, xzPlaneB_proxy)
Call oNewAssy.ComponentDefinition.Constraints.AddMateConstraint(xzPlaneA_proxy,xzPlaneB_proxy,"0")
Dim oCustomProp As Inventor.Property
Try
oNewAssy.PropertySets.Item(4).Item("Custom Prop").Value = "Custom Value"
Catch
oCustomProp = oNewAssy.PropertySets.Item(4).Add("Custom value", "Custom Prop")
End Try
oNewAssy.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value = "123456"
oNewAssy.PropertySets.Item("Design Tracking Properties").Item("Description").Value = "Description"
Try
name = (name).Replace("/", "_")
Catch
End Try
Call oNewAssy.SaveAs(NolzPath + name + ".iam", False)
Call oNewAssy.Close
Next
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks again!! With your help, I am now able to create an infinite amount of assembly variations for use in my vessel assembly creator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I was looking at the code and it looks interesting but can we also create a detailed drawing for all configurations? If so, would you please advise how?
Thank you very much for the support.
Best regards