Hi, i'm using a parameter to drive a user selected save file location for 3d files and 2d files.
However iLogic can't seem to find the specified location, even though its there. Any solutions?
error code:
Error in rule: Print-n-save, in document: iLogic_export.dwg
Parameter: The document named "C:\Users\name\OneDrive - Group\Desktop\Tool\test\4222012\3D\4222012.iam" was not found.
I can find the file by copy-pasting this path into explorer outside of inventor, and i can see that the file is there.
Sub Export Parameter.UpdateAfterChange = True oModelRef = ThisDrawing.ModelDocument.FullFileName DWGLocation = Parameter(oModelRef, "Location") Dim filePath As String Dim subFolderName As String iProp = Parameter(oModelRef, "FileNaming") TopDoc = ThisDoc.Document
This is the code which gets the selected save location from a parameter within the assembly named "Location"
DWGLocation is a text parameter within my DWG file, which should copy the location text parameter within the inserted assembly.
.iam file exists at the location, so why is it not working?
Solved! Go to Solution.
Solved by A.Acheson. Go to Solution.
Solved by A.Acheson. Go to Solution.
Instead of getting the parameter you could get the iproperty exported from the parameter.
Or an alternate instead of using ilogic parameter function use the api directly
DWGLocation = ThisDrawing.ModelDocument.ComponentDefinition.Parameters.Item("Location").Value
Are you needing to manually place this file path in the assembly file parameter? There might be a way to retrieve the file path without storing it in the file. Can you explain your workflow with some images/bullet points.
Everything is updated automatically in the assembly when you use the form and click "export"
This updates a parameter called "Location" to the folder in which the assembly is saved.
the idea was to then get the parameter from my assembly and use it in the drawing without having to use another dialogbox to save - basically locking the save file location to the corresponding .iam (just to keep everything nice and structured)
i tried the iProperty version, since i already have the Location parameter write a custom i property value with the same filepath.
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at ThisRule.Export()
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
this is the detailed error i get when doing it this way
I see you can if you want to skip the parameter step by referencing the drawing views document folder or (directory) using the Ilogic snippet.
Dim Location As String = System.IO.Path.GetDirectoryName(ThisDrawing.ModelDocument.FullFileName)
Here is microsoft documentation for GetDirectoryName
I was silly and didnt realise i was trying to reference a parameter which was non existenten in assembly(its There in drawing) i had Them mixed up - everything works as it should now. Thank you!