Parts List Table Title Automation

Parts List Table Title Automation

MikeKovacik4928
Advisor Advisor
4,076 Views
21 Replies
Message 1 of 22

Parts List Table Title Automation

MikeKovacik4928
Advisor
Advisor

Hi all

 

I like to add the part number & description of my parent sub assy to the title of the
part list table to make it easier for the person reading the drawing to link it to the correct view.

 

I do this by entering it in manually in the Parts List Table Layout, Heading and Table Settings, Title

It would be nice if you could link iproperties to this title box, so that you could set up a title
for your parts list to appear automatically and the same for all your title blocks,
instead of typing it in manually each time.

 

See attached PDF for screenshots of what I am talking about.

 

IS THERE A WAY OF DOING THIS (WITHOUT USING ILOGIC) ?

(I have seen similar posts where this has been solved by  ilogic)

 

Michael Kovacik
.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

0 Likes
Accepted solutions (2)
4,077 Views
21 Replies
Replies (21)
Message 2 of 22

mcgyvr
Consultant
Consultant

(Impossible only means you haven't used ilogic yet?) Smiley Very Happy

 

Whats wrong with using ilogic?

Its perfect for this type of customization..

 

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 3 of 22

MikeKovacik4928
Advisor
Advisor

Nothing at all, if that is the way it has to be done.

I am new on ilogic, but am more than willing to learn.

How is it done?

Lead the way

 

 

Mike

 

0 Likes
Message 4 of 22

MikeKovacik4928
Advisor
Advisor

Any takers?

I still want to implement this.

Like I said I am very willing to use ilogic,

but need help as I am a newbie with ilogic

 

Michael Kovacik
.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

0 Likes
Message 5 of 22

MikeKovacik4928
Advisor
Advisor

okay

I guess I will carry on doing this manually for the time being!

 

Mike

0 Likes
Message 6 of 22

matt_jlt
Collaborator
Collaborator

I wrote the following examples below in VBA and the last one is converted to iLogic / VB.net. This is most of the work done for you. now all you need to do is get the part number / property of whatever sub occurrence you were referring to and insert the text where it shows in the below code.

 

I would have tried to work that out but It was not clear on what assembly you were trying to pull the iproperty from.

 

Hope it helps, Matt.

 

Public Sub ChangeAllPartsLists_AllSheets()

    ' Define and get drawing document
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    ' Define sheet and parts list
    Dim oSheet As Sheet
    Dim oPL As PartsList
    
    ' Iterate through all sheets in the active document
    For Each oSheet In oDoc.Sheets
    
        ' Iterate through all parts lists in each sheet
        For Each oPL In oSheet.PartsLists
        
            ' Change the title of the parts list to a string
            oPL.Title = "TEST TITLE HERE"
        Next
    Next
    
End Sub
Public Sub ChangeAllPartsLists_ActiveSheet()

    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oPL As PartsList
    
    ' This could be used instead of the For Each loop if there is only ever one parts list on a sheet.
    'Set oPL = oSheet.PartsLists.Item(1)
    
    For Each oPL In oSheet.PartsLists
        oPL.Title = "TEST TITLE HERE"
    Next
    

End Sub
' iLogic Rule to change the title text of all parts lists

' Define and get drawing document
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument

' Iterate through all sheets in the active document
For Each oSheet As Sheet In oDoc.Sheets
	' Iterate through all parts lists in each sheet
	For Each oPL As PartsList In oSheet.PartsLists
		' Change the title of the parts list to a string
		oPL.Title = "ILOGIC TEST TITLE HERE"
	Next
Next

 

0 Likes
Message 7 of 22

MikeKovacik4928
Advisor
Advisor

Thank you very much for that.

 

I will try it out at home, as soon as I can, and get back to you.

I do not have time at work, nor would I be allowed to do it there either.

 

All of my correspondence with the forums is done on my own time,

and with my own licensed software.

 

Michael Kovacik
.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
(personal licensed copy)
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

 

 

0 Likes
Message 8 of 22

MikeKovacik4928
Advisor
Advisor

Fantastic!

 

NOW

WHAT DO I ENTER INTO THE ILOGIC INSTEAD OF

"ILOGIC TEST TITLE HERE" TO GET THE IPROPERTIES

FROM THE IAM.

IN OTHER WORDS I WANT TO USE THE IPROPERTY

VALUE FROM THE ASSEMBLY, RATHER THAN THE TEXT STRING.

 

See attached pdf for full description of what I want to do.

 

Michael Kovacik

Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
-Cad (28 yrs)
--Cadkey (4 yrs)
--AutoCAD 2d & 3d (16 yrs)
--Inventor (4 yrs)
--Autocad and Inventor Simultaneously (4 years)
--(and recently Autocad/Inventor Customisation)

 

Autodesk Product Design Suite Ultimate 2018

(own personal licensed copy)
Autocad 2018, Inventor Pro 2018

 

Johannesburg, South Africa

 

(Impossible only means you haven't
found the solution yet)

 

0 Likes
Message 9 of 22

matt_jlt
Collaborator
Collaborator

 

' iLogic rule to get the iproperties
'
Define Variables Dim oSheet As Sheet = ThisDrawing.Document.Sheets.Item(1) ' Check if there are any views on the sheet If oSheet.DrawingViews.Count = 0 Then Exit Sub ' Define Variables Dim oDoc As Document = ThisDrawing.ModelDocument Dim oView As DrawingView = oSheet.DrawingViews.Item(1) ' Get Description from model Dim strDescr As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value Dim strPartNo As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value   

' iLogic Rule to change the title text of all parts lists

' Define and get drawing document
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument

' Iterate through all sheets in the active document
For Each oSheet As Sheet In oDoc.Sheets
' Iterate through all parts lists in each sheet
For Each oPL As PartsList In oSheet.PartsLists
' Change the title of the parts list to a string
oPL.Title = strPartNo & strDescr & "Anytext you want"
Next
Next

 

 

0 Likes
Message 10 of 22

MikeKovacik4928
Advisor
Advisor

Have quickly tried this out during my lunch hour.

Doesn't seem to work.

Get error message.

See jpg's attached.

 

Mike

0 Likes
Message 11 of 22

matt_jlt
Collaborator
Collaborator

That would be because i just did a copy paste to put the two segments together. The error message was stating that there were two variables with the same name. Just had to change the second oDoc to something different which I chose oDrgDoc. I haven't tested it but it should work.

 

' iLogic rule to get the iproperties
' Define Variables
Dim oSheet As Sheet = ThisDrawing.Document.Sheets.Item(1)

' Check if there are any views on the sheet
If oSheet.DrawingViews.Count = 0 Then Exit Sub

' Define Variables
Dim oDoc As Document = ThisDrawing.ModelDocument
Dim oView As DrawingView = oSheet.DrawingViews.Item(1)

' Get Description from model
Dim strDescr As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
Dim strPartNo As String = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value   

' iLogic Rule to change the title text of all parts lists

' Define and get drawing document
Dim oDrgDoc As DrawingDocument = ThisApplication.ActiveDocument

' Iterate through all sheets in the active document
For Each oSheet As Sheet In oDrgDoc .Sheets
 ' Iterate through all parts lists in each sheet
 For Each oPL As PartsList In oSheet.PartsLists
 ' Change the title of the parts list to a string
 oPL.Title = strPartNo & strDescr & "Anytext you want"
 Next
Next
0 Likes
Message 12 of 22

dgreatice
Collaborator
Collaborator
Dim invApp As Inventor.Application
invApp = ThisApplication

If invApp.ActiveDocumentType = kDrawingDocumentObject Then

Else
MsgBox ("You can access in this rule!")
Exit Sub
End If

Dim oDWGDoc As DrawingDocument
oDWGDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
Dim oPartlist As PartsList

Dim PartNo As String
Dim Desc As String
Dim Mass as String

Dim oModelDoc As Document
Dim oAssyDocType As AssemblyDocument
Dim oPartDocType As PartDocument

For Each oSheet In oDWGDoc.Sheets
For Each oPartlist In oSheet.PartsLists
oModelDoc = oPartlist.ReferencedDocumentDescriptor.ReferencedDocument '(Get Data From Part List Document)

PartNo = oModelDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
Desc = oModelDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value

If oModeldoc.documenttype = kAssemblyDocumentObject Then
oAssyDocType = oModelDoc
PropMass = Round(oAssyDocType.ComponentDefinition.MassProperties.Mass, 2) ' get mass
Else
oPartDocType = oModelDoc
PropMass = Round(oPartDocType.ComponentDefinition.MassProperties.Mass, 2) ' get mass
End If
oPartlist.Title = "PART LIST; " & PartNo & " ; " & Desc & " ; MASS - " & PropMass & " Kg"
Next
Next
Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 13 of 22

dgreatice
Collaborator
Collaborator
You can use this code even no base view (only partlist)
Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 14 of 22

MikeKovacik4928
Advisor
Advisor

Still doesn't work

 

See attached message

0 Likes
Message 15 of 22

dgreatice
Collaborator
Collaborator
Accepted solution

Did you try my code mike?

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 16 of 22

MikeKovacik4928
Advisor
Advisor

Perfect Thanks

 

Mike

0 Likes
Message 17 of 22

MikeKovacik4928
Advisor
Advisor

Thanks for that ilogic programme. It worked perfectly.

 

Could you remove the mass part from your programme.

or tell me what to remove from the ilogic programme,

I don't want the mass to appear in the title block title.

 

Michael Kovacik
.
Draughting/Designing (Manufacturing) (31 yrs)
-Drawing Board (3 yrs)
--Cad (28 yrs)
---Cadkey (4 yrs)
---AutoCAD 2d & 3d (16 yrs)
---Inventor (4 yrs)
---Autocad and Inventor Simultaneously (4 years)
---(and recently Autocad/Inventor Customisation)
.
Autodesk Product Design Suite Ultimate 2018
Autocad 2018, Inventor Pro 2018
(personal licensed copy)
.
Johannesburg, South Africa
.
(Impossible only means you haven't
found the solution yet)

 

0 Likes
Message 18 of 22

dgreatice
Collaborator
Collaborator
Accepted solution
It simple.

At row 3 from bottom. Type ' after Desc

It seem like this:


oPartlist.Title = "PART LIST; " & PartNo & " ; " & Desc ' & " ; MASS - " & PropMass & " Kg"

For the futher if you want to activated mass value, just delete '
Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 19 of 22

MikeKovacik4928
Advisor
Advisor

Fantastic 

Thanks

 

I think I must start learning ilogic as one of my next tasks!!

 

Mike

0 Likes
Message 20 of 22

cadman777
Advisor
Advisor

dgreatice,

 

Thanx for posting your elegant code.

I used it and it works like a charm.

Thanx!

 

There is one challenge, however, which I can't figure out after many hours of trying.

If you (or anybody else who knows how to code) would please help me?

 

Challenge: The macro fails when the iProperty does not exist.

 

To try to solve this, I added some of Curtis' code (adds iProperties to a part or assembly). His code works great as a stand-alone macro, but I can't figure out how to get his code to act on the assembly which the Parts List is referencing.

 

When running this macro from the drawing file, would you please help me know how to reference the assembly file?

 

I think the relevant line is this:

oModelDoc = oPartlist.ReferencedDocumentDescriptor.ReferencedDocument ' (Get Data From Part List Document)

I've annotated it with a note typed in all uncials.

 

Thanx for any input you may be able to give!

 

 

... Chris
Win 7 Pro 64 bit + IV 2010 Suite
ASUS X79 Deluxe
Intel i7 3820 4.4 O/C
64 Gig ADATA RAM
Nvidia Quadro M5000 8 Gig
3d Connexion Space Navigator
0 Likes