Version 1.0, 26 November 2012 View Toolbar Addins

COMMENTS

This plugin adds some extra tool bar buttons to CamBam's View tool bar strip.

These provide the following functions:

ISO : View isometric projection.

XY : View the XY plane.

XZ : View the XZ plane.

YZ : View the YZ plane.

The source code is also provided and demonstrates adding to the existing toolbars using a custom plugin, as well as how to programmatically change the current view projection.

Download

Plugin

download ViewToolbarAddins-1.0.zip (3 KB)

Source

download ViewToolbarAddins-1.0-source.zip (3 KB)

Installation

To install the plugin, unzip ViewToolbarAddins.dll into the CamBam plugins folder.

If the installation is successful, you should see 4 new entries on the CamBam View tool bar, with text labels 'ISO', 'XY', 'XZ' and 'YZ'.

Source

ViewToolbarPlugin.cs

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using CamBam;
using CamBam.Geom;
using CamBam.CAD;
using CamBam.UI;


namespace ViewToolbarAddins
{
    public class ViewToolbarPlugin
    {
        public static void InitPlugin(CamBamUI ui)
        {
            ThisApplication.TopWindow.Load += new EventHandler(TopWindow_Load);
        }

        static void TopWindow_Load(object sender, EventArgs e)
        {
            Form f = ThisApplication.TopWindow;
            foreach (Control c in f.Controls)
            {
                if (c is ToolStripContainer)
                {
                    ToolStripContainer tsc = (ToolStripContainer)c;
                    foreach (Control cc in tsc.TopToolStripPanel.Controls)
                    {
                        if (cc is ViewToolStrip)
                        {
                            ViewToolStrip vts = cc as ViewToolStrip;

                            ToolStripItem ti = vts.Items.Add("ISO");
                            ti.Click += new EventHandler(ViewISO_Click);
                            ti.ToolTipText = "ISO View";

                            ti = vts.Items.Add("XY");
                            ti.Click += new EventHandler(ViewXY_Click);
                            ti.ToolTipText = "XY View";

                            ti = vts.Items.Add("XZ");
                            ti.Click += new EventHandler(ViewXZ_Click);
                            ti.ToolTipText = "XZ View";

                            ti = vts.Items.Add("YZ");
                            ti.Click += new EventHandler(ViewYZ_Click);
                            ti.ToolTipText = "YZ View";

                            // ti.ImageTransparentColor = Color.Magenta;
                            break;
                        }
                    }
                    break;
                }
            }
        }

        static void ViewISO_Click(object sender, EventArgs e)
        {
            if (CamBamUI.MainUI.ActiveView == null) return;

            ViewProjection vp = CamBamUI.MainUI.ActiveView.ViewProjection;

            Matrix4x4F vt = Matrix4x4F.Identity;
            vt.Scale(vp.ViewMatrix4x4F.GetScale());
            vt.RotZ(-Math.PI / 4);
            vt.RotX(-Math.Asin(Math.Tan(Math.PI / 6)));
            vt.Translate(vp.ViewMatrix4x4F.m[12], vp.ViewMatrix4x4F.m[13], vp.ViewMatrix4x4F.m[14]);
            vp.ViewMatrix4x4F = vt;

            CamBamUI.MainUI.ActiveView.RefreshView();
        }

        static void ViewXY_Click(object sender, EventArgs e)
        {
            if (CamBamUI.MainUI.ActiveView == null) return;
            CamBamUI.MainUI.ActiveView.ViewProjection.ViewXYPlane();
            CamBamUI.MainUI.ActiveView.RefreshView();
        }

        static void ViewXZ_Click(object sender, EventArgs e)
        {
            if (CamBamUI.MainUI.ActiveView == null) return;
            CamBamUI.MainUI.ActiveView.ViewProjection.ViewXZPlane();
            CamBamUI.MainUI.ActiveView.RefreshView();
        }

        static void ViewYZ_Click(object sender, EventArgs e)
        {
            if (CamBamUI.MainUI.ActiveView == null) return;
            CamBamUI.MainUI.ActiveView.ViewProjection.ViewYZPlane();
            CamBamUI.MainUI.ActiveView.RefreshView();
        }

    }
}

Version 1.0

  • Initial Release

Comments

<< 1 >> 
#  anon 10/09/2014 03:26:11
I see xy xz yz but not ISO. Is there a problem??
Reply Quote   1  
#  Charlie 10/08/2016 10:30:14
Make sure you put the .dll file in the plugins folder.
Reply Quote   1  
#  bill 15/02/2017 18:41:54
do not see a dll file
Reply Quote   1  
#  anon 16/02/2017 11:37:43
Hi Bill,

Click the 'download ViewToolbarAddins-1.0.zip' link at the top of this page, you will then need to unzip the file to extract the .DLL
Reply Quote   1  

name: Rate this article

url:
e-mail:
Name, url and e-mail are optional. E-mail addresses will NOT be displayed, but please provide one if you would like a reply.
If your comment or url is not displayed immediately, it may be awaiting approval.
The following BBCode formatting codes are supported : [b], [i], [u], [code], [quote], [list], [*]
Your comments...


Submit Comment
Copyright (c) 2017 HexRay Ltd