public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model model = new Model();
                TransformationPlane transformationplane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

                if (modelObjectEnum.GetSize() == 1)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                        {
                            Tekla.Structures.Model.Part part = modelObjectEnum.Current as Tekla.Structures.Model.Part;
                            double level = 0; part.GetReportProperty("TOP_LEVEL_UNFORMATTED", ref level);
                            akit.CommandStart("ail_create_basic_view", "", "main_frame");
                            akit.ValueChange("Modelling create view", "v1_coordinate", level.ToString("F02"));
                            akit.PushButton("v1_create", "Modelling create view");
                        }
                    }
                }

                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationplane);
            }
            catch { }
        }
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model model = new Model();
            //Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            DrawingHandler          dh  = new DrawingHandler();
            DrawingObjectEnumerator doe = dh.GetDrawingObjectSelector().GetSelected();

            while (doe.MoveNext())
            {
                string CONN_CODE_END1 = "", CONN_CODE_END2 = "";
                if (doe.Current is Tekla.Structures.Drawing.Part)
                {
                    Tekla.Structures.Drawing.Part dPart = (Tekla.Structures.Drawing.Part)doe.Current;
                    Tekla.Structures.Model.Part   mPart = (Tekla.Structures.Model.Part)model.SelectModelObject((Identifier)dPart.ModelIdentifier);
                    if (mPart is Beam)
                    {
                        Beam     beam = (Beam)mPart;
                        ViewBase view = dPart.GetView();
                        mPart.GetUserProperty("CONN_CODE_END1", ref CONN_CODE_END1);
                        mPart.GetUserProperty("CONN_CODE_END2", ref CONN_CODE_END2);

                        if (CONN_CODE_END1 != "")
                        {
                            Tekla.Structures.Drawing.Text text = new Tekla.Structures.Drawing.Text(view, beam.StartPoint + new Point(200, 200), CONN_CODE_END1, new LeaderLinePlacing(beam.StartPoint));
                            text.Insert();
                        }
                        if (CONN_CODE_END2 != "")
                        {
                            Tekla.Structures.Drawing.Text text = new Tekla.Structures.Drawing.Text(view, beam.EndPoint + new Point(200, 200), CONN_CODE_END2, new LeaderLinePlacing(beam.EndPoint));
                            text.Insert();
                        }
                    }
                }
            }
        }
        public static void main(List <string> ignoreClasses, Tekla.Technology.Akit.IScript akit)
        {
            int wrongPartsCount = 0;

            TSM.ModelObjectEnumerator selectedObjects   = getSelectedObjects();
            List <TSM.Assembly>       selectedAssemblys = getSelectedAssemblys(selectedObjects);

            foreach (TSM.Assembly currentAssembly in selectedAssemblys)
            {
                ArrayList wrongParts = findWrongParts(ignoreClasses, currentAssembly);

                if (wrongParts.Count > 0)
                {
                    changePartToSubAssembly(currentAssembly, wrongParts, akit);

                    TSM.Part mainpart = currentAssembly.GetMainPart() as TSM.Part;
                    if (currentAssembly.Name == mainpart.Name)
                    {
                        removeAssemblyPropertys(currentAssembly, akit);
                    }
                }

                wrongPartsCount += wrongParts.Count;
            }

            MessageBox.Show("Kontrollitud " + selectedAssemblys.Count.ToString() + " assembly." + Environment.NewLine +
                            "Tõstetub ümber " + wrongPartsCount.ToString() + " vigast elementi.");
        }
Ejemplo n.º 4
0
        private static void swapOffsetPlanes(TSM.Part part)
        {
            if (part is TSM.ContourPlate)
            {
                if (part.Position.Depth == TSM.Position.DepthEnum.BEHIND)
                {
                    part.Position.Depth = TSM.Position.DepthEnum.FRONT;
                }
                else if (part.Position.Depth == TSM.Position.DepthEnum.FRONT)
                {
                    part.Position.Depth = TSM.Position.DepthEnum.BEHIND;
                }
            }
            else
            {
                if (part.Position.Plane == TSM.Position.PlaneEnum.RIGHT)
                {
                    part.Position.Plane = TSM.Position.PlaneEnum.LEFT;
                }
                else if (part.Position.Plane == TSM.Position.PlaneEnum.LEFT)
                {
                    part.Position.Plane = TSM.Position.PlaneEnum.RIGHT;
                }
                if (part.Position.Plane == TSM.Position.PlaneEnum.MIDDLE)
                {
                    part.Position.PlaneOffset = -part.Position.PlaneOffset;
                }

                if (part.Position.RotationOffset != 0)
                {
                    part.Position.RotationOffset = -part.Position.RotationOffset;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 框架结构的一键标注;
        /// </summary>
        /// <param name="nType"></param>
        public void DrawDrawingOneKey(string strDimType)
        {
            DrawingHandler drawingHandler = new DrawingHandler();
            Drawing        drawing        = drawingHandler.GetActiveDrawing();

            if (null == drawing)
            {
                return;
            }
            AssemblyDrawing assemblyDrawing = drawing as AssemblyDrawing;

            if (assemblyDrawing == null)
            {
                return;
            }
//             try
//             {
            Assembly assembly = new Assembly
            {
                Identifier = assemblyDrawing.AssemblyIdentifier
            };

            assembly.Select();
            Identifier identifier = assembly.GetMainPart().Identifier;

            TSM.Part modelObject = mModel.SelectModelObject(identifier) as TSM.Part;

            //1.首先创建自动剖面;
            if (CCommonPara.mAutoSectionType == MrAutoSectionType.MrOneKeyDim || CCommonPara.mAutoSectionType == MrAutoSectionType.MrTwoTypeDim)
            {
                CreateAutoSection(strDimType, modelObject, assemblyDrawing);
            }

            //2.对图纸进行标注;
            DrawingObjectEnumerator allViews = assemblyDrawing.GetSheet().GetAllViews();

            while (allViews.MoveNext())
            {
                if (allViews.Current != null)
                {
                    TSD.View view = allViews.Current as TSD.View;

                    if (view != null)
                    {
                        DrawDrawingByView(view, modelObject, strDimType);
                    }
                }
            }
            assemblyDrawing.IsFrozen = true;
            assemblyDrawing.PlaceViews();
            assemblyDrawing.Modify();
//             }
//             catch (System.Exception ex)
//             {
//                 string strName = assemblyDrawing.Name;
//                 MessageBox.Show("图纸" + strName + "标注失败,请确认模型或图纸内是否有问题。异常信息:" + ex.Message);
//             }

            MessageBox.Show("扬州Tekla培训石头哥提示您标注结束,感谢您对智能标注系统的支持。");
        }
Ejemplo n.º 6
0
        private static void swapTopInForm(TSM.Part part)
        {
            int topInForm = 6;

            part.GetUserProperty("FixedMainView", ref topInForm);

            if (topInForm == (int)TopInFormEnum.FRONT)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.BACK);
            }
            else if (topInForm == (int)TopInFormEnum.BACK)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.FRONT);
            }
            else if (topInForm == (int)TopInFormEnum.START)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.END);
            }
            else if (topInForm == (int)TopInFormEnum.END)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.START);
            }
            else if (topInForm == (int)TopInFormEnum.TOP)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.BOTTOM);
            }
            else if (topInForm == (int)TopInFormEnum.BOTTOM)
            {
                part.SetUserProperty("FixedMainView", (int)TopInFormEnum.TOP);
            }
        }
