NXOPEN/UG二次开发C#---创建点沿着曲线移动一定距离



        /// 
        /// 创建点沿着曲线移动一定距离
        /// 
        /// 
        /// 
        /// 
        /// 
        public static TaggedObject CreatePointAloneLine(TaggedObject line, TaggedObject point, double value)
        {
            Session theSession = Session.GetSession();
            Part workPart = theSession.Parts.Work;
            //创建点的参数
            Expression expression = workPart.Expressions.CreateSystemExpression("JHpointExpression=" + value.ToString());
            Scalar scalar = workPart.Scalars.CreateScalarExpression(expression, NXOpen.Scalar.DimensionalityType.None, NXOpen.SmartObject.UpdateOption.WithinModeling);
            Point pointOut = workPart.Points.CreatePoint((IBaseCurve)line, (Point)point, scalar, NXOpen.PointCollection.AlongCurveOption.Distance, Sense.Reverse, NXOpen.SmartObject.UpdateOption.WithinModeling);


            Point3d point3D = pointOut.Coordinates;
            UFSession.GetUFSession().Curve.CreatePoint(new double[] { point3D.X, point3D.Y, point3D.Z }, out Tag outPoint);
            workPart.Points.DeletePoint(pointOut);
            return NXObjectManager.Get(outPoint);
        }

你可能感兴趣的:(c#,NX开发,c#)