Example #1
0
        private TSDrg.StraightDimensionSet CreateNewDim(TSDrg.View view, TSDrg.PointList pointList)
        {
            TSG.Vector upDirection;

            if (checkBox1.Checked)
            {
                upDirection = new TSG.Vector(1, 0, 0);
            }
            else if (checkBox2.Checked)
            {
                upDirection = new TSG.Vector(0, 1, 0);
            }
            else
            {
                lbl_status.Text = "Please select dimension orientation";
                upDirection     = new TSG.Vector(1, 0, 0);
            }

            double height = 0.0;

            TSDrg.StraightDimensionSet.StraightDimensionSetAttributes attr = new TSDrg.StraightDimensionSet.StraightDimensionSetAttributes();

            TSDrg.StraightDimensionSetHandler myDimSetHandler = new TSDrg.StraightDimensionSetHandler();
            TSDrg.StraightDimensionSet        newDim          = myDimSetHandler.CreateDimensionSet(view, pointList, upDirection, height, attr);
            return(newDim);
        }
        private static void createDimentionLineSets(List <_StraightDimentionSet> input, List <_StraightDimentionSet> output, TSD.ViewBase outputView)
        {
            foreach (_StraightDimentionSet inputDimSet in input)
            {
                TSD.PointList outputPoints = new TSD.PointList();
                foreach (T3D.Point ip in inputDimSet._points)
                {
                    T3D.Point op = __GeometryOperations.applyGlobalOffset(ip);
                    outputPoints.Add(op);
                }

                bool found = false;
                _StraightDimentionSet outputDimSetCopy = null;

                foreach (_StraightDimentionSet outputDimSet in output)
                {
                    if (inputDimSet._points.Count == outputDimSet._points.Count)
                    {
                        if (outputDimSet._points.Count != 0)
                        {
                            bool local = true;
                            for (int i = 0; i < outputDimSet._points.Count; i++)
                            {
                                bool same = __GeometryOperations.compare2PointsNullTolerance(outputPoints[i], outputDimSet._points[i]);

                                if (same == false)
                                {
                                    local = false;
                                    break;
                                }
                            }

                            if (local == true)
                            {
                                if (outputDimSet._first.UpDirection == inputDimSet._first.UpDirection)
                                {
                                    found            = true;
                                    outputDimSetCopy = outputDimSet;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (found == false)
                {
                    TSD.StraightDimensionSetHandler sds          = new TSD.StraightDimensionSetHandler();
                    TSD.StraightDimensionSet        outputDimSet = sds.CreateDimensionSet(outputView, outputPoints, inputDimSet._first.UpDirection, inputDimSet._set.Distance, inputDimSet._set.Attributes);
                    outputDimSet.Distance = inputDimSet._set.Distance;
                    outputDimSet.Modify();
                }
                else
                {
                    if (outputDimSetCopy != null)
                    {
                        outputDimSetCopy._set.Distance = inputDimSet._set.Distance;
                        outputDimSetCopy._set.Modify();
                    }
                }
            }
        }