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: 

Cant find reference assembly file in drawing

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
op_thorsager
169 Views, 4 Replies

Cant find reference assembly file in drawing

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?

4 REPLIES 4
Message 2 of 5
A.Acheson
in reply to: op_thorsager

 

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.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 5
op_thorsager
in reply to: A.Acheson

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

Message 4 of 5
A.Acheson
in reply to: op_thorsager

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

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 5
op_thorsager
in reply to: A.Acheson

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!

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

Post to forums  

Autodesk Design & Make Report