Shaded View and Visible Edges and Hidden Edges

Phenom
Phenom

Hi

 

 

regarding to a question which came up in the Solid Edge Forum I will ask the programer profis for assitance

 

There is a short macro wanted to set the "View Style" in a part or asm document to "Shaded+Visible Edge" AND hidden edges shown as dashed or dimmed too

 

Shaded+Visible is no problem since there is an API command avaialable but to set the hidden edges brought the problem.

 

Thanks for any help and every hint/tip how to get it

 

 



regards
Wolfgang
5 REPLIES

Betreff: Shaded View and Visible Edges and Hidden Edges

Phenom
Phenom

Hi Edgers,

 

 

due to the fact that there was no answer since Monday I suppose there is no method available to get the requested function, isn't it?

 

Or has any programming professional any idea how to do

Thanks for all hints

 

 



regards
Wolfgang

Betreff: Shaded View and Visible Edges and Hidden Edges

Genius
Genius

Hello @hawcad, you want make hidden edges dashed like below image?Hidden Edges.PNG

 

 

 

If yes, you can make hidden edge by program using SolidEdgeFramework.ViewStyle.HiddenLines or HiddelLineMode.

 

Is that what you want to do?



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Betreff: Shaded View and Visible Edges and Hidden Edges

Phenom
Phenom

Hi @KabirCosta

 

 

Yes this is exactly the indent from the SE forum.

 

But I have not found the correct code for acitvating it.

For activating the shading I have found the code

 

SEApp.StartCommand(PartFormatShadedwithVisibleEdges)

 

The additional hidden edges seems to need more linesof code

Maybe YOu have the one or other hint how to get it

 

 



regards
Wolfgang

Betreff: Shaded View and Visible Edges and Hidden Edges

Genius
Genius

@hawcad

I've done a simple code only to show how to do this using the ViewStyle class, hope it helps you.

 

using System;
using SolidEdgeFramework;
using SolidEdgeCommunity;
using SolidEdgeAssembly;

namespace ViewStyleExample
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            // Declare your main variables
            Application application = null;
            Documents documents = null;
            AssemblyDocument assemblyDocuments = null;

            // View Styles variables
            ViewStyles viewStyles = null;
            SolidEdgeFramework.ViewStyle viewStyle = null;

            try
            {
                // Register
                OleMessageFilter.Register();

                // Connect your Solid Edge
                application = SolidEdgeUtils.Connect(true);

                // Verify if active document is assembly
                if (application.ActiveDocumentType != DocumentTypeConstants.igAssemblyDocument)
                {
                    OleMessageFilter.Unregister();
                    return;
                }

                // Get active document
                assemblyDocuments = (AssemblyDocument)application.ActiveDocument;

                // Get View Styles collection
                viewStyles = (ViewStyles)assemblyDocuments.ViewStyles;

                // In this case, I use Default view style, but if you want you can create a new view style
                // Get Default View Style
                viewStyle = viewStyles.Item(1);

                // Actions here
                // If you want Wireframe, visible and hidden edges, do it:
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeOutline;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // If you want Wireframe, only visible edges
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeVHL;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // If you want only shooth shaded mode
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeSmooth;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // If you want shaded with visible edges
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeSmoothVHL;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // Shaded with visible edges + Hidden lines
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeSmoothVHL; 
                viewStyle.HiddenLineMode = (int)SeHiddenLineMode.seHiddenLineModeDim;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // Shaded with visible edges + Hidden dashed lines
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeSmoothVHL; 
                viewStyle.HiddenLineMode = (int)SeHiddenLineMode.seHiddenLineModeDashed;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

                // Only Shaded with visible edges (turn off hidden lines)
                viewStyle.RenderModeType = SeRenderModeType.seRenderModeSmoothVHL;
                viewStyle.HiddenLineMode = (int)SeHiddenLineMode.seHiddenLineModeOff;
                application.StartCommand(SolidEdgeCommandConstants.seRefreshViewCommand); // Refresh view

            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                // Ungister
                OleMessageFilter.Unregister();
            }
        }
    }
}

These actions can be better implemented, such as creating a window, buttons, menus, etc ...

 

Here I wrote the pure code, only to show how to use the ViewStyle class. I hope this can be useful to you.

 

But I do not know how to directly activate it through application.StartCommand ("HiddenLinesMode Here")



==========================
Kabir Costa
Industrial Designer
kabircosta@gmail.com

Betreff: Shaded View and Visible Edges and Hidden Edges

Phenom
Phenom

Hi @KabirCosta

 

 

thanks for Your efforts and the code.

 

I will work through it and try to bring it into a vb code (I'm normally not used to have it in C)

 

And Yes I agree with: "It would be fine if there are more commands available directly!"

 

Thanks



regards
Wolfgang