Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
In the assembly file, I want the user to select a part and a face belonging to this part. As a result, I create a workplane on this surface with “AddByPlaneAndOffset”.
So far, my code below was working fine, but recently I started getting the "The parameter is incorrect".
I understood that this error was caused by changes made to the selected part in the assembly file. For example, if I drill a hole in part1 during assembly, as in the photo. This prevents me from creating a Workplane on the surface selected in part1.
How can I fix this situation? Thanks in advance.
var part = (ComponentOccurrence)InventorApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select Part");
PartComponentDefinition partComponentDefination = (PartComponentDefinition)part.Definition;
var oFaceProxy = (FaceProxy)InventorApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select Face");
Face faceNative = oFaceProxy.NativeObject;
WorkPlane workPlane = partComponentDefination.WorkPlanes.AddByPlaneAndOffset(faceNative, 0);
Solved! Go to Solution.