public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); ArrayList ModelObjectArray = new ArrayList(); if (drawingHandler.GetActiveDrawing() != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); while (drawingObjectEnum.MoveNext()) { Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier)); } } else { ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); while (modelObjectEnum.MoveNext()) { Tekla.Structures.Model.ModelObject modelObject = (Tekla.Structures.Model.ModelObject)modelObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(modelObject.Identifier)); } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); akit.Callback("acmdCreateViewBySelectedObjectsExtrema", "", "main_frame"); akit.Callback("acmd_interrupt", "", "main_frame"); } catch { } }
private void GetInfoFromDrawing(DrawingObject pickedObject) { modelObjectTextBox.Clear(); if (pickedObject != null) { TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject; if (modelObjectInDrawing != null) { TSM.ModelObject modelObjectInModel = model.SelectModelObject(modelObjectInDrawing.ModelIdentifier); if (modelObjectInModel is TSM.Part) { Beam beam = modelObjectInModel as Beam; if (beam != null) { GetBeamInfo(beam); } PolyBeam polyBeam = modelObjectInModel as PolyBeam; if (polyBeam != null) { GetPolyBeamInfo(polyBeam); } ContourPlate contourPlate = modelObjectInModel as ContourPlate; if (contourPlate != null) { GetContourPlateInfo(contourPlate); } } } } }
public _Mark(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject DRpart, TSD.ViewBase view) { _mark = mark; _part = part; _DRpart = DRpart; _view = view; }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { Model model = new Model(); DrawingHandler drawingHandler = new DrawingHandler(); ArrayList ModelObjectArray = new ArrayList(); if (drawingHandler.GetActiveDrawing() != null) { DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetDrawingObjectSelector().GetSelected(); if (drawingObjectEnum.GetSize() > 0) { while (drawingObjectEnum.MoveNext()) { Tekla.Structures.Drawing.ModelObject dModelObject = (Tekla.Structures.Drawing.ModelObject)drawingObjectEnum.Current; ModelObjectArray.Add(model.SelectModelObject(dModelObject.ModelIdentifier)); } } Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector(); modelObjectSelector.Select(ModelObjectArray); } akit.Callback("acmdZoomToSelected", "", "main_frame"); } catch { } }
public override bool Run(List <InputDefinition> Input) { try { GetData(); ViewBase view = InputDefinitionFactory.GetView(Input[0]); ModelObject modelObject = (ModelObject)InputDefinitionFactory.GetDrawingObject(Input[0]); Model myModel = new Model(); Point partMiddleStart = null, partMiddleEnd = null, partCenterPoint = null; GetPartPoints(myModel, view, modelObject, out partMiddleStart, out partMiddleEnd, out partCenterPoint); Mark mark = new Mark(modelObject); mark.Attributes.Content.Clear(); mark.Attributes.Content.Add(new TextElement(Data.Text)); mark.Attributes.Content.Add(new UserDefinedElement("PROFILE")); mark.Placing = new AlongLinePlacing(partMiddleStart, partMiddleEnd); mark.InsertionPoint = partCenterPoint; mark.Insert(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(true); }
//This method gets the pciked object ID and selecs it in the model, showing //some of its information in the form private void GetInfoFromDrawing(DrawingObject pickedObject) { modelObjectTextBox.Clear(); if (pickedObject != null) { TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject; if (modelObjectInDrawing != null) { TSM.ModelObject modelObjectInModel = _model.SelectModelObject(modelObjectInDrawing.ModelIdentifier); if (modelObjectInModel is TSM.RebarGroup || modelObjectInModel is TSM.Reinforcement) { Reinforcement beam = modelObjectInModel as Reinforcement; if (beam != null) { double radius = double.Parse(beam.RadiusValues[0].ToString()); Solid sol = beam.GetSolid(); double maxX = sol.MaximumPoint.X; double maxY = sol.MaximumPoint.Y; double maxZ = sol.MaximumPoint.Z; double minX = sol.MinimumPoint.X; double minY = sol.MinimumPoint.Y; double minZ = sol.MinimumPoint.Z; // start vẽ polyline Polyline MyPolyline; PointList PolygonPoints = new PointList(); for (double i = maxY - radius; i <= maxY; i += 1) { PolygonPoints.Add(new g3d.Point(i, i)); } DrawingObjectEnumerator views = _drawingHandler.GetActiveDrawing().GetSheet().GetAllViews(); while (views.MoveNext()) { MyPolyline = new Polyline(views.Current as ViewBase, PolygonPoints); MyPolyline.Insert(); } GetBeamInfo(beam); //end vẽ đường thẳng } } } } }
/// <summary> /// 显示拾取对象的信息; /// </summary> /// <param name="pickedObject"></param> private void ShowDrawingObjectInfo(DrawingObject pickedObject, TSD.ViewBase viewBase) { if (null == pickedObject) { return; } if (pickedObject is TSD.ModelObject) { TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject; TSM.ModelObject modelObject = CDimTools.GetInstance().TransformDrawingToModel(modelObjectInDrawing); if (modelObject is TSM.Part) { TSM.Part partInModel = modelObject as TSM.Part; TSD.Part partInDrawing = modelObjectInDrawing as TSD.Part; CMrPart mrPart = new CMrPart(partInModel, partInDrawing); CDimTools.GetInstance().InitMrPart(partInModel, viewBase as TSD.View, mrPart); UpdateUIInfo(mrPart); } } }
public _Mark_BoltGroup(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject dr, TSD.ViewBase vv) : base(mark, part, dr, vv) { }
public _Mark_SingleRebar(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject dr, TSD.ViewBase vv) : base(mark, part, dr, vv) { }
public _Mark_PolyBeam(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject dr, TSD.ViewBase vv) : base(mark, part, dr, vv) { }
public _Mark_ContourPlate(TSD.Mark mark, TSM.ModelObject part, TSD.ModelObject dr, TSD.ViewBase vv) : base(mark, part, dr, vv) { }
private TSM.ModelObject GetModelObjectFromDrawingModelObject(TSM.Model myModel, ModelObject partOfMark) { TSM.ModelObject modelObject = myModel.SelectModelObject(partOfMark.ModelIdentifier); TSM.Part modelPart = (TSM.Part)modelObject; return(modelPart); }
private void GetPartPoints(TSM.Model myModel, ViewBase partView, ModelObject modelObject, out Point partMiddleStart, out Point partMiddleEnd, out Point partCenterPoint) { TSM.ModelObject modelPart = GetModelObjectFromDrawingModelObject(myModel, modelObject); GetModelObjectStartAndEndPoint(modelPart, (View)partView, out partMiddleStart, out partMiddleEnd); partCenterPoint = GetInsertionPoint(partMiddleStart, partMiddleEnd); }
/// <summary> /// 零件标记的构造函数; /// </summary> public CMrMark() { mModelObject = null; mInsertPoint = new Point(0, 0, 0); mTextPoint = new Point(0, 0, 0); }
internal static TSM.ModelObject GetModelObjectFromDrawingObject(TSD.ModelObject drawingObject) { TSM.ModelObject modelObject = (new TSM.Model()).SelectModelObject(drawingObject.ModelIdentifier); return(modelObject); }