Inventor API - Import Solidworks turn off "Save in Subfolder"

Inventor API - Import Solidworks turn off "Save in Subfolder"

dave_taylor
Advocate Advocate
342 Views
2 Replies
Message 1 of 3

Inventor API - Import Solidworks turn off "Save in Subfolder"

dave_taylor
Advocate
Advocate

Can someone point me to the NameValueMap for "Save In Subfolder"?

I'm creating some code to automatically convert files and I want to turn that off because I do not want the exported files to be placed in subfolders and directly in the destination folder I give it.

 

dave_taylor_0-1688048752303.png

 


Dave Taylor
MCAD Solutions Engineer
Hagerman & Co.


Autodesk Certified Instructor - Platinum



*Likes to this post are appreciated if the information I have shared is helpful to you and/or others...
**Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.
0 Likes
Accepted solutions (1)
343 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

Hi @dave_taylor.  Below is an iLogic rule you can use to investigate what options are available by code when using one of the TranslatorAddin objects to Open/Import a non-native file.  There is a very similar rule for getting the options for when you are exporting.

Sub Main
	Dim oTranslator As TranslatorAddIn = Nothing
	For Each oAppAddin As ApplicationAddIn In ThisApplication.ApplicationAddIns
		If oAppAddin.DisplayName = "Translator: SolidWorks" Then oTranslator = oAppAddin
	Next
	If oTranslator Is Nothing Then Exit Sub 'it was not found
	'specify the full path & file name of the file you want to Open or Import.
	Dim sSolidWorksFile As String = "C:\Temp\MySWfile.sldprt"
	LogTranslatorOptions(oTranslator, sSolidWorksFile)
End Sub

Sub LogTranslatorOptions(oTransAddIn As TranslatorAddIn, sFileName As String)
	Dim oDataMedium As DataMedium = ThisApplication.TransientObjects.CreateDataMedium
	oDataMedium.FileName = sFileName
	Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
	oContext.Type = IOMechanismEnum.kUnspecifiedIOMechanism
	Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
	If oTransAddIn.HasOpenOptions(oDataMedium , oContext, oOptions) Then
		Dim i As Integer = 1
		For Each oPair In oOptions
			Dim sName As String = oOptions.Name(i)
			Dim oValue As Object = oOptions.Value(sName)
			Logger.Info("Option Name =   " & sName & vbCrLf & "Option Value =   " & oValue.ToString)
			i = i + 1
		Next
	End If
End Sub

And below is what I got in my iLogic Log window (I'm using Inventor Pro 2024).

INFO| 5: >>---------------------------
INFO|Option Name = EnableSaveComponentDuringLoad
Option Value = False
INFO|Option Name = SaveLocationIndex
Option Value = 2
INFO|Option Name = ComponentDestFolder
Option Value = C:\Temp\
INFO|Option Name = AssemDestFolder
Option Value = C:\Temp\
INFO|Option Name = SaveAssemSeperateFolder
Option Value = False
INFO|Option Name = AddFilenamePrefix
Option Value = False
INFO|Option Name = FilenamePrefix
Option Value =
INFO|Option Name = AddFilenameSuffix
Option Value = False
INFO|Option Name = FilenameSuffix
Option Value =
INFO|Option Name = EmbedInDocument
Option Value = False
INFO|Option Name = SaveToDisk
Option Value = False
INFO|Option Name = ImportSolid
Option Value = True
INFO|Option Name = ImportSurface
Option Value = True
INFO|Option Name = ImportWire
Option Value = True
INFO|Option Name = ImportWorkPlane
Option Value = True
INFO|Option Name = ImportWorkAxe
Option Value = True
INFO|Option Name = ImportWorkPoint
Option Value = True
INFO|Option Name = ImportMeshes
Option Value = True
INFO|Option Name = ImportValidationProperties
Option Value = False
INFO|Option Name = CreateIFO
Option Value = False
INFO|Option Name = ImportAASP
Option Value = False
INFO|Option Name = ImportAASPIndex
Option Value = 0
INFO|Option Name = CreateSurfIndex
Option Value = 1
INFO|Option Name = GroupName
Option Value =
INFO|Option Name = GroupNameIndex
Option Value = 0
INFO|Option Name = ExplodeMSB2Assm
Option Value = False
INFO|Option Name = ImportUnit
Option Value = 0
INFO|Option Name = CheckDuringLoad
Option Value = False
INFO|Option Name = AutoStitchAndPromote
Option Value = True
INFO|Option Name = AdvanceHealing
Option Value = False
INFO|Option Name = EdgeSplitAndMergeDisabled
Option Value = False
INFO|Option Name = FaceSplitAndMergeDisabled
Option Value = False
INFO|Option Name = AssociativeImport
Option Value = False
INFO|Option Name = Selective Import
Option Value = False
INFO|Option Name = Link Visibility
Option Value = True
INFO|Option Name = SaveInSubFolder
Option Value = True
INFO|Option Name = PathOption
Option Value = -1
INFO|Option Name = UserPath
Option Value =

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

dave_taylor
Advocate
Advocate
Thank you. The "SaveInSubFolder" is what I was looking for!

Dave Taylor
MCAD Solutions Engineer
Hagerman & Co.


Autodesk Certified Instructor - Platinum



*Likes to this post are appreciated if the information I have shared is helpful to you and/or others...
**Did this resolve your issue? Please accept it "As a Solution" so others may benefit from it.
0 Likes