Author Topic: Drawing 3D Solid primitives Plugin  (Read 12930 times)

Offline karst.drenth

  • Droid
  • **
  • Posts: 59
    • View Profile
Drawing 3D Solid primitives Plugin
« on: March 28, 2017, 20:59:14 pm »
Hi All,

As of a result of my GRBLMachine Plugin, I developed some 3D Solid Primitives.

As a showed here:
Re: GRBL v1.1 Machine Control and GCODE sender Plugin
they are fully compatible with CamBam's drawing system (including saving and reading the .cb file).

With this plugin, you can use them also in your own drawings, even if you do not have/need/want GRBLMachine :P (this plugin WILL come as a satelite plugin together with GRBLMachine in the future ;) )

I made the whole thing so that it can be extended (by you), used in your own plugin(s), or just standalone.
If there is some positive response here, I will extend it with 'Tube', 'Cone', 'Beam' and 'Pane' and maybe even 'Toroid'.

The classes are in the CamBam.CAD.Solids namespace and the plugin also includes my CamBam Extensions.
So you might just reference them in your own project.

The operation is quite simple:

- Right click in the View
- Select 'Draw'
- Select 'Solids'
- Select the primitive of your choise
- Fill in the properties
- Press OK or Apply to insert the Solid into your drawing.

Something like this:


(click for the full picture)

... that's where they hide ;)


(click for the full picture)

... this is how you set the properties


So, please tell me if there are more wishes :) I would like to add a 'Settings' dialog under 'Plugins' to set some defaults.


Grtzz,

Karst

P.S. Source code comes later on online. I am preparing GRBLMachine official 1.0.0, which also uses CamBam.CAD.Solids. With that source I will also release this source

[History]

Attached V1.0.0.1 since 1.0.0 has no decimal places in the property dialogs :P  :-[
30th Mar 2017: Attached v1.0.1

[/History]

Sources can be found here (click)
« Last Edit: March 30, 2017, 21:40:24 pm by karst.drenth »

Offline lloydsp

  • CNC Jedi
  • *****
  • Posts: 8969
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #1 on: March 28, 2017, 21:28:25 pm »
Ok, Karst!  You've got me hooked!  :D

Lloyd
"Pyro for Fun and Profit for More Than Fifty Years"

Offline karst.drenth

  • Droid
  • **
  • Posts: 59
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #2 on: March 28, 2017, 21:31:54 pm »
 ;D ;D

And now for someone who comes up with a decent 'Subtract' algorithm to subtract some solids/surfaces ;)

Anyone here ? :P


Grtzz,

Karst

Offline karst.drenth

  • Droid
  • **
  • Posts: 59
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #3 on: March 30, 2017, 21:34:35 pm »
Hi All,

So, also some progress here :)

Version 1.0.1 is there, as usual also including sources  !

I posted this new version at the bottom of this post: Drawing 3D Solid primitives Plugin

Mods:

- Completed the property editor for the settings of the plugin
- Taking the defaults into the draw dialogs
- Added the 'Solids' item to the main 'Draw' menu


(click for the full picture)

Note: You can use CamBam.CAD.Solids.dll from your own plugin projects, by simply referencing it in Visual Studio

So... have fun with the plugin and/or the sources !


Grtzz and please keep me informed about what you think of CamBam.CAD.Solids,

Karst

« Last Edit: March 31, 2017, 06:19:41 am by karst.drenth »

Online dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drawing 3D Solid primitives Plugin
« Reply #4 on: March 31, 2017, 15:01:59 pm »
Hello

Oh ! .. I missed this topic  :o ...

Another nice job, thanks  ;D

++
David

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5262
  • Made in England
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #5 on: March 31, 2017, 15:04:38 pm »
The Revolved Extrude plugin can also draw what look like solids but are actually wrapped surfaces
Filmed in Supermarionation

Online dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drawing 3D Solid primitives Plugin
« Reply #6 on: April 04, 2017, 19:42:05 pm »
Hello

It's strange, but the menus can't be translated  ??? (tried on both 0.98 and V1.0)

Usually, menus can always be translated even if no specific code is added in the plugin (menu is the only thing that is automatically translated) ... how did you disable the menu translation ?

++
David

Offline karst.drenth

  • Droid
  • **
  • Posts: 59
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #7 on: April 04, 2017, 20:01:09 pm »
Hi David,

I did not ;) ( at least consciously... )

But I can/could explain it: The names in the menu's are taken directly from the Type.Name of the solids.

So without changing the name of the class, the MenuItem will not change. I guess it should be subject to 'manual' translation when I start to build in translation.

Grtzz,

Karst

Online dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drawing 3D Solid primitives Plugin
« Reply #8 on: April 04, 2017, 20:12:13 pm »
The strange thing is that the texts appears in the translation list (rod, sphere etc), except 'Solids' that is not here ... maybe they comes from the GRBL plugin ?

++
David

Offline karst.drenth

  • Droid
  • **
  • Posts: 59
    • View Profile
Re: Drawing 3D Solid primitives Plugin
« Reply #9 on: April 04, 2017, 20:33:27 pm »
This is the code that creates the menu's:

Code: [Select]
    private static ToolStripDropDownItem CreateSolidsMenu(List<Type> solids)
    {
      ToolStripDropDownItem solidsToolStripMenuItem = new ToolStripMenuItem("Solids") { Name = "solidsToolStripMenuItem" };

      foreach (Type type in solids)
      {
        Solid s = Activator.CreateInstance(type) as Solid;

        solidsToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem(s.DisplayName,null,(object x, EventArgs y) =>
        {
          Solid tag = (x as ToolStripMenuItem).Tag as Solid;

          new DrawSolidForm(tag).Show(ThisApplication.TopWindow);
        }) { Tag = s });
      }

      return solidsToolStripMenuItem;
    }

As you can see, it's just a normal ToolStripDropDownItem. If anybody has a clou, please tell me ;)

Grtzz,

Karst

Online dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drawing 3D Solid primitives Plugin
« Reply #10 on: April 04, 2017, 21:19:17 pm »
I'm not familiar with C syntax but I've a look on a VB plugin I've done and it seems that the only change is that the name is not given in the ToolStripMenuItem() statement but separately. But not sure it have anything to do with the pb.

in VB

Dim mi As ToolStripMenuItem = New ToolStripMenuItem()   'the new menu entry (item)
mi.Text = "Numerical move"
....
....

« Last Edit: April 04, 2017, 21:49:36 pm by dh42 »

Online dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7408
    • View Profile
    • Cambam V1.0 French Doc
Re: Drawing 3D Solid primitives Plugin
« Reply #11 on: November 26, 2020, 12:06:27 pm »
Hello

The copy/paste is not working on CB 1.0 and CB 1.0 - 64Bits if object is added as solid object (no problem if added as surface object)

https://cambamcnc.com/forum/index.php?topic=8790.msg70083#msg70083

++
David