Exemplo n.º 1
0
        /////////////////////////////////////////////////////////////
        // Use: Returns thread major radius for standard thread.
        //
        /////////////////////////////////////////////////////////////
        private static double GetThreadMajorRadiusStandard(
            Face threadedFace)
        {
            System.Object radius = Toolkit.GetProperty(
                threadedFace.Geometry,
                "Radius");

            return((double)radius);
        }
Exemplo n.º 2
0
        /////////////////////////////////////////////////////////////
        // Use: Returns Thread Pitch value as double (in cm).
        //
        /////////////////////////////////////////////////////////////
        public static double GetThreadPitch(ThreadInfo threadInfo)
        {
            bool metric = (bool)Toolkit.GetProperty(
                threadInfo,
                "Metric");

            double pitch = (double)Toolkit.GetProperty(
                threadInfo,
                "Pitch");

            return(metric ? pitch * 0.1 : pitch * 2.54);
        }
Exemplo n.º 3
0
        /////////////////////////////////////////////////////////////
        // Use: Determines if a Cylindrical Face is an interior
        //      face or not. This methods works only for cylindrical
        //      geometry.
        /////////////////////////////////////////////////////////////
        public static bool IsInteriorFace(Face face)
        {
            Point basePoint = Toolkit.GetProperty(face.Geometry,
                                                  "BasePoint") as Point;

            UnitVector normal = Toolkit.GetFaceNormal(face,
                                                      face.PointOnFace);

            UnitVector refvect =
                face.PointOnFace.VectorTo(basePoint).AsUnitVector();

            return(normal.DotProduct(refvect) > 0);
        }
Exemplo n.º 4
0
        /////////////////////////////////////////////////////////////
        // Use: Determines if input Face has iMate attached to it
        //      and returns iMate name if any.
        /////////////////////////////////////////////////////////////
        public static bool HasiMate(
            Face face,
            out string iMateName)
        {
            iMateName = string.Empty;

            PartComponentDefinition compDef =
                face.SurfaceBody.ComponentDefinition
                as PartComponentDefinition;

            foreach (iMateDefinition def in compDef.iMateDefinitions)
            {
                object Entity = Toolkit.GetProperty(def, "Entity");

                if (Entity == null)
                {
                    //Case CompositeiMateDefinition
                    continue;
                }

                if (Entity == face)
                {
                    iMateName = def.Name;
                    return(true);
                }

                if (Entity is Edge)
                {
                    foreach (Edge edge in face.Edges)
                    {
                        if (Entity == edge)
                        {
                            iMateName = def.Name;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }