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: 

Reading Parts List Title Value

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
MarkyTomm
307 Views, 4 Replies

Reading Parts List Title Value

Hi All,

 

Should be an easy question for someone

 

Can I access the title value of a parts list already place on a sheet within an IDW?

 

I am familiar with setting the value using 

 

Dim oPartList As PartsList
Set oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)

oPartsList.Title="XXX"

 

but I want to read it into a variable to use as the file name for exporting to excel

 

Thanks in advance

Mark

Inventor 2021

4 REPLIES 4
Message 2 of 5
petr.meduna
in reply to: MarkyTomm

Hi, 

property Title is Read/Write so you can save it into a variable.

 

Dim doc As DrawingDocument = ThisApplication.ActiveDocument
Dim pl As PartsList = doc.ActiveSheet.PartsLists.Item(1)
Dim oTitle As String = pl.Title
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("StartingCell") = "A1"
oOptions.Value("IncludeTitle") = True
oOptions.Value("AutoFitColumnWidth") = True
Dim oName As String = "C:\TEMP\" & ThisDoc.FileName(False) & "_" & oTitle & ".xlsx"
pl.Export(oName, PartsListFileFormatEnum.kMicrosoftExcel, oOptions
Message 3 of 5
dalton98
in reply to: MarkyTomm

oDrawDoc = ThisApplication.ActiveDocument

Dim oPartList As PartsList
oPartList = oDrawDoc.ActiveSheet.PartsLists.Item(1)

oListName = oPartList.ReferencedDocumentDescriptor.DisplayName
MessageBox.Show(oListName)

oExport = Left(oListName, oListName.Length - 4)
MessageBox.Show(oExport)
Message 4 of 5
MarkyTomm
in reply to: petr.meduna

Hi Petr,

 

Thanks very much for your solution

 

I guess that is in ilogic but I can convert it to vba easily enough

 

Regards

Mark

Message 5 of 5
MarkyTomm
in reply to: dalton98

Thanks Dalton,

 

That helps and also solves another part of my code which is to extract the referenced assembly document

 

Regards

Mark

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

Post to forums  

Autodesk Design & Make Report