Ejemplo n.º 7
0
        public TsPart(TSD.Part drawingPart)
        {
            _drawingPart = drawingPart;
            TSM.Part modelPart =
                Extensions.GetModelObjectFromDrawingObject(_drawingPart) as TSM.Part;

            modelPart.GetReportProperty("WIDTH", ref width);
            modelPart.GetReportProperty("HEIGHT", ref height);
            modelPart.GetReportProperty("LENGTH", ref length);

            var   partCLPoints = modelPart.GetCenterLine(false);
            Point partStartP   = partCLPoints[0] as Point;
            Point partEndP;

            if (!(modelPart is TSM.ContourPlate))
            {
                partEndP = partCLPoints[partCLPoints.Count - 1] as Point;
            }
            else
            {
                partEndP = partCLPoints[partCLPoints.Count - 2] as Point;
            }
            partStart = new double[3] {
                partStartP.X, partStartP.Y, partStartP.Z
            };
            partEnd = new double[3] {
                partEndP.X, partEndP.Y, partEndP.Z
            };

            partCS = modelPart.GetCoordinateSystem();
            origin =
                new Point((partEnd[0] + partStart[0]) / 2,
                          (partEnd[1] + partStart[1]) / 2,
                          (partEnd[2] + partStart[2]) / 2);
        }
Ejemplo n.º 8
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model model = new Model();
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                if (modelObjectEnum.GetSize() > 0)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                        {
                            Tekla.Structures.Model.Part part = (Tekla.Structures.Model.Part)modelObjectEnum.Current;
                            string USER_FIELD_3 = "", USER_FIELD_4 = "", PRELIM_MARK = "";
                            part.GetUserProperty("USER_FIELD_3", ref USER_FIELD_3);
                            part.GetUserProperty("USER_FIELD_4", ref USER_FIELD_4);
                            part.GetUserProperty("PRELIM_MARK", ref PRELIM_MARK);

                            USER_FIELD_4 = USER_FIELD_4.Replace("(?)", "");

                            if (USER_FIELD_3 == "Z")
                            {
                                part.SetUserProperty("USER_FIELD_2", PRELIM_MARK);
                                part.SetUserProperty("PRELIM_MARK", USER_FIELD_3 + USER_FIELD_4);
                                part.Modify();
                            }
                        }
                    }
                    model.CommitChanges();
                    MessageBox.Show("Process Complete");
                }
            }
            catch { }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// HeghlightElements(List<Elm>elements, color) - change color of elements in list 
        /// </summary>
        /// <param name="elements"></param>
        /// <param name="color"></param>
        public void HighlightElements(Dictionary<string, Elm> els, int color = 1)
        {
            Log.set("TS_OpenAPI.HighLightElements");
            TSM.ModelObjectSelector selector = model.GetModelObjectSelector();
            System.Type[] Types = new System.Type[1];
            Types.SetValue(typeof(Part), 0);

            TSM.ModelObjectEnumerator objectList = selector.GetAllObjectsWithType(Types);
            int totalCnt = objectList.GetSize();

            var colorObjects = new List<ModelObject>();

            while (objectList.MoveNext())
            {
                TSM.Part myPart = objectList.Current as TSM.Part;
                if (myPart != null)
                {
                    string guid = string.Empty;
                    myPart.GetReportProperty("GUID", ref guid);
                    if (els.ContainsKey(guid)) colorObjects.Add(myPart);
                }
            }
            var _color = new Color(0.0, 0.0, 1.0);
            ModelObjectVisualization.SetTransparencyForAll(TemporaryTransparency.SEMITRANSPARENT);
            ModelObjectVisualization.SetTemporaryState(colorObjects, _color);
            log.Info("\tTotal elements without price = " + colorObjects.Count);
            Log.exit();
        }
