- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
According to the Autodesk Inventor 2024 Help Guide:
MakePath
Defines the path to a component name in a subassembly. To specify the path, list all subassembly levels in the order they appear in the tree. This function is required if you want to specify a component name when the same name also exists elsewhere in the assembly.
Syntax
MakePath(“SubassemblyComponentName”,“PartComponentName”)
Examples
Component.Color(MakePath("SubAssem1:1", "Part2:1")) = “Green” Component.IsActive(MakePath("SubAssem1:1", "SubSubAssem2:1", "Part2:1")) = “Yellow”
My code below is supposed to change the color of the valves based on whether they are open (dark green) or closed (red) depending on the value of the parameter CYCLE.
If CYCLE = "FILTRATION" Then
Component.Color(MakePath("Tube & Pipe Runs", "NEW LINES:1", "4 inch s31 with haz loc s70:1")) = "Dark Green"
Component.Color(MakePath("Tube & Pipe Runs", "NEW LINES:1", "Parker Brass Ball Valve XV520P XV520P-48:1")) = "Dark Green"
Component.Color(MakePath("Tube & Pipe Runs", "NEW LINES:1", "4 inch s31 with haz loc s70:2")) = "Dark Green"
Component.Color(MakePath("Tube & Pipe Runs", "720A-SPOOL-002:1", "3 inch s31 with haz loc s70:1")) = "Red"
Component.Color(MakePath("Tube & Pipe Runs", "720A-SPOOL-003:1", "3 inch s31 with haz loc s70:1")) = "Red"
Component.Color(MakePath("Tube & Pipe Runs", "720A-SPOOL-003:1", "4 inch s31 with haz loc s70:1")) = "Red"
End If
When I run the code I get the following error:
Error on line 2 in rule: CYCLE CONTROLLER, in document: 720A-TOP ASSEMBLY.iam
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
I do not get the error if i remove the MakePath expression from each line and only reference a subassembly or part inside the top assembly. Only when referencing a part or subassembly inside a subassembly (which requires the MakePath expression) do I get the error.
Solved! Go to Solution.