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   10  
#  Charlie 10/08/2016 10:30:14
Make sure you put the .dll file in the plugins folder.
Reply Quote   10  
#  bill 15/02/2017 18:41:54
do not see a dll file
Reply Quote   10  
#  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   10  
#  anon 31/12/2017 15:56:02
Seeing the icons on the toolbar. They all work in that the view changes according to the button. However, the ISO view is static. That is, I can’t get it to rotate, tilt, etc. I’ve seen videos where the view moves around in ISO view. I’m running CamBam 1.0 on Linux Mint 17.3 Cinnamon.
Reply Quote   9  
#  anon 10/01/2018 19:06:29
Solved. Figured out this requires the 'alt' key to be pressed while holding down the left mouse button.
Reply Quote   9  
#  Len Shelton 26/12/2019 18:16:06
Brand new install of CamBam

CamBam plus [1.0] rc-3
Copyright © 2019 HexRay Ltd

CamBam.CAD : 1.0.7233.22225
CamBam : 1.0.7233.22227
Build Date : 10/21/2019 1:20:50 PM
Framework Version : 4.0.30319.42000

Placed the DLL file in the plug-ins folder and get this error when running:
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch.
Reply Quote   5  

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