Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Placing Parts List in another drawing then copy to existing drawing

1 REPLY 1
Reply
Message 1 of 2
kwarrenH4ZT3
187 Views, 1 Reply

Placing Parts List in another drawing then copy to existing drawing

We all know the issue of not being able to have both parts only and structured parts list in a drawing. We currently have all parts lists as structured when we detail the assemblies but then we also put a single purchased parts list that doesn't have item numbers on it as parts only. We create a new drawing and place the parts only parts list then copy it back over to the current drawing. What I'm looking for is to create an ilogic that you can run on the one drawing that looks at the first page for the cover page view of the main assembly then creates a new drawing that places the parts list as parts only and set the style to our purchased parts list. Then if we can have it copy it over to the original drawing and then close the temporary drawing and not save it. I've got the code to place the parts list on the first(Cover) page from the view on the cover page but I'm unsure on how or if it's possible to place in a new drawing then copy it back to this drawing. Any help would be greatly appreciated.

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
oSheet = oDrawDoc.Sheets(1)

Dim oBOM As BOM
Dim oView As DrawingView
Dim oPartsLists As PartsLists
Dim oPartsList As PartsList

'Try to get the first view on the sheet
Try
	oView = oSheet.DrawingViews(1)
Catch
	MessageBox.Show("There is no view on the cover page","Place a view", MessageBoxButtons.OK, MessageBoxIcon.Error)
	Return
End Try

'get the model that the view is looking at
oModelDoc =ThisDrawing.Sheet(“COVER:1”).View(oView.Name).ModelDocument
'get the BOM database
oBOM = oModelDoc.ComponentDefinition.BOM
' Make sure  the BOM view is enabled
oBOM.PartsOnlyViewEnabled = True
'get the PartsLists collection
oPartsLists = oSheet.PartsLists

'clean up existing parts lists
For Each oPartsList In oPartsLists
	oPartsList.Delete
Next

'Setting BOM position
Dim BomPlacementPoint As Point2d
Dim oBorder As Border = oSheet.Border
BomPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d (0, oBorder.RangeBox.MaxPoint.Y)

'Create new partsList
oPartsList = oPartsLists.Add(oView, BomPlacementPoint, PartsListLevelEnum.kPartsOnly)
'Changes parts list to new style.
oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("BOM (Purchasing)")

 

 

Labels (1)
1 REPLY 1
Message 2 of 2
A.Acheson
in reply to: kwarrenH4ZT3

See link to solved post. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report