MoI discussion forum
MoI discussion forum

Full Version: V4 released!

Show messages:  1-19  …  100-119  120-139  140-159  160-179  180-188

From: Booleano
20 May 2021   [#160] In reply to [#157]
Hi Michael.

Once again, thank you very much for your invaluable help.
I have modified my custom window, only with the extra tools that are not in MOI.
But it would be great if you could include in this window, icons that run a script (Scrip1,Scrip2,Scrip3).
And it would look like the attached image (can I do any icon design instead of the "?" Signs).

What code should I use, and in what type of file to write it.
For example, how to put this script:
script: / * Create a style for each object name * / var AllObjects = moi.geometryDatabase.getObjects (); var NamedObjects = new Object (); for (var i = 0; i <AllObjects.length; ++ i) {var Obj = AllObjects.item (i); if (Obj.name! = '') {if (! NamedObjects [Obj.name]) {NamedObjects [Obj.name] = new Array (); } NamedObjects [Obj.name] .push (Obj); }} for (var Name in NamedObjects) {var style = moi.geometryDatabase.findStyle (Name, true); var Objects = NamedObjects [Name]; for (var i = 0; i <Objects.length; ++ i) {Objects [i] .styleIndex = style.index; var SubObjects = Objects [i] .getSubObjects (); for (var j = 0; j <SubObjects.length; ++ j) {SubObjects.item (j) .styleIndex = style.index; }}}


Image Attachments:
MOI_V_2.JPG 


From: Michael Gibson
20 May 2021   [#161] In reply to [#160]
Hi Booleano,

re:
> And it would look like the attached image (can I do any icon design instead of the "?" Signs).

Yes, you can make your own icon image saved as a .png file, copy the file over into the ui\icons folder,
and have them referenced as the other buttons do as an icon="" attribute on the command button tag.

re:
> What code should I use, and in what type of file to write it.

For direct script code like that, you can put it contained inside of a function in a <script> tag inside the <head>
of your document, and have the script function called in an onclick="" handler on the command button tag.

So inside the <head> of your document, you would put:

code:
<script>
function DoCreateStyles()
{
/* Create a style for each object name */ var AllObjects = moi.geometryDatabase.getObjects ();  ... rest of script code  here ....
}


And on your command button tag put:

code:
<moi:CommandButton onclick="DoCreateStyles();">,,,


- Michael
From: Booleano
21 May 2021   [#162] In reply to [#161]
Hi

Thanks again for your help.

The ideal thing for me would be that you attach the documents for a script.
I don't know if there would be 2 files, for example the name would be "Styles"
1 - "Styles.htm"
And this

And on your command button tag put:
code:
<moi:CommandButton onclick="DoCreateStyles();">,,,

I don't know how it would be

I am attaching a file of what I think I understood.
Please, if it's wrong, you can modify it and resubmit it to serve as a template for the other scripts.
If the second file is missing, please can you send it to me.
From: Michael Gibson
21 May 2021   [#163] In reply to [#162]
Hi Booleano, if you attach the .htm file for your dialog instead of only a screenshot then I can make you a demonstration in your actual UI file.

- Michael
From: Booleano
21 May 2021   [#164] In reply to [#163]
Hi Michael.

If that's what I want, please, why don't I know how to do it.
I don't know Java and its syntax.
I thought that Google had translated it well, but it seems that it is not like that.
Sorry, and thank you very much again.
From: Michael Gibson
21 May 2021   [#165] In reply to [#164]
Hi Booleano, I'm sorry I don't understand.

Is it correct that you are working on a dialog box that has command buttons in it?

If so can you please post the .htm file for your dialog here?

- Michael
From: Booleano
21 May 2021   [#166] In reply to [#165]
Hi Michael

I apologize for not being able to express what I really need.

I attach 2 files that are:
"Script.txt" where the scripts that each icon in the attached image "Styles.jpg" and its corresponding code are indicated (it is written as it would be added as a keyboard shortcut).

"SidePane1.htm" is the current file of the pop-up window of the image "Styles.jpg", where the 3 icons of the file "Script.txt" are already added

I hope this time you understand what I want to do.

And the file "SidePane1.htm" that I need you to modify, I suppose it will help me to know how to add possible useful scripts for me.

And I thank you again for your invaluable help.
From: Michael Gibson
22 May 2021   [#167] In reply to [#166]
Hi Booleano, so for the icons you need to make each icon image into its own separate file. Usually the icons are 64 width 64 height PNG image files.

Then copy your 3 new icon image files into the "icons" sub-folder inside the ui folder. Then you'll be able to use them in a command button.

For running those scripts, step #1 is to modify your SidePane1.htm file to add a <head> section, usually <style> and <script> go in the <head> section of an html file.

So that would look like this:

code:
<html>

	<head>

		<style>
			/* Turn off text block under command button icon */
			moi\:CommandButton > div {
				display:none;
			}
			/* Cambio de tamaño de los iconos */
			moi\:CommandButton > img, moi\:CommandMenuButton > img, moi\:CommandSplitButton > img {
			width:8em;
			height:8em;
			}
		</style>

	</head>

	<body class="SidePaneBody">
              ....


Now add a <script> section inside the <head> after the <style>:
code:
<html>

	<head>

		<style>
			/* Turn off text block under command button icon */
			moi\:CommandButton > div {
				display:none;
			}
			/* Cambio de tamaño de los iconos */
			moi\:CommandButton > img, moi\:CommandMenuButton > img, moi\:CommandSplitButton > img {
			width:8em;
			height:8em;
			}
		</style>

		<script>

		</script>

	</head>


Then inside the <script></script> section you can add functions that contain script code:

code:
		<script>
			function ScriptCodeFunction1()
			{

			}
		</script>


copy the script code from your Scripts.txt inside the function, in between { }.

To make a command button call the script function, put in an onclick="" attribute in the moi:CommandButton element, like this:

<moi:CommandButton icon="icons/icon_filename.png" onclick="ScriptCodeFunction1()">Text here</moi:CommandButton>

You can remove the command="" attribute from these particular 3 buttons, they will be calling script code inside this same file instead of running a command.

Let me know if you're still stuck.

- Michael
From: Booleano
23 May 2021   [#168] In reply to [#167]
Hi Michael.

Understood everything perfectly.

My pop-up window is only going to have little-used scripts, it is very overwhelming to remember 20-40 keyboard shortcuts, at least for me, that's why I needed this.
So once again thank you very much.
You can tell me where I can check the syntax of the version in which the MOI scripts are written.
For many years now, I was programming in C ++, Borland's version for MS-DOS (Windoss did not yet exist), and it would be useful for me to at least know how to modify some script, without going crazy.

If I need to add more sripts they will all be in a red box, to know that they are not tools.

Image Attachments:
MOI_V_2.JPG 


From: Michael Gibson
23 May 2021   [#169] In reply to [#168]
Hi Booleano,

re:
> You can tell me where I can check the syntax of the version in which the MOI scripts are written.

There isn't really a place currently where that can be checked other than by running it in MoI.

In the future i would like to work on a built in script editor that would help make it easier to write and debug scripts. It wiill take a lot of effort to make it though.

- Michael
From: Booleano
23 May 2021   [#170] In reply to [#169]
Hi Michael.

I really think that I would only need the necessary Java version, and I would search the Internet for the information I need.
I will never write a script, only on occasion would I modify an existing one.

Thanks.
From: Michael Gibson
23 May 2021   [#171] In reply to [#170]
Hi Booleano, the script language version that MoI uses is called JavaScript and the specific version name is called ECMAScript v5 .

- Michael
From: Booleano
24 May 2021   [#172] In reply to [#171]
Hi Michael.

Thank you
From: Mindset (IGNITER)
4 Jun 2021   [#173]
Don't understand what gives here:




MindSet

Image Attachments:
Screenshot 2021-06-04 005006.png 


From: Frenchy Pilou (PILOU)
4 Jun 2021   [#174] In reply to [#173]
As you can edit Dimension Text anything can be writed!

or can be also an perspective effect!

etc...
From: Mindset (IGNITER)
4 Jun 2021   [#175] In reply to [#174]
So, it really doesn't offer measurements as fractions?
Hmm, maybe that makes sense; thought I was doing something wrong... both examples are coplanar.

Thanks!
From: Michael Gibson
4 Jun 2021   [#176] In reply to [#173]
Hi Mindset,

> Don't understand what gives here:

Dimension values are rounded using the setting under Formatting > "Decimal display" for decimals and Formatting > "Fractional display" for feet & inches.

So if you want to display a fraction less than that you'll need to set the display precision to be tighter. You can set the default used for new dims under Options > Dimensions, and you can set the properties for existing ones by selecting it and pushing "Details...".

If you're still having a problem can you please post the .3dm model file with your dim in it so I can take a look.

- Michael
From: neilwilson3412
12 Jun 2021   [#177] In reply to [#1]
im loving it!!!! performance is great and so stable!


From: Michael Gibson
24 Jul 2021   [#178]
Ok, I finally got back to tuning up the web site a little more and there is now a "what's new" page for V4 here:
http://moi3d.com/4.0/whatsnew.htm

- Michael
From: Frenchy Pilou (PILOU)
25 Jul 2021   [#179] In reply to [#178]
Super!

Show messages:  1-19  …  100-119  120-139  140-159  160-179  180-188