// Operations void Mirror(SketchSegment axis) { Sketch sketch = (Sketch)Model.GetActiveSketch2(); for (int k = iSegments - 2; k >= 0; k--) { clear(); Segments[k].SelectByMark(true, 1); axis.SelectByMark(true, 2); Model.SketchMirror(); dynamic segments = sketch.GetSketchSegments(); for (int i = 0; i < segments.Length; i++) { bool OK = true; SketchSegment pretender = segments[i]; for (int j = 0; j < iSegments; j++) { if (pretender.GetName() == Segments[j].GetName()) { OK = false; break; } } if (OK) { Segments[iSegments++] = pretender; } } } }
public RelationVO(SketchRelation swSkRel, String sketchName, ModelDoc2 swModel) { int j; SketchPoint swSkPt = null; SketchSegment swSkSeg = null; typeName = Enum.GetName(typeof(swConstraintType_e), swSkRel.GetRelationType()); type = swSkRel.GetRelationType(); //Dimensions need to check if required DisplayDimension dispDim = (DisplayDimension)swSkRel.GetDisplayDimension(); if (dispDim != null) { dimensionValue = dispDim.GetDimension().GetSystemValue2(""); } int[] vEntTypeArr = (int[])swSkRel.GetEntitiesType(); object[] vEntArr = (object[])swSkRel.GetEntities(); object[] vDefEntArr = (object[])swSkRel.GetDefinitionEntities2(); if ((vDefEntArr == null)) { } if ((vEntTypeArr != null) & (vEntArr != null)) { if (vEntTypeArr.GetUpperBound(0) == vEntArr.GetUpperBound(0)) { j = 0; foreach (swSketchRelationEntityTypes_e vType in vEntTypeArr) { SketchRelationEntityVO entity = new SketchRelationEntityVO(); entity.typeName = "" + vType; entity.type = (int)vType; switch (vType) { case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Unknown: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_SubSketch: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Point: swSkPt = (SketchPoint)vEntArr[j]; entity.name = swSkPt.X + "," + swSkPt.Y + "," + swSkPt.Z; entity.sketchName = sketchName; entity.id = swModel.Extension.GetPersistReference3(swSkPt); // bRet = swSkPt.Select4(false, swSelData); break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Line: case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Arc: case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Ellipse: case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Parabola: case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Spline: swSkSeg = (SketchSegment)vEntArr[j]; Sketch sk = (Sketch)swSkSeg.GetSketch(); // sk. entity.id = swModel.Extension.GetPersistReference3(swSkSeg); entity.name = swSkSeg.GetName(); entity.sketchName = sketchName; break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Hatch: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Text: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Plane: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Cylinder: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Sphere: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Surface: break; case swSketchRelationEntityTypes_e.swSketchRelationEntityType_Dimension: break; default: break; } j = j + 1; entities.Add(entity); } } } }