Save Path iLogic Rules - error in xml document(1, 1)

Save Path iLogic Rules - error in xml document(1, 1)

U22233272
Participant Participant
318 Views
1 Reply
Message 1 of 2

Save Path iLogic Rules - error in xml document(1, 1)

U22233272
Participant
Participant

Good morning dear community. I wanted to tell you that as I have gone deeper into ilogic regarding the rules, I have learned that it is better to save the external ilogic rules because the internal ones remain within the file, if this rule in the future should be modified, improved or updated, one should track every file where it has been used, open it and update it.
So when I want to save my rules I import them like this video:


https://www.youtube.com/watch?v=dzLMKdzNCIU


I pass the rules to a text block and save it, however when I want to import it I get this error.
paso 1: 

U22233272_0-1698251791159.png

paso 2:

U22233272_1-1698251821190.png

paso 3: - error

U22233272_2-1698251843957.png

The code I use is the following:

 

'------start of iLogic exportar PDF a color-------
'Definición de rutas y nombres de archivo:
oPath = "C:\Users\INGENIA TECNICO\Desktop\06 PROYECTOS EN INVENTOR\DISEÑO - 230017 - LINDLEY ARCA IQUITOS\PLANOS" 'Especifica la ubicación de destino donde se guardarán los archivos PDF.
oFileName = ThisDoc.FileName(False) 'Obtiene el nombre del archivo actual sin la extensión.
'Obtención de datos del documento actual:
oRevNum = iProperties.Value("Project", "Revision Number") 'Obtiene el número de revisión del proyecto.
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}") 'Obtiene la extensión de Autodesk Inventor que permite exportar documentos en PDF.
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0 'Monocromatico (1), Color (0)
oOptions.Value("Remove_Line_Weights") = 1 'Remover pesos de lineas Si(1) No (0)
oOptions.Value("Vector_Resolution") = 400 'Resolucion de las lineas
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets ' Exportar todas las paginas
'oOptions.Value("Custom_Begin_Sheet") = 2 'Inicio de pagina para exportar personalizado'
'oOptions.Value("Custom_End_Sheet") = 4 'Fin de pagina para exportar personalizado
End If

'obtiene la ruta objetivo del PDF
oFolder = Left(oPath, InStrRev(oPath, "\")) & "DOCUMENTOS EN PDF"

'Verifica el folder del PDF y lo crea si este no existe
If Not System.IO.Directory.Exists(oFolder) Then
System.IO.Directory.CreateDirectory(oFolder)
End If

'Aplica nombre de archivo al objetivo
oDataMedium.FileName = oFolder & "\" & oFileName &" REV. " & oRevNum & ".pdf"

'Publica el documento document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'------Fin del iLogic-------

 

I really appreciate the help.

 

 

 

0 Likes
319 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @U22233272.  It looks like you are attempting to import a text file, instead of an XML file, from the Advanced iLogic Configuration dialog.  That will not work.  You can only import one of the XML files that have been exported from that dialog before.  Another way to set those directories is through using an iLogic rule, similar to the following example:

Dim oXDirs(3) As String
oXDirs(0) = "C:\Temp\External iLogic Rules\Dir1\"
oXDirs(1) = "C:\Temp\External iLogic Rules\Dir2\"
oXDirs(2) = "C:\Temp\External iLogic Rules\Dir3\"
oXDirs(3) = "C:\Temp\External iLogic Rules\Dir4\"
iLogicVb.Automation.FileOptions.ExternalRuleDirectories = oXDirs

The last line of code show there is how you access that setting.  Its value is an Array of String (String()).  You can get that array, or you can set that array, but you can not edit the existing array directly in place.  Instead, to 'set' its value, you must either get its value (the existing array) to a variable, then edit that copied array, then set that array back to the property as its value, or you must create a new array, then set that as the property's value.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes