What's new

AlibreDesignToolsStarter using ImGui.NET for the UI.

stepalibre

Senior Member
1695570741841.png

AlibreX code goes in SubmitUI()

C#:
 private static unsafe void SubmitUI()
        {
            ImGui.Begin("Alibre Design Tools WIP 1");
            if (ImGui.Button("open"))
            {
                //AlibreToImGuiProcessing();
            }
            ImGui.End();

            ImGui.Begin("Script Generator");
            if (ImGui.Button("open"))
            {
                //AlibreToImGuiProcessing();
            }
            ImGui.End();


            ImGui.Begin("Run Scripts");
            if (ImGui.InputText("Input Field", ref _text, 100))
            {
            }
            ImGui.End();
            ImGui.InputTextMultiline("Output", ref _textArea, 900, new System.Numerics.Vector2(1500, 1000));
            if (ImGui.Button("Run Script"))
            {

                //RunLINQPadScript(_textArea);
            }

            var size = ImGui.GetWindowSize();;
            ImGui.Text(size.X.ToString());
            ImGui.Text(size.Y.ToString());
            ImGui.Text(size.ToString());
            ImGui.End();
            ImGui.Begin("Alibre Design");
            var size2 = ImGui.GetWindowSize();
            if (ImGui.Button("Create"))
            {
                IADSession Session;
                IAutomationHook Hook;
                IADRoot Root;
                IADPartSession AdPart;
                Hook = (IAutomationHook)GetActiveObject("AlibreX.AutomationHook", true);
                Root = (IADRoot)Hook.Root;
                Session = Root.TopmostSession;
                AdPart = (IADPartSession)Session;
                Console.WriteLine(AdPart.FilePath);
                string desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
                string outputPath = Path.Combine(desktopPath, "output.png");
                AdPart.SaveCurrentViewSnapshot(outputPath, 800, 800);
            };

            var size4 = ImGui.GetWindowPos();
            ImGui.Text(size4.X.ToString());
            ImGui.Text(size4.Y.ToString());
            ImGui.Text(size2.X.ToString());
            ImGui.Text(size2.Y.ToString());
            ImGui.Text(size2.ToString());
            ImGui.End();
        }

That's it. Useful when debugging code while building an addon, scripting and learning AlibreX. Anything.

I love it! Much faster workflow.

 

Attachments

  • AlibreDesignToolsStarter.zip
    5.9 MB · Views: 2

DavidJ

Administrator
Staff member
Unless this is just for skilled programmers, you might want to add some context so that others have some idea of what this is all about...

Personally I don't have a clue - that is my problems not yours, but I suspect many may be in the same boat.

It might be helpful to explain why people would want to take an interest in this...
 

stepalibre

Senior Member
Unless this is just for skilled programmers, you might want to add some context so that others have some idea of what this is all about...

Personally I don't have a clue - that is my problems not yours, but I suspect many may be in the same boat.

It might be helpful to explain why people would want to take an interest in this...

I'm sorry. I'll start to add more context on all my post. This is an example visual studio project for using ImGUI when developing for Alibre. Is there a format or example post I can use as a guide for similar content?
 

stepalibre

Senior Member
Unless this is just for skilled programmers, you might want to add some context so that others have some idea of what this is all about...

Personally I don't have a clue - that is my problems not yours, but I suspect many may be in the same boat.

It might be helpful to explain why people would want to take an interest in this...
Should this be a resource? It's not really a tutorial.
 

DavidJ

Administrator
Staff member
I meant how do average forum users know what this is about or for...? What does it do for them, why should they be interested? Presumably you are doing this for some reason - it might get more attention if you explained a bit....
 

stepalibre

Senior Member
@DavidJ you can delete this post. It was meant to be a resource and a discussion starter. I will redo this post at a later date.

Thanks for the help.
 

DavidJ

Administrator
Staff member
That's fine - no need to delete. Some (more skilled than I) may be able to get something from it.

It's probably always useful to give some information about the aim/purpose of any add-on work. Many of us won't understand or follow the details (some will), but we can all potentially get excited about the end goal, or decide it isn't relevant to our usage of Alibre.
 
Top