Ejemplo n.º 10
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            try
            {
                Model model = new Model();
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                if (modelObjectEnum.GetSize() > 0)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                        {
                            Tekla.Structures.Model.Part part = (Tekla.Structures.Model.Part)modelObjectEnum.Current;
                            string    mark                = "";
                            Hashtable strProps            = new Hashtable();
                            ArrayList PartStrRepPropNames = new ArrayList();
                            PartStrRepPropNames.Add("ASSEMBLY_POS");
                            part.GetStringReportProperties(PartStrRepPropNames, ref strProps);
                            if ((mark = (string)strProps["ASSEMBLY_POS"]) == null)
                            {
                                mark = "";
                            }

                            mark = mark.Replace("(?)", "");

                            part.SetUserProperty("USER_FIELD_4", mark);
                            part.Modify();
                        }
                    }
                    model.CommitChanges();
                    MessageBox.Show("Process Complete");
                }
            }
            catch { }
        }
Ejemplo n.º 11
0
        private TSG.OBB CreateOrientedBoundingBox(TSM.Part part)
        {
            TSG.OBB obb = null;

            if (part != null)
            {
                WorkPlaneHandler    workPlaneHandler            = model.GetWorkPlaneHandler();
                TransformationPlane originalTransformationPlane = workPlaneHandler.GetCurrentTransformationPlane();

                Solid     solid = part.GetSolid();
                TSG.Point minPointInCurrentPlane = solid.MinimumPoint;
                TSG.Point maxPointInCurrentPlane = solid.MaximumPoint;

                TSG.Point centerPoint = CalculateCenterPoint(minPointInCurrentPlane, maxPointInCurrentPlane);

                TSG.CoordinateSystem coordSys = part.GetCoordinateSystem();
                TransformationPlane  localTransformationPlane = new TransformationPlane(coordSys);
                workPlaneHandler.SetCurrentTransformationPlane(localTransformationPlane);

                solid = part.GetSolid();
                TSG.Point minPoint = solid.MinimumPoint;
                TSG.Point maxPoint = solid.MaximumPoint;
                double    extent0  = (maxPoint.X - minPoint.X) / 2;
                double    extent1  = (maxPoint.Y - minPoint.Y) / 2;
                double    extent2  = (maxPoint.Z - minPoint.Z) / 2;

                workPlaneHandler.SetCurrentTransformationPlane(originalTransformationPlane);

                obb = new TSG.OBB(centerPoint, coordSys.AxisX, coordSys.AxisY,
                                  coordSys.AxisX.Cross(coordSys.AxisY), extent0, extent1, extent2);
            }
            return(obb);
        }
