public void ShowPreview(IPartDoc part, object inputObj, bool concentric, double step, double extraRadius)
        {
            HidePreview(part);

            try
            {
                var cylParams = GetCylinderParameters(part, inputObj, concentric, step, extraRadius);
                m_TempBody = CreateCylindricalStock(cylParams);
            }
            catch
            {
            }

            if (m_TempBody != null)
            {
                const int COLORREF_YELLOW = 65535;

                m_TempBody.Display3(part, COLORREF_YELLOW,
                                    (int)swTempBodySelectOptions_e.swTempBodySelectOptionNone);

                m_TempBody.MaterialPropertyValues2 = new double[] { 1, 1, 0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 };

                (part as IModelDoc2).GraphicsRedraw2();
            }
        }
Beispiel #2
0
        public void Main()
        {
            PartDoc part = swApp.ActiveDoc as PartDoc;

            if (part != null)
            {
                IFace2 face = (part as IModelDoc2).ISelectionManager.GetSelectedObject6(1, -1) as IFace2;

                if (face != null && face.IGetSurface().IsSphere())
                {
                    double[] sphereParams = face.IGetSurface().SphereParams as double[];

                    IModeler modeler = swApp.IGetModeler();

                    ISurface sphereSurf = modeler.CreateSphericalSurface2(
                        new double[] { sphereParams[0], sphereParams[1], sphereParams[2] },
                        new double[] { 0, 0, 1 },
                        new double[] { 1, 0, 0 }, sphereParams[3]) as ISurface;

                    m_PreviewBody = sphereSurf.CreateTrimmedSheet4(new ICurve[] { null }, true) as IBody2;

                    m_PreviewBody.Display3(part, ToColorRef(255, 255, 0), (int)swTempBodySelectOptions_e.swTempBodySelectOptionNone);

                    part.ClearSelectionsNotify += new DPartDocEvents_ClearSelectionsNotifyEventHandler(OnClearSelections);
                }
                else
                {
                    swApp.SendMsgToUser("Please select spherical surface");
                }
            }
            else
            {
                swApp.SendMsgToUser("Please open part document");
            }
        }
Beispiel #3
0
        public static void DisplayTs(this IBody2 body, IModelDoc2 doc = null, Color?c = null, swTempBodySelectOptions_e opt = swTempBodySelectOptions_e.swTempBodySelectOptionNone)
        {
            doc = doc ?? (IModelDoc2)SwAddinBase.Active.SwApp.ActiveDoc;
            c   = c ?? Color.Yellow;
            var colorref = ColorTranslator.ToWin32(c.Value);

            body.Display3(doc, colorref, (int)opt);
        }
        public void PreviewOffset(IEnumerable <ISketchSegment> segs, double offset,
                                  double innerRadius, double outerRadius, bool reverse)
        {
            HidePreview();
            m_PreviewOffsetFilletBody = CreateOffset(segs, offset, innerRadius, outerRadius, reverse);

            m_PreviewOffsetFilletBody.Display3(m_Model, ConvertColor(KnownColor.Yellow),
                                               (int)swTempBodySelectOptions_e.swTempBodySelectOptionNone);
        }
Beispiel #5
0
        public static void DisplayTs([NotNull] this IBody2 body, IModelDoc2 doc = null, Color?c = null, swTempBodySelectOptions_e opt = swTempBodySelectOptions_e.swTempBodySelectOptionNone)
        {
            if (body == null)
            {
                throw new ArgumentNullException(nameof(body));
            }
            doc = doc ?? (IModelDoc2)SwAddinBase.Active.SwApp.ActiveDoc;
            c   = c ?? Color.Yellow;
            var colorref = ColorTranslator.ToWin32(c.Value);

            body.Display3(doc, colorref, (int)opt);
        }