Message 1 of 5

Not applicable
05-10-2018
05:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
Here is my c#code
private void button2_Click(object sender, EventArgs e) { Inventor.Application application = (Inventor.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application");
PartDocument prt = (PartDocument)application.Documents.Add(DocumentTypeEnum.kPartDocumentObject, application.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject), true);
prt.UnitsOfMeasure.LengthUnits = UnitsTypeEnum.kMillimeterLengthUnits;
PartComponentDefinition cdef = prt.ComponentDefinition; PlanarSketch sktch = cdef.Sketches.Add(cdef.WorkPlanes["XY Plane"], true); TransientGeometry transgeo = application.TransientGeometry; SketchLine pipe = sktch.SketchLines.AddByTwoPoints(transgeo.CreatePoint2d(0, 0), transgeo.CreatePoint2d(0, 10)); pipe.Centerline = true; SketchEntitiesEnumerator rectanglelines = sktch.SketchLines.AddAsTwoPointRectangle(transgeo.CreatePoint2d(2, 0), transgeo.CreatePoint2d(5, 3)); Profile profile2 = sktch.Profiles.AddForSolid(); RevolveFeature revolve = cdef.Features.RevolveFeatures.AddFull(profile2, pipe, PartFeatureOperationEnum.kJoinOperation); SurfaceBodies bodies = revolve.SurfaceBodies; WorkPlane wp = cdef.WorkPlanes.AddByPlaneAndOffset(bodies[1].Faces[2], 0); PlanarSketch sktch2 = cdef.Sketches.Add(wp, true); SketchPoint point = sktch2.SketchPoints.Add(transgeo.CreatePoint2d(0, 2.5)); sktch2.Shared = true; wp.Shared = true; HoleFeature hf = cdef.Features.HoleFeatures.AddDrilledByThroughAllExtent(point,0.1, PartFeatureExtentDirectionEnum.kPositiveExtentDirection); }
i always get "HRESULT: 0x80004005 "
i think i'm doing exactly same in the İnventors' Hole Exapmles;
Thank You for your help.
Solved! Go to Solution.