Ejemplo n.º 12
0
        public _Assembly(TSM.Assembly assembly)
        {
            _assembly = assembly;
            _objClass = (assembly.GetMainPart() as TSM.Part).Class;

            TSM.Part mainPart = assembly.GetMainPart() as TSM.Part;
            _topInFrom = getTopInForm(mainPart);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 初始化;
        /// </summary>
        protected void Init()
        {
            if (mViewBase == null)
            {
                return;
            }
            CDimTools dimTools = CDimTools.GetInstance();

            //初始化视图包围盒;
            dimTools.InitViewBox();

            //获取所有螺钉的数据字典;
            Dictionary <Identifier, TSD.Bolt> dicIdentifierBolt = dimTools.GetAllBoltInDrawing(mViewBase);

            //获取所有Drawing视图中的Part;
            List <TSD.Part> partList = dimTools.GetAllPartInDrawing(mViewBase);

            foreach (TSD.Part partInDrawing in partList)
            {
                //1.获取部件的信息;
                TSM.ModelObject modelObjectInModel = dimTools.TransformDrawingToModel(partInDrawing);
                TSM.Part        partInModel        = modelObjectInModel as TSM.Part;
                CMrPart         mrPart             = null;

                if (CMrMainBeam.GetInstance().mPartInModel.Identifier.GUID == partInModel.Identifier.GUID)
                {
                    mrPart    = CMrMainBeam.GetInstance();
                    mMainBeam = CMrMainBeam.GetInstance();
                    mMainBeam.mPartInDrawing = partInDrawing;
                }
                else
                {
                    mrPart = new CMrPart(partInModel, partInDrawing);
                }

                dimTools.InitMrPart(modelObjectInModel, mViewBase, mrPart);
                AppendMrPart(mrPart);
                InitMrPart(mrPart);

                mrPart.GetBeamTopViewInfo().InitMrPartTopViewInfo();

                //2.获取部件中的所有螺钉组;
                List <BoltArray> boltArrayList = dimTools.GetAllBoltArray(partInModel);

                foreach (BoltArray boltArray in boltArrayList)
                {
                    TSD.Bolt boltInDrawing = dicIdentifierBolt[boltArray.Identifier];

                    CMrBoltArray mrBoltArray = new CMrBoltArray(boltArray, boltInDrawing);
                    dimTools.InitMrBoltArray(boltArray, mViewBase, mrBoltArray);
                    InitMrBoltArray(mrBoltArray);
                    mrPart.AppendMrBoltArray(mrBoltArray);
                }
                dimTools.UpdateViewBox(mrPart);
            }
            CMrMarkManager.GetInstance().Clear();
        }
Ejemplo n.º 14
0
        internal static string GetPartProfileType(TSD.Part drawingPart)
        {
            TSM.Part modelPart = SelectModelObject(drawingPart.ModelIdentifier.ID)
                                 as TSM.Part;
            string profileType = String.Empty;

            modelPart.GetReportProperty("PROFILE_TYPE", ref profileType);
            return(profileType);
        }
Ejemplo n.º 15
0
        private TopInFormEnum getTopInForm(TSM.Part part)
        {
            int topInForm = 6;

            part.GetUserProperty("FixedMainView", ref topInForm);
            TopInFormEnum value = (TopInFormEnum)topInForm;

            return(value);
        }
        private string getObjectName(CastUnitDrawing currentDrawing)
        {
            var currentModelObject = _myModel.SelectModelObject(currentDrawing.CastUnitIdentifier);

            TSM.Assembly currentAssembly = currentModelObject as TSM.Assembly;
            TSM.Part     currentMainPart = currentAssembly.GetMainPart() as TSM.Part;

            return(currentMainPart.Name);
        }
Ejemplo n.º 17
0
        public static double GetPartWidth(TSM.Part part)
        {
            double columnWidth = 0.0;

            if (!part.GetReportProperty("PROFILE.WIDTH", ref columnWidth))
            {
                part.GetReportProperty("WIDTH", ref columnWidth);
            }
            return(columnWidth);
        }
Ejemplo n.º 18
0
        public static double GetPartHeight(TSM.Part part)
        {
            double columnHeight = 0.0;
            string profile      = string.Empty;

            part.GetReportProperty("PROFILE", ref profile);
            string[] split = profile.Split('X');
            columnHeight = double.Parse(split[1]);

            return(columnHeight);
        }
Ejemplo n.º 19
0
        static private void changeCut(TSM.BooleanPart currentBoolean)
        {
            TSM.Part cutPart = currentBoolean.OperativePart as TSM.Part;
            double   minCutZ = findMinimum(cutPart);

            TSM.Part realPart = currentBoolean.Father as TSM.Part;
            double   minPartZ = findMinimum(realPart);

            double delta = minPartZ - minCutZ;

            setCutPoints(cutPart, delta);
        }
Ejemplo n.º 20
0
 /// <summary>
 /// 自动创建门式框架结构的剖面;
 /// </summary>
 /// <param name="strType"></param>
 private void CreateAutoSectionDoor(string strType, TSM.Part mainPart, AssemblyDrawing assemblyDrawing)
 {
     if (strType.Equals("梁标注"))
     {
         CBeamAutoSectionDoor beamAutoSection = new CBeamAutoSectionDoor(mainPart, assemblyDrawing);
         beamAutoSection.CreateSection();
     }
     else if (strType.Equals("柱标注"))
     {
         CCylinderAutoSectionDoor cylinderAutoSection = new CCylinderAutoSectionDoor(mainPart, assemblyDrawing);
         cylinderAutoSection.CreateSection();
     }
 }
Ejemplo n.º 21
0
        public static bool checkPart(List <string> properties, TSM.Part part, TSD.Drawing drawing)
        {
            foreach (string prop in properties)
            {
                bool result = checkProperty(prop, part, drawing);
                if (result == false)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 22
0
        public static List <TSM.Reinforcement> getReinforcements(TSM.Part part)
        {
            List <TSM.Reinforcement> reinf = new List <TSM.Reinforcement>();

            TSM.ModelObjectEnumerator reinforcementEnum = part.GetReinforcements();

            while (reinforcementEnum.MoveNext())
            {
                reinf.Add(reinforcementEnum.Current as TSM.Reinforcement);
            }

            return(reinf);
        }
        /// <summary>
        /// Calculate polygon for rebar group by solid of InputObject.
        /// Object's Axis Aligned Bounding Box (AABB) is used for calculation.
        /// </summary>
        /// <param name="InputObject"></param>
        /// <returns></returns>
        private Polygon GetPolygonBySolidsAABB(Tekla.Structures.Model.Part InputObject)
        {
            Polygon Result = new Polygon();

            Solid BeamSolid = InputObject.GetSolid();

            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MaximumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MinimumPoint.X, BeamSolid.MaximumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MinimumPoint.X, BeamSolid.MinimumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MinimumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MaximumPoint.Y, 0));

            return(Result);
        }
Ejemplo n.º 24
0
        public static void main(TSM.Part part)
        {
            List <TSM.Reinforcement> oldReinf = TeklaHandler.getReinforcements(part);

            swapHandlesChooser(part);
            swapEndForces(part);
            swapOffsetPlanes(part);
            swapTopInForm(part);
            part.Modify();

            List <TSM.Reinforcement> newReinf = TeklaHandler.getReinforcements(part);

            restoreReinforcement(oldReinf, newReinf);
        }
Ejemplo n.º 25
0
        private void GetIdNumbers_Click(object sender, EventArgs e)
        {
            Model model = new Model();

            Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            Drawing drawing = drawingHandler.GetActiveDrawing();
            DrawingObjectEnumerator drawingObjectEnumerator = drawingHandler.GetDrawingObjectSelector().GetSelected();
            ArrayList SelectedObjectArray = new ArrayList();
            ArrayList MarkArray           = new ArrayList();

            while (drawingObjectEnumerator.MoveNext())
            {
                if (drawingObjectEnumerator.Current is Tekla.Structures.Drawing.Part)
                {
                    Tekla.Structures.Drawing.Part part = drawingObjectEnumerator.Current as Tekla.Structures.Drawing.Part;
                    SelectedObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID)));
                    DrawingObjectArray.Add(part);
                }
                if (drawingObjectEnumerator.Current is Tekla.Structures.Drawing.Bolt)
                {
                    Tekla.Structures.Drawing.Bolt bolt = drawingObjectEnumerator.Current as Tekla.Structures.Drawing.Bolt;
                    SelectedObjectArray.Add(model.SelectModelObject(new Identifier(bolt.ModelIdentifier.ID)));
                    DrawingObjectArray.Add(bolt);
                }
            }
            modelObjectSelector.Select(SelectedObjectArray);
            Tekla.Structures.Model.ModelObjectEnumerator modelObjectEnumerator = model.GetModelObjectSelector().GetSelectedObjects();
            while (modelObjectEnumerator.MoveNext())
            {
                if (modelObjectEnumerator.Current is Tekla.Structures.Model.Part)
                {
                    Tekla.Structures.Model.Part modelPart = modelObjectEnumerator.Current as Tekla.Structures.Model.Part;
                    MarkArray.Add(modelPart.Identifier.ID.ToString());
                }
                if (modelObjectEnumerator.Current is Tekla.Structures.Model.BoltGroup)
                {
                    Tekla.Structures.Model.BoltGroup modelBolt = modelObjectEnumerator.Current as Tekla.Structures.Model.BoltGroup;
                    MarkArray.Add(modelBolt.Identifier.ID.ToString());
                }
            }
            MarkArray.Sort();
            string MarkList = "";

            foreach (string strMark in MarkArray)
            {
                MarkList = strMark + " " + MarkList;
            }
            Clipboard.SetDataObject(MarkList); richTextBox1.Text = MarkList;
            drawingHandler.GetDrawingObjectSelector().SelectObjects(DrawingObjectArray, false);
        }
