- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to create a new part document, and make a model in it. After creating the part document, I create a part component definition. When trying to add a sketch to the workplane, I get the following error:
'WorkPlanes' does not contain a definition for 'Item' and no accessible extension method 'Item' accepting a first argument of type 'WorkPlanes' could be found (are you missing a directive or an assembly reference?)
My code shows failed attempts at getting the WorkPlane first, but also a failed attempt at just creating a sketch on the plane. All attempts have the same error. Why doesn't WorkPlanes.Item work?
Inv.PartDocument InvDoc = (Inv.PartDocument)g_InvApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject);
Inv.PartComponentDefinition PrtDef = g_InvDoc. ComponentDefinition;
Inv.WorkPlane Wplane = PrtDef.WorkPlanes.Item(3);
Inv.WorkPlane _Wplane = (Inv.WorkPlane)PrtDef.WorkPlanes.Item(3);
Inv.PlanarSketch CurSketch = PrtDef.Sketches.Add(PrtDef.WorkPlanes.Item(3));
Solved! Go to Solution.
Link copied