Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parameter path cannot be null?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
danny
1538 Views, 5 Replies

Parameter path cannot be null?

Hi All, I have a iLogic rule for saving drawings (dwg) to a pdf file in a designated folder. Everything worked well until this Monday morning. Now I get the message: Error in rule: Save2PDF, in document: 13006-027 propflens-1.dwg Value cannot be null. Parameter name: path What can I do to make it work again? This weekend a windows7 update has occurred. This is the iLogic Code: '------start of temp i Logic------- First update settings Dim oControlDef as ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("UpdateCopiedModeliPropertiesCmd") oControlDef.Execute2(True) '------end of temp i Logic------- '------start of iLogic------- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium oTekNr = iProperties.Value("Custom", "Tekening Nummer") oSubTitle = iProperties.Value("Summary", "Title") oNewFolder = iProperties.Value("Custom", "ExportMap") If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets 'oOptions.Value("Custom_Begin_Sheet") = 2 'oOptions.Value("Custom_End_Sheet") = 4 End If 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If 'Set the PDF target file name If oTekNr = "" Then oDataMedium.FileName = oNewFolder & "\" & oFileName & _ " Rev" & oRevNum & ".pdf" Else oDataMedium.FileName = oNewFolder & "\" & oTekNr & "_" & oFileName & _ " Rev" & oRevNum & ".pdf" End If 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) 'MessageBox.Show("De PDF is gemaakt en staat in de volgende map: " & oFolder , "Regel") 'Show in Explorer Shell("explorer.exe " & oNewFolder,vbNormalFocus) '------end of iLogic-------
Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1
5 REPLIES 5
Message 2 of 6
danny
in reply to: danny

Why, can't I change this post?
Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1
Message 3 of 6
danny
in reply to: danny

Why don't the menu options and Topic Options don't work? Even the preview doesn't work! I cannot change my first post, It is not very clear. I even cannot delete it... Not so happy with new styling... Looks good, works bad..
Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1
Message 4 of 6
adam.nagy
in reply to: danny

Hi Danny,

 

I'm checking with the forum people where to ask/log forum related issues.

 

Concerning your iLogic code. The problem is that you're checking if the path defined by oFolder exists, but that variable is not set since you are using oNewFolder.

So just change this part of the code from this

If Not System.IO.Directory.Exists(oFolder) Then 
System.IO.Directory.CreateDirectory(oFolder) 
End If 

to this

If Not System.IO.Directory.Exists(oNewFolder) Then 
System.IO.Directory.CreateDirectory(oNewFolder) 
End If

One way of avoding this would be if you forced yourself to declare variables - you can do that by adding "Option Explicit" at the top of your code.

 

Cheers, 



Adam Nagy
Autodesk Platform Services
Message 5 of 6
Discussion_Admin
in reply to: danny

You can edit or delete your post up to 30 minutes or someone replies to what ever comes first

 

 

We are aware of several issues and havee fix several of them and are working digently on others check the Community Feedback fourm to see if your's have been listed or post a new issue\comment.

 

Thanks
Discussion_Admin

Message 6 of 6
danny
in reply to: adam.nagy

Thanks, I will look into the declaration of the variables!
Regards
Danny

Inventor 2014 sp1 | Vault basic 2014 | HP Elitebook 8670W | win7 64b | 8Gb | GMT +1

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report