What's new

Can't get suppressed sub-sub-assemblies.

In my case false positive is less bad than false negative.

Thanks for all the help you provide! I don't know how anybody could find out all these little details otherwise.
 

bolsover

Senior Member
Just wondering if it might be possible to interrogate the the raw .AD_ASM files in some way other than by using the Alibre API.
Alibre files appear to be based on MS OLE Structured Storage or MS Compound Binary File Format. There do not appear to be many tools available to interrogate these types of file but there is SSView https://www.mitec.cz/ssv.html and OpenMcdf https://github.com/ironfede/openmcdf both of which will open Alibre files and permit a more rational view of the contents.
I do not know what might be involved but OpenMcdf might be a good starting point for a custom tool that can open and parse the relevant section of the data file.

It might be helpful if you could let us know what the end goal is..

David
 

stepalibre

Alibre Super User
Just wondering if it might be possible to interrogate the the raw .AD_ASM files in some way other than by using the Alibre API.
Alibre files appear to be based on MS OLE Structured Storage or MS Compound Binary File Format. There do not appear to be many tools available to interrogate these types of file but there is SSView https://www.mitec.cz/ssv.html and OpenMcdf https://github.com/ironfede/openmcdf both of which will open Alibre files and permit a more rational view of the contents.
I do not know what might be involved but OpenMcdf might be a good starting point for a custom tool that can open and parse the relevant section of the data file.

It might be helpful if you could let us know what the end goal is..

David
You are correct, I used to save Alibre files as OLE objects in office documents. @cadtec's approach is likely similar, a view of the database:
1715082916036.png


I wonder what is gained by not using the API if the same information is available. If more data is accessible through the raw reading of Alibre files, then I'm interested. Another benefit would be data access speed, COM is slow. The software I used to work with OLE and COM objects are either retired or not maintain. openmcdf looks more active than ssv. But the downside is that these are very old technologies, dependent on Alibre maintaining the file format.
 
Last edited:

bolsover

Senior Member
I wonder what is gained by not using the API if the same information is available. If more data is accessible through the raw reading of Alibre files, then I'm interested.
If I remember correctly, the 'Version Comment' data is not available through the API but must be in the file.. somewhere... likely as a string value pair.
 

stepalibre

Alibre Super User
Version comment?
1715090213674.png
You can make a custom version comment:
PartSession.DesignProperties.CustomProperty("Version Comment")
PartSession.DesignProperties.CustomProperty("Version Comment","Version is updated")

1715090570327.png
 

bolsover

Senior Member
@stepalibre - Yes - but to do that you need to edit the file. I suspect that 'Version Comment' should have been exposed in the API as an extended property - but was forgotten.
David
 

stepalibre

Alibre Super User
To get constituents using OpenMcdf:
Code:
Sub Main(args As String())
    Dim target As CFStream = GetTargetStream()
    If target Is Nothing OrElse Not target.IsStream Then
        Console.WriteLine("Only stream data can be exported")
        Return
    End If
    Dim sanitizedFileName As String = SanitizeFileName(target.Name)
    If String.IsNullOrEmpty(sanitizedFileName) Then
        sanitizedFileName = "CONSTITUENTS"
    End If
    Dim desktopPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    Dim fullPath As String = Path.Combine(desktopPath, sanitizedFileName & ".bin")
    Try
        Using fs As New FileStream(fullPath, FileMode.CreateNew, FileAccess.Write)
            Dim data As Byte() = target.GetData()
            fs.Write(data, 0, data.Length)
            fs.Flush()
        End Using
        Console.WriteLine("File saved successfully: " & fullPath)
    Catch ex As Exception
        Console.WriteLine("error: " & ex.Message)
    End Try
End Sub
Private Function SanitizeFileName(fileName As String) As String
    Dim sanitizedFileName As String = String.Empty
    For Each c As Char In fileName
        If Char.GetUnicodeCategory(c) = UnicodeCategory.LetterNumber OrElse
           Char.GetUnicodeCategory(c) = UnicodeCategory.LowercaseLetter OrElse
           Char.GetUnicodeCategory(c) = UnicodeCategory.UppercaseLetter Then
            sanitizedFileName &= c
        End If
    Next
    Return sanitizedFileName
End Function
Private Function GetTargetStream() As CFStream
    Dim filename As String = "C:\Users\steph\Desktop\AssemblyB\New Assembly (1).AD_ASM"
    Dim cf As New CompoundFile(filename)
    Dim foundStream As CFStream = cf.RootStorage.GetStream("CONSTITUENTS")
    Dim temp As Byte() = foundStream.GetData()
    Return foundStream
End Function
Output:
Code:
r<Repository Guid="7F5A5268-24CA-46F8-A175-A4BEB9295A0C" Name="C" V3Name="" Type="File"/>
:/Users/steph/Desktop/AssemblyB/tangent-edge-fillets|714F3F65-368A-4BE2-BB97-5D04AAD8C70A||1|2:?/<Repository Guid="7F5A5268-24CA-46F8-A175-A4BEB9295A0C" Name="C" V3Name="" Type="File"/>
:/Users/steph/Desktop/AssemblyB/tangent-edge-fillets|714F3F65-368A-4BE2-BB97-5D04AAD8C70A||1||||2�<Repository Guid="7F5A5268-24CA-46F8-A175-A4BEB9295A0C" Name="C" V3Name="" Type="File"/>
:/Users/steph/Desktop/AssemblyB/DEVICE_D/test-full-round-fillet-geometry|3815A08B-7002-47BB-B2CD-202E6B4E1533||1|2:?/<Repository Guid="7F5A5268-24CA-46F8-A175-A4BEB9295A0C" Name="C" V3Name="" Type="File"/>
:/Users/steph/Desktop/AssemblyB/DEVICE_D/test-full-round-fillet-geometry|3815A08B-7002-47BB-B2CD-202E6B4E1533||1|||DEVICE_D/|2
This is the basics of working with the library.
@stepalibre - Yes - but to do that you need to edit the file. I suspect that 'Version Comment' should have been exposed in the API as an extended property - but was forgotten.
David
I agree, it should be included. Thanks for mentioning OpenMcdf and the rabbit hole that followed! This data is in plain text so any hex/text editor can be used to view it.
Here is the version comment and yes there may be more data in the files.
1715092926421.png
1715093286508.png

I need to spend more time making a real solution and checking things but is this a good start.
 

stepalibre

Alibre Super User
In my case false positive is less bad than false negative.

Thanks for all the help you provide! I don't know how anybody could find out all these little details otherwise.
Thanks for sharing details, as we all learn and work through problems. This detour into reading Alibre files is very interesting. Reading the files should be safe to do when only dumping the plain text contents to a file. This is 20x faster than running headless to get the same or similar data.

A STEP file custom scheme appear to be used to store the embedded data, from what I understand from the structure and header information.
 

stepalibre

Alibre Super User
Reading the files should be safe to do when only dumping the plain text contents to a file.
I need to clarify that, of course the Alibre file contents can be read directly in code. I don't want to take this approach to be on the safe side.
 
Top