IDocuments.ImportWithOptions Method

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, Daniel, jacs

Post Reply
cam
Master Corporal
Master Corporal
Posts: 38
Joined: Fri Oct 02, 2009 9:46 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.7
Location: Germany

IDocuments.ImportWithOptions Method

Post by cam » Wed May 24, 2017 9:51 am

Hi folks

how can I get the importer Index and associated fileextension (e.g. ".step")
or a list of all importer indexes and the associated fileextensions
Last edited by cam on Wed May 31, 2017 11:35 am, edited 1 time in total.
Greetings
Chris

User avatar
JuP
Master Chief
Master Chief
Posts: 127
Joined: Tue Sep 09, 2014 5:45 pm

Re: IDocuments.ImportWithOptions Method

Post by JuP » Tue May 30, 2017 6:16 pm

Hi,

You have to scan all importer and research step.
Example of code for importer searching:

Code: Select all

'Importer searching (Ok)
            Dim Importer As Integer
            Try
                For i = 0 To 50
                    Dim ExitFor As Boolean
                    Dim FileTypeName As String = ""
                    Dim FileExtensions As String() = Nothing
                    TopSolidHost.Application.GetImporterFileType(i, FileTypeName, FileExtensions)       'Importers getting
                    For Each FileExension As String In FileExtensions       'For each importer found
                        FileExension = FileExension.ToUpper()
                        Extension = Extension.ToUpper()
                        If FileExension = Extension Then        'If active importer correspond
                            Importer = i
                            ExitFor = True
                            Exit For
                        End If
                    Next
                    If ExitFor = True Then
                        Exit For
                    End If
                Next
            Catch ex As Exception
                MsgBox("Aucun importer trouvé")
                Me.Close()
                Exit Function
            End Try
"Extension" is juste a string with wich contains your extension like that:

Code: Select all

Dim Extension As String = ".step"
After that you have to use keyvalues for choose importer options, other example:

Code: Select all

Dim ImporterOptions As New List(Of KeyValue)
                Dim KeyValueImplemented As New KeyValue

                KeyValueImplemented.Key = "TRANSLATES_ATTRIBUTES"
                KeyValueImplemented.Value = "True"
                ImporterOptions.Add(KeyValueImplemented)

                KeyValueImplemented.Key = "SIMPLIFIES_GEOMETRY"
                KeyValueImplemented.Value = "False"
                ImporterOptions.Add(KeyValueImplemented)
                
                KeyValueImplemented.Key = "TRANSLATES_FREE_CURVES"
                KeyValueImplemented.Value = "True"
                ImporterOptions.Add(KeyValueImplemented)

                KeyValueImplemented.Key = "TRANSLATES_FREE_SURFACES"
                KeyValueImplemented.Value = "True"
                ImporterOptions.Add(KeyValueImplemented)

                 KeyValueImplemented.Key = "TRANSLATES_HIDDEN_ENTITIES"
                 KeyValueImplemented.Value = "True"
                 ImporterOptions.Add(KeyValueImplemented)
                        
I hope this was helpful
Julien . P
Youtube
Grabcad

cam
Master Corporal
Master Corporal
Posts: 38
Joined: Fri Oct 02, 2009 9:46 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.7
Location: Germany

Re: IDocuments.ImportWithOptions Method

Post by cam » Wed May 31, 2017 11:34 am

Bonjour Julien,

yes this is very helpful

Merci beaucoup
Greetings
Chris

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest