MOI3d CAM Alpha version

Next
 From:  nemoz
11826.1 
Hi Michael,

Issues with Object Selection in Custom HTML Commands & 3D Development Inquiry

Dear MoI 3D Developer,

I am currently developing custom HTML commands for MoI 3D, specifically focusing on CAM functionalities.
I've encountered a critical and persistent issue regarding object selection within the JavaScript context of
these HTML commands.

Problem Description: Object Selection in HTML Commands

Despite visually selecting objects (e.g., a face of a solid, or a standalone planar surface) in the MoI
viewport, my JavaScript code within the HTML command consistently fails to recognize these selections.

I have attempted the following methods:

1. `window.parent.moi.geometryDatabase.getObjects()` and iterating to check `obj.selected`: When iterating
through all objects returned by getObjects(), the obj.selected property for the visually selected object(s)
always returns false.
2. `window.parent.moi.geometryDatabase.getSelectedObjects()`: This method consistently returns an empty
collection (length is 0), even when objects are visibly selected.
3. `window.parent.moi.geometryDatabase.getLastSelectedObject()`: This method appears to be undefined or
inaccessible in my environment, resulting in a TypeError.

This behavior is highly unusual for a JavaScript API interacting with a CAD environment. It prevents any CAM
operation that relies on user selection from functioning correctly. Could you please clarify the correct and
reliable way to retrieve the currently selected object(s) (including faces of solids and standalone
surfaces) from within a custom HTML command's JavaScript? Is there a specific event, method, or context I
should be using to ensure the selection state is correctly propagated to the HTML command's environment?

Forward-Looking Inquiry: 3D Solid Selection and Dimension Retrieval

Looking ahead, I plan to develop more advanced 3D CAM functionalities, which will require robust interaction
with solid models. To facilitate this, I would greatly appreciate information on:

* Reliable selection of 3D solid objects: Beyond faces and surfaces, how can I reliably select and identify
entire solid objects within the JavaScript API?
* Retrieving dimensions and properties of 3D solids: Once a solid is selected, what are the appropriate API
methods to obtain its bounding box, volume, surface area, or other geometric properties necessary for CAM
calculations?

Having this information would be invaluable for the continued development of these advanced features.

Thank you for your time and assistance. I look forward to your guidance on these critical points.

I can already obtain gcode for profiling, drilling, threading, pocketing on zxc machines, on top face and on side faces, and even on normal xyz machines... can you please give me some suggestions?

thanks

Nemoz

EDITED: 7 Nov 2025 by NEMOZ

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
11826.2 In reply to 11826.1 
Hi Nemoz,

re:
> Could you please clarify the correct and reliable way to retrieve the currently selected object(s)
> (including faces of solids and standalone surfaces) from within a custom HTML
> command's JavaScript?

It's moi.geometryDatabase.getSelectedObjects().

If that is not working for your script, please post the script and .3DM file, or send it to me at moi@moi3d.com so I can try to reproduce the problem over here.


> Retrieving dimensions and properties of 3D solids: Once a solid is selected, what are the appropriate API
> methods to obtain its bounding box, volume, surface area, or other geometric properties necessary for CAM
> calculations?

For getting a bounding box:
var bbox = obj.getBoundingBox( true /* Use high accuracy bounds */ );

Bounding box has these properties:

bbox.min
bbox.max
bbox.center
bbox.xLength
bbox.yLength
bbox.zLength
bbox.diagonalLength


Calculating surface area:
code:
function GetObjectArea( objects )
{
	moi.geometryDatabase.deselectAll();
	objects.setProperty( 'selected', true );

	var area = moi.ui.propertiesPanel.calcSurfaceArea();
	moi.geometryDatabase.deselectAll();

	return area;
}

Calculating volume:
code:
function GetObjectVolume( objects )
{
	moi.geometryDatabase.deselectAll();
	objects.setProperty( 'selected', true );

	var volume = moi.ui.propertiesPanel.calcSolidVolume();
	moi.geometryDatabase.deselectAll();


	return volume;
}


- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  nemoz
11826.3 In reply to 11826.2 
So ... a lot of coding and finally I'm very close to the end... Attached you can find the manual, 2 axes operations already tested and even lathe operations and 3 axes operations, now I will start the testing for 4 axes operations... 5 axes operations can't be tested because I don't have yet a 5 axes machine, I can only import in a gcode 5 axes simulator . As soon as I will be sure that everything is done I will release it.

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  blowlamp
11826.4 In reply to 11826.3 
It looks like an epic piece of work.
I'm looking forward to testing this with my PlanetCNC controlled lathe.
Thanks for the all the effort you must have put into it.

Martin.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  nemoz
11826.5 In reply to 11826.4 
are you using windows based pc?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  blowlamp
11826.6 In reply to 11826.5 
Yes. I'm staying with Windows 10 for as long as posible. ;-)

Martin.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  nemoz
11826.7 In reply to 11826.6 
I don't want to know which cam you are using actually, but can you spot a postprocessor in that list that fit your machine? I used this type of postprocessors because this is the biggest postprocessor library downloadable for free.
https://mecsoft.com/downloads/download-posts/
We can even make one from zero in case... I'm finishing the GUI to create post processors...
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  blowlamp
11826.8 In reply to 11826.7 
I have a Mach 3 controlled milling machine as well as a PlanetCNC lathe, both of these use a very similar g-code structure which is mostly interchangeable. The PlanetCNC controller can use g-code written for a LinuxCNC machine, so there is nothing unusual to allow for there.

Martin.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  AlexPolo
11826.9 
Wow amazing a long time RHINO CAM paired with a SHOPBOT PRS5 with 5th axis on windows 10 been solid for nearly 20 years,
Look forward to the release and costings?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  nemoz
11826.10 
https://web-production-1eaa4.up.railway.app/

I'm traveling in Asia, beta 1 is available... every key will last for 30 days, I will release a newer version before 30 days, I will create a discord channel for bugs and future developments. For sure there are some bugs, beginning of 2026 I will have time to fix them and to check everything in detail. Actually the files from some operations are already tested and used in production on 2 Doosan Puma 2100 and one Haas 3 axis.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  blowlamp
11826.11 In reply to 11826.10 
I'd like to try this plugin, but I'm getting download warnings and the email confirmation went straight to spam, so I'll wait until something changes before dipping my toe into the water.

Thanks.
Martin.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Luis (LGRIJALVA)
11826.12 In reply to 11826.10 
Is there any news about this project?

Seems an awesome feature!

Luis G
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All