Ejemplo n.º 26
0
        private void GetMarks(string MarkType)
        {
            Model model = new Model();

            Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            Drawing drawing = drawingHandler.GetActiveDrawing();
            DrawingObjectEnumerator drawingObjectEnumerator = drawingHandler.GetDrawingObjectSelector().GetSelected();
            ArrayList SelectedObjectArray = new ArrayList();
            ArrayList MarkArray           = new ArrayList();

            while (drawingObjectEnumerator.MoveNext())
            {
                if (drawingObjectEnumerator.Current is Tekla.Structures.Drawing.Part)
                {
                    Tekla.Structures.Drawing.Part part = drawingObjectEnumerator.Current as Tekla.Structures.Drawing.Part;
                    SelectedObjectArray.Add(model.SelectModelObject(new Identifier(part.ModelIdentifier.ID)));
                    DrawingObjectArray.Add(part);
                }
            }
            modelObjectSelector.Select(SelectedObjectArray);
            Tekla.Structures.Model.ModelObjectEnumerator modelObjectEnumerator = model.GetModelObjectSelector().GetSelectedObjects();
            while (modelObjectEnumerator.MoveNext())
            {
                if (modelObjectEnumerator.Current is Tekla.Structures.Model.Part)
                {
                    Tekla.Structures.Model.Part modelPart = modelObjectEnumerator.Current as Tekla.Structures.Model.Part;
                    string mark = "";
                    try
                    {
                        modelPart.GetReportProperty(MarkType, ref mark);
                        if (!MarkArray.Contains(mark))
                        {
                            MarkArray.Add(mark);
                        }
                    }
                    catch { }
                }
            }
            MarkArray.Sort();
            string MarkList = "";

            foreach (string strMark in MarkArray)
            {
                MarkList = strMark + " " + MarkList;
            }
            Clipboard.SetDataObject(MarkList); richTextBox1.Text = MarkList;
            drawingHandler.GetDrawingObjectSelector().SelectObjects(DrawingObjectArray, false);
        }
