///////////////////////////////////////////////////////////// // Use: Add selection filter. // ///////////////////////////////////////////////////////////// public void AddSelectionFilter(SelectionFilterEnum filter) { if (_SelectEvents != null) { _SelectEvents.AddSelectionFilter(filter); } }
public void selOval(ref Edge edge1, string promt1, SelectionFilterEnum filter) { if (promt1 != "") { edge1 = (Edge)CmdMgr.Pick(filter, promt1); } }
private MateiMateDefinition findAxis(PartComponentDefinition def, Edge ed) { if (ed.TangentiallyConnectedEdges.Count == 1) { Face f = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) ? ed.Faces[1] : ed.Faces[2]; return(def.iMateDefinitions.AddMateiMateDefinition(f, 0, InferredTypeEnum.kInferredLine)); } SelectionFilterEnum[] sels = new SelectionFilterEnum[] { SelectionFilterEnum.kWorkAxisFilter }; Arc3d c = ed.Geometry as Arc3d; ObjectsEnumerator col = def.FindUsingPoint(ed.PointOnEdge, ref sels, c.Radius * 5, false); WorkAxis ax = null; foreach (var item in col.OfType <WorkAxis>()) { ax = item; //Face f = (ed.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) ? ed.Faces[1]: ed.Faces[2]; if (ax.DefinitionType == WorkAxisDefinitionEnum.kNormalToSurfaceWorkAxis) { return(def.iMateDefinitions.AddMateiMateDefinition(ax, 0, InferredTypeEnum.kInferredLine)); } ax = null; } if (ax == null) { return(iMate__(ed, def)); } return(null); }
public void selEdge(string promt, SelectionFilterEnum filter) { PartFeature pf = CmdMgr.Pick(filter, promt) as PartFeature; HoleFeature hf = pf as HoleFeature; if (hf == null) { return; } //ICollection<Edge> col = null; foreach (Face item in hf.SideFaces) { Edge ed = checkBox1.Checked ? item.Edges[2] : item.Edges[1]; edges.Add(ed); } // System.Collections.IEnumerator en = PartCompDef.Features.GetEnumerator(); // en.Reset(); // while(en.Current != null) // { // en. // } PartCompDef = hf.Parent as PartComponentDefinition; // for (int i = 1; i < PartCompDef.Features.Count; i++) // { // MirrorFeature mf = PartCompDef.Features[i] as MirrorFeature; // if (mf == null) continue; // HoleFeature holeF = PartCompDef.Features[i - 1] as HoleFeature; // if (hf == null) // holeF = PartCompDef.Features[i - 2] as HoleFeature; // else // continue; // foreach (PartFeature item in mf.ParentFeatures) // { // if (item is HoleFeature && holeF.Equals(item)) // { // if (mf.Faces[1].SurfaceType == SurfaceTypeEnum.kCylinderSurface) // edges.Add(mf.Faces[1].Edges[1]); // } // } // } foreach (MirrorFeature item in PartCompDef.Features.MirrorFeatures) { foreach (PartFeature m in item.ParentFeatures) { if (m.Equals(hf)) { if (item.Faces[1].SurfaceType != SurfaceTypeEnum.kCylinderSurface) { continue; } Edge ed = checkBox1.Checked ? item.Faces[1].Edges[2] : item.Faces[1].Edges[1]; edges.Add(ed); } } } }
static public object Pick(SelectionFilterEnum f, string prompt) { return(I.app.CommandManager.Pick(f, prompt)); }
public void selEdge(ref Edge edge1, ref Edge edge2, string promt1, string promt2, SelectionFilterEnum filter) { if (promt1 != "") { edge1 = (Edge)CmdMgr.Pick(filter, promt1); } if (promt2 != "") { edge2 = (Edge)CmdMgr.Pick(filter, promt2); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Use: //// This sample demonstrates the creation of sheet metal face and cut features. //// It creates a new sheet metal document, create a face feature, a cut feature //// and another face feature. The second face feature butts up to the first //// face feature so it automatically creates a bend between them. //// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void FaceAndCutFeatureCreation() { // Create a new sheet metal document, using the default sheet metal template. PartDocument oSheetMetalDoc; oSheetMetalDoc = (Inventor.PartDocument)(_InvApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kDefault_DraftingStandard, "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"), System.Convert.ToBoolean(-1))); // Set a reference to the component definition. SheetMetalComponentDefinition oCompDef; oCompDef = (Inventor.SheetMetalComponentDefinition)(oSheetMetalDoc.ComponentDefinition); // Set a reference to the sheet metal features collection. SheetMetalFeatures oSheetMetalFeatures; oSheetMetalFeatures = (Inventor.SheetMetalFeatures)(oCompDef.Features); // Create a new sketch on the X-Y work plane. PlanarSketch oSketch; oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes[3], false); // Set a reference to the transient geometry object. TransientGeometry oTransGeom; oTransGeom = _InvApplication.TransientGeometry; // Draw a 20cm x 15cm rectangle with the corner at (0,0) oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(20, 15)); // Create a profile. Profile oProfile; oProfile = oSketch.Profiles.AddForSolid(); FaceFeatureDefinition oFaceFeatureDefinition; oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile); // Create a face feature. FaceFeature oFaceFeature; oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition); // Get the top face for creating the new sketch. SelectionFilterEnum[] aSelectTypes = new SelectionFilterEnum[1]; aSelectTypes[0] = SelectionFilterEnum.kPartFaceFilter; ObjectsEnumerator oFoundFaces; oFoundFaces = oCompDef.FindUsingPoint(oTransGeom.CreatePoint(1, 1, oCompDef.Thickness.Value), ref aSelectTypes, 0.001, System.Convert.ToBoolean(-1)); Face oFrontFace; oFrontFace = (Inventor.Face)(oFoundFaces[1]); // Create a new sketch on this face, but use the method that allows you to // control the orientation and orgin of the new sketch. oSketch = oCompDef.Sketches.Add(oFrontFace, false); // Create the interior 3cm x 2cm rectangle for the cut. oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(2, 5.5), oTransGeom.CreatePoint2d(5, 11)); // Create a profile. oProfile = oSketch.Profiles.AddForSolid(); // Create a cut definition object CutDefinition oCutDefinition; oCutDefinition = oSheetMetalFeatures.CutFeatures.CreateCutDefinition(oProfile); // Set extents to 'Through All' oCutDefinition.SetThroughAllExtent(PartFeatureExtentDirectionEnum.kNegativeExtentDirection); // Create the cut feature CutFeature oCutFeature; oCutFeature = oSheetMetalFeatures.CutFeatures.Add(oCutDefinition); // Create a new sketch on the X-Z work plane. oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes[2], false); // Draw a 15cm x 10cm rectangle with the corner at (0,0) oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(-15, 10)); // Create a profile.oBendEdgesoBendEdges oProfile = oSketch.Profiles.AddForSolid(); oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile); // Create a face feature. oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Use: //// This sample demonstrates the creation of sheet metal face and cut features. //// It creates a new sheet metal document, create a face feature, a cut feature //// and another face feature. The second face feature butts up to the first //// face feature so it automatically creates a bend between them. //// /////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void FaceAndCutFeatureCreation() { // Create a new sheet metal document, using the default sheet metal template. PartDocument oSheetMetalDoc; oSheetMetalDoc = (Inventor.PartDocument) (_InvApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, _InvApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject, SystemOfMeasureEnum.kDefaultSystemOfMeasure, DraftingStandardEnum.kDefault_DraftingStandard, "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"), System.Convert.ToBoolean(-1))); // Set a reference to the component definition. SheetMetalComponentDefinition oCompDef; oCompDef = (Inventor.SheetMetalComponentDefinition) (oSheetMetalDoc.ComponentDefinition); // Set a reference to the sheet metal features collection. SheetMetalFeatures oSheetMetalFeatures; oSheetMetalFeatures = (Inventor.SheetMetalFeatures) (oCompDef.Features); // Create a new sketch on the X-Y work plane. PlanarSketch oSketch; oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes[3], false); // Set a reference to the transient geometry object. TransientGeometry oTransGeom; oTransGeom = _InvApplication.TransientGeometry; // Draw a 20cm x 15cm rectangle with the corner at (0,0) oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(20, 15)); // Create a profile. Profile oProfile; oProfile = oSketch.Profiles.AddForSolid(); FaceFeatureDefinition oFaceFeatureDefinition; oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile); // Create a face feature. FaceFeature oFaceFeature; oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition); // Get the top face for creating the new sketch. SelectionFilterEnum[] aSelectTypes = new SelectionFilterEnum[1]; aSelectTypes[0] = SelectionFilterEnum.kPartFaceFilter; ObjectsEnumerator oFoundFaces; oFoundFaces = oCompDef.FindUsingPoint(oTransGeom.CreatePoint(1, 1, oCompDef.Thickness.Value), ref aSelectTypes, 0.001, System.Convert.ToBoolean(-1)); Face oFrontFace; oFrontFace = (Inventor.Face) (oFoundFaces[1]); // Create a new sketch on this face, but use the method that allows you to // control the orientation and orgin of the new sketch. oSketch = oCompDef.Sketches.Add(oFrontFace, false); // Create the interior 3cm x 2cm rectangle for the cut. oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(2, 5.5), oTransGeom.CreatePoint2d(5, 11)); // Create a profile. oProfile = oSketch.Profiles.AddForSolid(); // Create a cut definition object CutDefinition oCutDefinition; oCutDefinition = oSheetMetalFeatures.CutFeatures.CreateCutDefinition(oProfile); // Set extents to 'Through All' oCutDefinition.SetThroughAllExtent(PartFeatureExtentDirectionEnum.kNegativeExtentDirection); // Create the cut feature CutFeature oCutFeature; oCutFeature = oSheetMetalFeatures.CutFeatures.Add(oCutDefinition); // Create a new sketch on the X-Z work plane. oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes[2], false); // Draw a 15cm x 10cm rectangle with the corner at (0,0) oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(-15, 10)); // Create a profile.oBendEdgesoBendEdges oProfile = oSketch.Profiles.AddForSolid(); oFaceFeatureDefinition = oSheetMetalFeatures.FaceFeatures.CreateFaceFeatureDefinition(oProfile); // Create a face feature. oFaceFeature = oSheetMetalFeatures.FaceFeatures.Add(oFaceFeatureDefinition); }
public ObjectsEnumerator FindUsingVector(Point originPoint, UnitVector direction, SelectionFilterEnum[] objectTypes, bool useCylinder, Object proximityTolerance, bool visibleObjectsOnly, out Object locationPoints) { return InternalFindUsingVector( originPoint, direction, objectTypes, useCylinder, proximityTolerance, visibleObjectsOnly, out locationPoints); }
public ObjectsEnumerator FindUsingPoint(Point point, SelectionFilterEnum[] objectTypes, Object proximityTolerance, bool visibleObjectsOnly) { return InternalFindUsingPoint( point, objectTypes, proximityTolerance, visibleObjectsOnly); }
private ObjectsEnumerator InternalFindUsingVector(Point originPoint, UnitVector direction, SelectionFilterEnum[] objectTypes, bool useCylinder, Object proximityTolerance, bool visibleObjectsOnly, out Object locationPoints) { return ComponentDefinitionInstance.FindUsingVector( originPoint.ToPoint(), direction, objectTypes, useCylinder, proximityTolerance, visibleObjectsOnly, out locationPoints); }
private ObjectsEnumerator InternalFindUsingPoint(Point point, SelectionFilterEnum[] objectTypes, Object proximityTolerance, bool visibleObjectsOnly) { return ComponentDefinitionInstance.FindUsingPoint( point.ToPoint(), objectTypes, proximityTolerance, visibleObjectsOnly); }