Revolve part Error

Revolve part Error

manasi_patilESZTV
Contributor Contributor
160 Views
0 Replies
Message 1 of 1

Revolve part Error

manasi_patilESZTV
Contributor
Contributor

When I try to revolve my sketch it gives mi error add solid profile is System.ArgumentException: 'Exception has been thrown by the target of an invocation.' I attached code of skectch belowThis error get at last Line.

PartDocument partDoc = inventorApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject,                                           inventorApp.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject),true) as PartDocument;
PartComponentDefinition compDef = partDoc.ComponentDefinition;
Transaction trans = inventorApp.TransactionManager.StartTransaction((_Document)partDoc, "Pressure Vessel");
PlanarSketch sketch = compDef.Sketches.Add(compDef.WorkPlanes[3]);  
SketchLine horizontalLine2 = sketch.SketchLines.AddByTwoPoints(
      inventorApp.TransientGeometry.CreatePoint2d(-(length / 2), dia / 2+ shellThk),
      inventorApp.TransientGeometry.CreatePoint2d((length / 2), dia / 2 + shellThk));
  SketchLine horizontalLine1 = sketch.SketchLines.AddByTwoPoints(
      inventorApp.TransientGeometry.CreatePoint2d(-(length / 2), dia / 2),
      inventorApp.TransientGeometry.CreatePoint2d((length / 2), dia / 2));
  SketchLine centerLine = sketch.SketchLines.AddByTwoPoints(inventorApp.TransientGeometry.CreatePoint2d(-(length / 2), 0), inventorApp.TransientGeometry.CreatePoint2d((length / 2), 0));
  centerLine.Centerline = true;
  Point2d centerPoint = inventorApp.TransientGeometry.CreatePoint2d((length / 2), 0);
  double majorRadiusInner = dia / 2;   // Example
  double minorRadiusInner = majorRadiusInner / 2;   // Example
  UnitVector2d majorAxisVector = inventorApp.TransientGeometry.CreateUnitVector2d(0, 1); // Major axis along X-axis
  double startAngle = 0;              
  double sweepAngle = -(Math.PI / 2);   
SketchEllipticalArc ellipticalArc1 = sketch.SketchEllipticalArcs.Add(centerPoint, majorAxisVector, majorRadiusInner, minorRadiusInner, startAngle, sweepAngle);
  double majorRadiusOuter = dia / 2 + shellThk;   // Example
  double minorRadiusOuter = majorRadiusInner / 2 + shellThk;   // Example
  SketchEllipticalArc ellipticalArc2 = sketch.SketchEllipticalArcs.Add(centerPoint, majorAxisVector, majorRadiusOuter, minorRadiusOuter, startAngle, sweepAngle);
  SketchLine horizontalL1 = sketch.SketchLines.AddByTwoPoints(
      inventorApp.TransientGeometry.CreatePoint2d((length / 2) + minorRadiusInner, 0),
      inventorApp.TransientGeometry.CreatePoint2d((length / 2) + minorRadiusOuter, 0));


  Point2d centerPoint1 = inventorApp.TransientGeometry.CreatePoint2d(-(length / 2), 0);
  double sweepAngle1 = (Math.PI / 2);    // 90 degrees arc
  SketchEllipticalArc ellipticalArc3 = sketch.SketchEllipticalArcs.Add(centerPoint1, majorAxisVector, majorRadiusInner, minorRadiusInner, startAngle, sweepAngle1);
SketchEllipticalArc ellipticalArc4 = sketch.SketchEllipticalArcs.Add(centerPoint1, majorAxisVector, majorRadiusOuter, minorRadiusOuter, startAngle, sweepAngle1);
SketchLine horizontalL2 = sketch.SketchLines.AddByTwoPoints(
      inventorApp.TransientGeometry.CreatePoint2d(-((length / 2) + minorRadiusInner), 0),
      inventorApp.TransientGeometry.CreatePoint2d(-((length / 2) + minorRadiusOuter), 0));
 Profile profile = sketch.Profiles.AddForSolid();

 

0 Likes
161 Views
0 Replies
Replies (0)