Ejemplo n.º 27
0
        public static bool main(TSD.Drawing drawing)
        {
            bool drawingStatus = true;

            TSM.Model _myModel = new TSM.Model();

            if (drawing is TSD.GADrawing)
            {
                drawingStatus = checkDrawing(UserSettings_UDA._GA_drawingProperties, drawing as TSD.GADrawing);
            }
            else if (drawing is TSD.CastUnitDrawing)
            {
                TSD.CastUnitDrawing cu = drawing as TSD.CastUnitDrawing;
                TSM.Assembly        currentAssembly = _myModel.SelectModelObject(cu.CastUnitIdentifier) as TSM.Assembly;
                TSM.Part            currentMainPart = currentAssembly.GetMainPart() as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._CU_drawingProperties, cu);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._CU_partProperties, currentMainPart, cu);
                }
            }
            else if (drawing is TSD.AssemblyDrawing)
            {
                TSD.AssemblyDrawing asd             = drawing as TSD.AssemblyDrawing;
                TSM.Assembly        currentAssembly = _myModel.SelectModelObject(asd.AssemblyIdentifier) as TSM.Assembly;
                TSM.Part            currentMainPart = currentAssembly.GetMainPart() as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._A_drawingProperties, asd);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._A_partProperties, currentMainPart, asd);
                }
            }
            else if (drawing is TSD.SinglePartDrawing)
            {
                TSD.SinglePartDrawing sp = drawing as TSD.SinglePartDrawing;
                TSM.Part currentPart     = _myModel.SelectModelObject(sp.PartIdentifier) as TSM.Part;

                drawingStatus = checkDrawing(UserSettings_UDA._SP_drawingProperties, sp);
                if (drawingStatus)
                {
                    drawingStatus = checkPart(UserSettings_UDA._SP_partProperties, currentPart, sp);
                }
            }

            return(drawingStatus);
        }
