private bool SwManipulatorHandler2_OnDoubleValueChanged(object pManipulator, int Id, ref double Value)
        {
            doneonce = doneonce + 1;
            Debug.Print("SwManipulatorHandler2_OnDoubleValueChanged");

            Debug.Print("  ID               = " + Id);

            Debug.Print("  Value            = " + Value);
            DragArrowManipulator swTmpManipulator = default(DragArrowManipulator);

            swTmpManipulator = (DragArrowManipulator)pManipulator;
            //Update origin
            MathPoint swMathPoint = default(MathPoint);

            swMathPoint = swTmpManipulator.Origin;
            double[] varMathPt = null;
            varMathPt             = (double[])swMathPoint.ArrayData;
            varMathPt[1]          = varMathPt[1] + lenFact / 1000;
            swMathPoint.ArrayData = varMathPt;
            if ((doneonce == 1))
            {
                swTmpManipulator.FixedLength = true;
            }
            swTmpManipulator.Origin = swMathPoint;

            swTmpManipulator.Update();
            return(true);
        }
Esempio n. 2
0
        public virtual bool OnDoubleValueChanged(object pManipulator, int handleIndex, ref double Value)
        {
            doneonce = doneonce + 1;

            DragArrowManipulator swTmpManipulator = default(DragArrowManipulator);

            swTmpManipulator = (DragArrowManipulator)pManipulator;
            //Update origin
            MathPoint swMathPoint = default(MathPoint);

            swMathPoint = swTmpManipulator.Origin;
            double[] varMathPt = null;
            varMathPt             = (double[])swMathPoint.ArrayData;
            varMathPt[1]          = varMathPt[1] + lenFact / 1000;
            swMathPoint.ArrayData = varMathPt;
            if ((doneonce == 1))
            {
                swTmpManipulator.FixedLength = true;
            }
            swTmpManipulator.Origin = swMathPoint;

            swTmpManipulator.Update();
            return(true);

            return(DoubelValueChanged?.Invoke(pManipulator as DragArrowManipulator, handleIndex.CastObj <swDragArrowManipulatorOptions_e>(), Value) == false ? false : true);
        }
Esempio n. 3
0
        /// <summary>
        /// 创建箭头
        /// </summary>
        /// <param name="swN"></param>
        /// <param name="swPickPt"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        private Manipulator CreateNewDrag(MathVector swN, MathPoint swPickPt, double length)
        {
            var           swModel      = (ModelDoc2)swApp.ActiveDoc;
            var           swModViewMgr = swModel.ModelViewManager;
            SwManHandler2 swDragHdlr   = new SwManHandler2();

            Manipulator swManip = swModViewMgr.CreateManipulator((int)swManipulatorType_e.swDragArrowManipulator, swDragHdlr);

            DragArrowManipulator swDrag = (DragArrowManipulator)swManip.GetSpecificManipulator();

            swDrag.AllowFlip             = false;
            swDrag.ShowRuler             = false;
            swDrag.ShowOppositeDirection = false;
            swDrag.Length    = length;
            swDrag.Direction = swN;
            //swDrag.LengthOppositeDirection = 0.01;

            swDrag.Origin = swPickPt;

            swManip.Show(swModel);

            swDrag.Update();

            return(swManip);
        }
Esempio n. 4
0
        public virtual void OnEndDrag(object pManipulator, int handleIndex)
        {
            DragArrowManipulator swTmpManipulator = default(DragArrowManipulator);

            swTmpManipulator             = (DragArrowManipulator)pManipulator;
            swTmpManipulator.FixedLength = false;
            doneonce = doneonce + 1;

            EndDrag?.Invoke(pManipulator as DragArrowManipulator, handleIndex.CastObj <swDragArrowManipulatorOptions_e>());
        }
        private void SwManipulatorHandler2_OnEndDrag(object pManipulator, int handleIndex)
        {
            DragArrowManipulator swTmpManipulator = default(DragArrowManipulator);

            swTmpManipulator             = (DragArrowManipulator)pManipulator;
            swTmpManipulator.FixedLength = false;
            doneonce = doneonce + 1;
            Debug.Print("SwManipulatorHandler2_OnEndDrag");

            Debug.Print("  HandleIndex      = " + handleIndex);

            if ((handleIndex == (int)swDragArrowManipulatorOptions_e.swDragArrowManipulatorDirection2))
            {
                Debug.Print(" Direction1");
            }
            else
            {
                Debug.Print(" Direction2");
            }
        }
Esempio n. 6
0
 /// <summary>
 /// short helper function to set some visual properties of the DragArrowManipulator
 /// called in DrawJointPreview
 /// </summary>
 /// <param name="arrow"></param>
 private void setArrowLooks(DragArrowManipulator arrow)
 {
     arrow.ShowRuler = false;
     arrow.FixedLength = true;
     arrow.ShowOppositeDirection = false;
     arrow.AllowFlip = false;
     arrow.Length = .025;
 }
Esempio n. 7
0
 /// <summary>
 /// Sets an arrow to the give locations
 /// </summary>
 /// <param name="point">Origin point of the arrow</param>
 /// <param name="vector">Direction Vector of the arrow</param>
 /// <param name="length">length of the arrow</param>
 /// <param name="arrow">The arrow to be edited</param>
 protected void SetArrowAtLoc(MathPoint point, MathVector vector, double length, DragArrowManipulator arrow)
 {
     arrow.ShowRuler = false;
     arrow.FixedLength = true;
     arrow.ShowOppositeDirection = false;
     arrow.AllowFlip = false;
     arrow.Length = length;
     arrow.Direction = vector;
     arrow.Origin = point;
 }
Esempio n. 8
0
 /// <summary>
 /// Sets an arrow to the give locations
 /// </summary>
 /// <param name="point">Origin point of the arrow</param>
 /// <param name="vector">Direction Vector of the arrow</param>
 /// <param name="length">length of the arrow</param>
 /// <param name="arrow">The arrow to be edited</param>
 protected void SetArrowAtLoc(double[] point, double[] vector, double length, DragArrowManipulator arrow)
 {
     MathPoint mPoint = mathUtil.CreatePoint(point);
     MathVector mVector = mathUtil.CreateVector(vector);
     SetArrowAtLoc(mPoint, mVector, length, arrow);
 }