Hello,
I've created a dialog box where I have a combobox containing materials. This combobox has to be filled with library materials, not with ipt materials. While materials were stored in an xml file, it was easy to read it. Now they are stored in an adsklib file, how can I read it ?
Solved! Go to Solution.
Solved by philippe.leefsma. Go to Solution.
Rename the file in .zip, unzip, and you will find several .xml in the package.
This is an unsupported topic, so extracting information from there will need to be achieved on your own.
I hope that helps,
Philippe.
Thanks Philippe for your answer. I tried to unzip some files, there are a lot of error messages ("Invalid filename in the archive xxx_png") for all custom libraries, for the standard libraries no error messages but it is impossible to use them... If in addition it is unsupported it is not worth...
So, how can I obtain the list of all materials existing in the libraries declared in an ipj file ? I can read materials in an ipt, but ipt and libraries can have their own materials. The purpose is to obtain all libraries materials (even those which are not loaded in the part), and not local materials.
Other than opening the part to read materials in it, I don't see a way to achieve that...
You can iterate all local librairies as follow:
Public Sub DumpAllAppearancesInAllLibraries() ' Open a file to write the results. Open "C:\Temp\AllLibAppearanceDump.txt" For Output As #1 ' Iterate through the libraries. Dim assetLib As AssetLibrary For Each assetLib In ThisApplication.AssetLibraries Print #1, "Library" & assetLib.DisplayName Print #1, " DisplayName: " & assetLib.DisplayName Print #1, " FullFileName: " & assetLib.FullFileName Print #1, " InternalName: " & assetLib.InternalName Print #1, " IsReadOnly: " & assetLib.IsReadOnly Dim appearance As Asset For Each appearance In assetLib.AppearanceAssets Print #1, " Appearance" Print #1, " DisplayName: " & appearance.DisplayName Print #1, " Category: " & appearance.Category.DisplayName Print #1, " HasTexture: " & appearance.HasTexture Print #1, " IsReadOnly: " & appearance.IsReadOnly Print #1, " Name: " & appearance.Name Dim value As AssetValue For Each value In appearance Call PrintAssetValue(value, 8) Next Next Next Close #1 MsgBox "Finished writing output to ""C:\Temp\AllLibAppearanceDump.txt""" End Sub
Philippe.
Ok ! So it is possible to access to the appearances and materials in the libraries files, by opening the part.
Thanks !
Here's the code for appearances, to put in the Form code :
Private Sub UserForm_Initialize()
Dim oBiblis As AssetLibraries
Dim oBibli As AssetLibrary
Dim oProjectBiblis As ProjectAssetLibraries
Dim ligne(1)
'Get only Appearance libraries referenced by the current ipj
Set oBiblis = ThisApplication.DesignProjectManager.ActiveDesignProject.AppearanceLibraries
'Fill the libraries list
For Each oBibli In oBiblis
Liste_biblis.AddItem oBibli.DisplayName
Next oBibli
'Initialize the list on the 1st value
Liste_biblis.Value = Liste_biblis.List(1)
End Sub
'**************************************************
Private Sub Liste_biblis_Change()
Dim oBibli As AssetLibrary
Dim oAppearances As AssetsEnumerator
Dim oAppearance As Asset
'Get the name of the library selected in the Libraries list
Set oBibli = ThisApplication.AssetLibraries.item(Liste_biblis.Value)
'Get the appearances
Set oAppearances = oBibli.AppearanceAssets
'Fill the list
Liste_apparences.Clear
For Each oAppearance In oAppearances
Liste_apparences.AddItem oAppearance.DisplayName
Next oAppearance
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.