Ejemplo n.º 28
0
        public static void main(List <_Assembly> wrongAssemblys)
        {
            foreach (_Assembly currentAssembly in wrongAssemblys)
            {
                ArrayList parts = new ArrayList();
                parts = currentAssembly._assembly.GetSecondaries();
                TSM.Part mainPart = currentAssembly._assembly.GetMainPart() as TSM.Part;
                parts.Add(mainPart);

                foreach (TSM.Part currentPart in parts)
                {
                    SwapHandler.main(currentPart);
                }
            }

            new TSM.Model().CommitChanges();
        }
Ejemplo n.º 29
0
        public static double GetGirderHeight(TSM.Part girder)
        {
            double girderHeight = 0;

            if (girder is TSM.Beam)
            {
                girderHeight = GetPartHeight(girder);
            }
            else if (girder is TSM.ContourPlate)
            {
                string profile = string.Empty;
                girder.GetReportProperty("PROFILE", ref profile);
                string[] split = profile.Split('X');
                girderHeight = double.Parse(split[1]);
            }
            return(girderHeight);
        }
Ejemplo n.º 30
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            Model             model          = new Model();
            DrawingHandler    drawingHandler = new DrawingHandler();
            DrawingEnumerator drawingEnum    = drawingHandler.GetDrawingSelector().GetSelected();

            if (drawingHandler.GetActiveDrawing() == null)
            {
                while (drawingEnum.MoveNext())
                {
                    if (drawingEnum.Current is AssemblyDrawing)
                    {
                        AssemblyDrawing assemblyDrawing = drawingEnum.Current as AssemblyDrawing;
                        drawingHandler.SetActiveDrawing(assemblyDrawing, false);
                        DrawingObjectEnumerator drawingObjectEnum = drawingHandler.GetActiveDrawing().GetSheet().GetAllObjects();
                        while (drawingObjectEnum.MoveNext())
                        {
                            if (drawingObjectEnum.Current is Tekla.Structures.Drawing.Part)
                            {
                                Tekla.Structures.Drawing.Part part = drawingObjectEnum.Current as Tekla.Structures.Drawing.Part;
                                ArrayList array = new ArrayList();
                                array.Add(model.SelectModelObject(new Tekla.Structures.Identifier(part.ModelIdentifier.ID)));
                                Tekla.Structures.Model.UI.ModelObjectSelector modelObjectSelector = new Tekla.Structures.Model.UI.ModelObjectSelector();
                                modelObjectSelector.Select(array);
                                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();
                                while (modelObjectEnum.MoveNext())
                                {
                                    if (modelObjectEnum.Current is Tekla.Structures.Model.Part)
                                    {
                                        Tekla.Structures.Model.Part     mpart    = modelObjectEnum.Current as Tekla.Structures.Model.Part;
                                        Tekla.Structures.Model.Assembly assembly = mpart.GetAssembly();
                                        Tekla.Structures.Model.Part     mainPart = (Tekla.Structures.Model.Part)assembly.GetMainPart();
                                        assemblyDrawing.Name = mainPart.Name;
                                        assemblyDrawing.Modify();
                                        assemblyDrawing.CommitChanges();
                                    }
                                }
                                modelObjectSelector.Select(new ArrayList());
                            }
                        }
                        drawingHandler.CloseActiveDrawing();
                    }
                }
            }
        }