- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everyone,
I have searched the forum for this solution but i can't seem to find the exact solution.
I have a Ilogic to auto place a predefined style partlist on my drawing. It also reorders the partlist according to my preferences.
The problem is that i can't get the position correct. I want it to be on the position of the blue point.
I've tried the offset possibility. But my problem was that if i place a different assembly with a different partlist the offset position changes. So no fixed value.
Can somebody please help me correct my Ilogic Code?
Kind regards,
Koen Roovers
iLogicVb.UpdateWhenDone = True ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet oSheet = oDrawDoc.ActiveSheet ' Set a reference to the first drawing view on ' the sheet. This assumes the first drawing ' view on the sheet is not a draft view. Dim oDrawingView As DrawingView Try oDrawingView = oSheet.DrawingViews(1) Catch MessageBox.Show("No View found. Can not continue", "iLogic") Return End Try ' Set a reference to th sheet's border Dim oBorder As Border oBorder = oSheet.Border Dim oPlacePoint As Point2d If Not oBorder Is Nothing Then ' A border exists. The placement point oX = oBorder.RangeBox.MaxPoint.X oY = oBorder.RangeBox.MaxPoint.Y oPlacePoint = ThisApplication.TransientGeometry.CreatePoint2d(oX, oY) Else ' There is no border oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(20, 20) iLogicVb.UpdateWhenDone = True End If Dim oPartslist As PartsList Try 'look for the first parts list found on the sheet 'if succesful finding it, 'tell the user,then Do Nothing oPartslist = oSheet.PartsLists(1) MessageBox.Show("There is an existing Parts List", "iLogic") Catch ' Create the parts list. oPartslist = oSheet.PartsLists.Add(oDrawingView, oPlacePoint) 'set parts list to a specific style oPartslist.Style = oDrawDoc.StylesManager.PartsListStyles.Item("Purchase List (Kieu)") Dim oPartsList1 As PartsList oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1) oPartsList1.Sort("Opmerkingen", 1, "Kodenummer", 1) oPartsList1.Renumber End Try
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can you please upload the drawing file?
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi koenroovers
if i understand you correctly you would like to have the parts list on the left side of your drawing right above the title block, right?
I looked a little bit around on the forum and found this
the code Turac posted seem to place the parts list right above the title block, at least on my drawing (tried to change size to A0 and back to A3) and the parts list jumped straight to the left corner right above the title block
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oSheet As sheet
oSheet = oDrawDoc.ActiveSheet
Dim oPartslist As Partslist
oPartsList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
Dim oPlacementPoint, oPlacementPoint2 As point2d
Dim oBorder As Border
oBorder = oSheet.Border
PartHight=oSheet.PartsLists.Item(1).RangeBox.MaxPoint.Y-oSheet.PartsLists.Item(1).RangeBox.MinPoint.Y
TitleY=oSheet.TitleBlock.RangeBox.MaxPoint.Y
PointX=oBorder.Rangebox.Maxpoint.x
PointY=TitleY+PartHight
oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(PointX,PointY)
oPartslist.position = oPlacementPoint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@j.brodersen
That bit of code is working, but i would like to add it to my orginal code but can't seem to make it work
@j.brodersen @bradeneuropeArthur
I have combined the codes to a working code. But now i have run into a different problem.
If i run the Ilogic on a big assembly, the BOM is always set to structure, is there a way to define the partslist to be Parts only?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm unfortunately just a advanced noob if it comes to programming but what i could figure out is that you can specify the Partslist.Level during the Add step
Syntax
PartsLists.Add( ViewOrModel As Object, PlacementPoint As Point2d, [Level] As PartsListLevelEnum, [NumberingScheme] As Variant, [NumberOfSections] As Long, [WrapLeft] As Boolean ) As PartsList
so if I'm not mistaking following chang/addition in your code should do the job
oPartslist = oSheet.PartsLists.Add(oDrawingView, oPlacePoint, kPartsOnly)
you can find the information as well on following links
Syntax:
https://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-64121FC0-E936-4A2B-9F84-46D9BD5701EC
PartsListLevelEnum:
https://help.autodesk.com/view/INVNTOR/2018/ENU/?guid=GUID-3F116D00-1E4E-4781-A748-619B482DCF99
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@j.brodersen
You are definitely no noob because that worked like a charm!
Thank you very much!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
oPartslist.Level = Inventor.PartsListLevelEnum.kPartsOnly
MessageBox.Show("There is an existing Parts List", "iLogic")
Regards,
Arthur Knoors
Autodesk Affiliations:
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: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 !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
thank's a lot @koenroovers glad that i could help and that it's working![]()
learning a lot through this forum and posts from bradeneuropArthur, JhoelForshav, WCrugfield and all the other great people here how to use iLogic.
@bradeneuropeArthur I tried your code but unfortunately i got an error message, something with "Use 'CallByName' function with 'CallType.Set'"! But did i get it right that you can change the level with it afterwards/on an existing Partslist?
I tried the same in the beginning but got the error message that "Level" is ReadOnly.
Since it would be nice to have a code which can change the level of an existing parts list (it's frustrating if you placed a structured parts list, arranged everything just to find out that you have to change it to part only and start from the beginning). Could you tell me how I have to use callbyname? My attempt
CallByName(oPartslist,Level,CallType.Set,kPartsOnly)
just gave me the error message member not found.(exception by HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))