本文整理汇总了C#中Inventor.GetTemplateFile方法的典型用法代码示例。如果您正苦于以下问题:C# Inventor.GetTemplateFile方法的具体用法?C# Inventor.GetTemplateFile怎么用?C# Inventor.GetTemplateFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventor
的用法示例。
在下文中一共展示了Inventor.GetTemplateFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRevolveFeature
public void CreateRevolveFeature(Inventor.Application ThisApplication)
{
PartDocument partDoc;
partDoc = (PartDocument)ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject,
ThisApplication.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kGB_DraftingStandard, null), true);
PlanarSketch sketch;
sketch = partDoc.ComponentDefinition.Sketches.Add(partDoc.ComponentDefinition.WorkPlanes[3], false);
TransientGeometry transGeom;
transGeom = ThisApplication.TransientGeometry;
SketchPoints skPnts;
skPnts = sketch.SketchPoints;
skPnts.Add(transGeom.CreatePoint2d(0, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1, 1), false);
SketchLines lines;
lines = sketch.SketchLines;
SketchLine line;
line = lines.AddByTwoPoints(skPnts[1], skPnts[2]);
SketchCircles circs;
circs = sketch.SketchCircles;
SketchCircle circ;
circ = circs.AddByCenterRadius(skPnts[3], 0.5);
Profile profile;
profile = sketch.Profiles.AddForSolid(true, null, null);
RevolveFeature revFeature;
revFeature = partDoc.ComponentDefinition.Features.RevolveFeatures.AddFull(profile, line, PartFeatureOperationEnum.kJoinOperation);
ThisApplication.ActiveView.Fit(true);
}
示例2: CreateExtrudeFeature
public void CreateExtrudeFeature(Inventor.Application ThisApplication)
{
PartDocument partDoc;
partDoc = (PartDocument)ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject,
ThisApplication.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kGB_DraftingStandard, null), true);
PlanarSketch sketch;
sketch = partDoc.ComponentDefinition.Sketches.Add(partDoc.ComponentDefinition.WorkPlanes[3], false);
TransientGeometry transGeom;
transGeom = ThisApplication.TransientGeometry;
SketchPoints skPnts;
skPnts = sketch.SketchPoints;
skPnts.Add(transGeom.CreatePoint2d(0, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1, 1), false);
SketchLines lines;
lines = sketch.SketchLines;
System.Array Line = System.Array.CreateInstance(typeof(SketchLine), 3);
SketchLine[] line = Line as SketchLine[];
line[0] = lines.AddByTwoPoints(skPnts[1], skPnts[2]);
line[1] = lines.AddByTwoPoints(skPnts[2], skPnts[3]);
line[2] = lines.AddByTwoPoints(skPnts[3], skPnts[1]);
Profile profile;
profile = sketch.Profiles.AddForSolid(true, null, null);
ExtrudeFeature extFeature;
extFeature = partDoc.ComponentDefinition.Features.ExtrudeFeatures.AddByDistanceExtent(
profile,1.0, PartFeatureExtentDirectionEnum.kPositiveExtentDirection,PartFeatureOperationEnum.kJoinOperation,null);
ThisApplication.ActiveView.Fit(true);
}
示例3: CreateSketchWithCons
public void CreateSketchWithCons(Inventor.Application ThisApplication)
{
PartDocument partDoc;
partDoc = (PartDocument)ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject,
ThisApplication.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kGB_DraftingStandard, null),true);
PlanarSketch sketch;
sketch = partDoc.ComponentDefinition.Sketches.Add(partDoc.ComponentDefinition.WorkPlanes[3], false);
TransientGeometry transGeom;
transGeom = ThisApplication.TransientGeometry;
SketchPoints skPnts;
skPnts = sketch.SketchPoints;
skPnts.Add(transGeom.CreatePoint2d(0, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1.0, 0), false);
skPnts.Add(transGeom.CreatePoint2d(1.0, 0.5), false);
skPnts.Add(transGeom.CreatePoint2d(2.2, 0.5), false);
skPnts.Add(transGeom.CreatePoint2d(0.5, 1.5), false);
skPnts.Add(transGeom.CreatePoint2d(0, 1.0), false);
skPnts.Add(transGeom.CreatePoint2d(2.7, 1.5), false);
skPnts.Add(transGeom.CreatePoint2d(0.5, 1.0), false);
SketchLines lines;
lines = sketch.SketchLines;
System.Array Line = System.Array.CreateInstance(typeof(SketchLine), 6);
SketchLine[] line = Line as SketchLine[];
line[0] = lines.AddByTwoPoints(skPnts[1], skPnts[2]);
line[1] = lines.AddByTwoPoints(skPnts[2], skPnts[3]);
line[2] = lines.AddByTwoPoints(skPnts[3], skPnts[4]);
line[3] = lines.AddByTwoPoints(skPnts[4], skPnts[7]);
line[4] = lines.AddByTwoPoints(skPnts[7], skPnts[5]);
line[5] = lines.AddByTwoPoints(skPnts[6], skPnts[1]);
SketchArcs arcs;
arcs = sketch.SketchArcs;
SketchArc arc;
arc = arcs.AddByCenterStartEndPoint(skPnts[8], skPnts[5], skPnts[6], true);
sketch.GeometricConstraints.AddPerpendicular((SketchEntity)line[3], (SketchEntity)line[4], true, true);
ThisApplication.ActiveView.Update();
sketch.GeometricConstraints.AddTangent((SketchEntity)line[4], (SketchEntity)arc, null);
sketch.GeometricConstraints.AddTangent((SketchEntity)line[5], (SketchEntity)arc, null);
ThisApplication.ActiveView.Update();
sketch.GeometricConstraints.AddParallel((SketchEntity)line[2], (SketchEntity)line[4], true, true);
ThisApplication.ActiveView.Update();
sketch.GeometricConstraints.AddHorizontal((SketchEntity)line[4], true);
ThisApplication.ActiveView.Update();
}