IDocuments.ImportWithOptions Method

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

Moderators: remi77, jacs, Daniel

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

IDocuments.ImportWithOptions Method

Unread post by cam »

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
Major
Major
Posts: 169
Joined: Tue Sep 09, 2014 5:45 pm
Answers: 6
TopSolid Module: TopSolid'Steel
TopSolid Version: 7.14

Re: IDocuments.ImportWithOptions Method

Unread post by JuP »

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 POIROT
TopSolid'Steel Product Manager
Youtube
GrabCad
Facebook
cam
Master Corporal
Master Corporal
Posts: 39
Joined: Fri Oct 02, 2009 9:46 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 7.8
Location: Germany

Re: IDocuments.ImportWithOptions Method

Unread post by cam »

Bonjour Julien,

yes this is very helpful

Merci beaucoup
Greetings
Chris
Post Reply