[script] FxGraph - 2D/3D Function plotter
 1-20  21-40  41-60  61-80  81-91

Previous
Next
 From:  BurrMan
6447.41 In reply to 6447.40 
Hi michael,
No, i have no file i was working on. I just put the scripts from the forum in js files as opposed to shortcuts. This particular "command" didnt work from a js file.

Can you give me a quick example of using the moi.command.execCommand()?

I was looking to just put these last fxgraph (with parameters) scripts into named js files so i can call them that way.
  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
6447.42 In reply to 6447.41 
Hi Burr, sure - so the first one that Brian had here: http://moi3d.com/forum/index.php?webtag=MOI&msg=6447.31 (the one labeled sinhLeaf) would be like this:

code:
moi.command.execCommand( '_FxGraph3D u;v;((exp(u) - exp((-1)*u))/2 + (exp(v) - exp((-1)*v))/2);-3.14159;3.14159;-3.14159;3.14159;15;15;0;0;0;UV' );

Does that do what you need? If not can you post your .js file and tell me how it's launched so I can better understand what you're trying to do.

- 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:  BurrMan
6447.43 In reply to 6447.42 
Well, i dont know if it can be any simpler!!! Lol :)

Just put that command argument in the brackets of the moi.commamd.execCommand()..

(Edit) and end it with a semi colon. (Edit)

Thank you kind sir.
  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:  Frenchy Pilou (PILOU)
6447.44 
Any image of what the formula above do ? :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  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
6447.45 In reply to 6447.44 
@Burr - you're welcome!

@Pilou, that particular one makes this:



- Michael
Attachments:

  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:  Frenchy Pilou (PILOU)
6447.46 In reply to 6447.45 
Thx! :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  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:  bemfarmer
6447.47 In reply to 6447.42 
Thank you Michael. (I was trying to do some .js with #include _FXGraph3d...)

To implement Michael's code shown in post above, what I did was to create a file called _LeafSinh.js, in notepad++, and copy Michael's code to said file.
Then the _LeafSinh.js file was copied to the MoI3Command folder.
Now the "Leaf" FXGraph3D script can be selected, in MoI, from Ext.Scripts, Max's custom UI.

I think that I recall Burr setting up separate External Scripts files, so I plan to make one for just FXGraph3D scripts (?)
I'll have to look up how to do that...

- Brian

EDITED: 26 Jul 2017 by BEMFARMER

  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:  BurrMan
6447.48 In reply to 6447.47 
Hi bem,
Well, in these earlier versions of MoI you can just make a folder named "scripts" in the installation root. The command field in MoI reads that folder too.

But things in that folder are for "inline scripts" and they run seperately than commands.

For max's customui, i added a page and directed it to that folder.

I think michael has been discussing that he is looking at changing that seperation.
  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:  BurrMan
6447.49 In reply to 6447.42 
Worked like a charm! As far as me spelling it out, I left out another part.

"Putting the command. with line parameters into the brackets (), the command is also surrounded by 's. So ('command')

Anyway.....
  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:  Mike (MGG942)
6447.50 
It's fascinating how mathematical formulas can result in interesting shapes.
Here's one that I found on MathMod: Stereosphere

Copy (Ctr-c) the following and then within Moi hit Tab and paste (Ctr-v)

_FxGraph3D 2.*u/(u*u+v*v+1.);2.*v/(u*u+v*v+1.);(u*u+v*v-1.)/(u*u+v*v+1.);-2;2;-2;2;15;15;1;1;1;UV

Or copy the following to the Commands folder and it will show up as Stereosphere in Max's UI ext scripts feature.

moi.command.execCommand( '_FxGraph3D 2.*u/(u*u+v*v+1.);2.*v/(u*u+v*v+1.);(u*u+v*v-1.)/(u*u+v*v+1.);-2;2;-2;2;15;15;1;1;1;UV' );

Note. If you have done what I apparently have foolishly done and omitted the leading underscore of _FxGraph3D in your set up then you will need to omit it from the preceding lines.

The resultant mesh will Network as it is.

It is quite small, so, to make a solid I first scaled up by a factor of 30, and then used Construct/Offset/Shell with a value of 2mm and Direction Normal.

Just in case you're wondering the formula does NOT produce the lettering shown in the attachment!
Image Attachments:
Size: 114.2 KB, Downloaded: 47 times, Dimensions: 637x508px
  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:  Frenchy Pilou (PILOU)
6447.51 In reply to 6447.50 
Amazing indeed!
---
Pilou
Is beautiful that please without concept!
My Gallery
  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:  speedy (AL2000)
6447.52 In reply to 6447.50 
Hi Mike
look this
Stereo Sphere-
link :https://www.mediafire.com/?xni7d1ima5h4aio
in Elephant Stereo Sphere Parametrized
best
al
  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:  Mike (MGG942)
6447.53 In reply to 6447.52 
Thanks, Al.

I've not yet taken the plunge into node editor but you've given me another reason to do so.

Mike.
  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:  Mike (MGG942)
6447.54 
A way to make a solid version a 'Trumpet'.
The method is based on Max's marvellous _FXGraph3D and uses parametric equations from the equally marvellous MathMod.
Copy (Ctr-c) the following and then within Moi hit Tab and paste (Ctr-v)
_FxGraph3D cos(u)*sin(v); sin(u)*sin(v); cos(v)+log(tan(1/2*v));0;6.283;0.03;1.5;50;50;1;1;1;UV

Note. If you have done what I apparently have foolishly done and omitted the leading underscore of _FxGraph3D in your set up then you will need to omit it from the preceding line.

In (bottom right of) the _FxGraph3D dialog change Mode from UV to U then click on done.
Now select all the curves and execute Construct/Loft using Loft Style: Normal and Profiles: Auto
Delete (or hide) the curves. This should give you 'Trumpet' shaped surface with a slice out of it.
Select the surface and execute Construct/Offset/Shell using Thickness: 0.02mm and Direction: Centerline.
This should result in a solid.
Select the 8 edges that form the gap in the Trumpet, then copy (Ctrl-c) and paste (Ctrl-v) them and execute Edit/Join.
Then execute Construct/Loft using Loft Style: Normal and Profiles: Auto.
This should result in a solid filling the gap.
Select both solids and Boolean Union them together.
Here's the result:




Attachments:

  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:  Mike (MGG942)
6447.55 
Michael, I've being trying to use the idea of making a js file of the _FxGraph3D parameters but I'm having limited success.
Some work and some don't.

The following two work OK
Brian's leafsinh.js
moi.command.execCommand( 'FxGraph3D u;v;((exp(u) - exp((-1)*u))/2 + (exp(v) - exp((-1)*v))/2);-3.14159;3.14159;-3.14159;3.14159;15;15;0;0;0;UV' );
My MoebiusStripSolid.js
moi.command.execCommand( 'FxGraph3D cos(v)+u*cos(v/2)*cos(v);sin(v)+u*cos(v/2)*sin(v);u*sin(v/2);-0.4;0.4;0;6.20;15;15;1;1;1;UV' );

but this one (My TrumpetSolid.js) doesn't:
moi.command.execCommand( 'FxGraph3D cos(u)*sin(v);sin(u)*sin(v);cos(v)+log(tan(1/2*v));0;6.283;0.03;1.5;50;50;1;1;1;UV' );

For the life of me I can't see why.
When I try to run if from Max's Ext Scripts feature I get the following error:




  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
6447.56 In reply to 6447.55 
Hi Mike,

re:
> but this one (My TrumpetSolid.js) doesn't:
> moi.command.execCommand( 'FxGraph3D cos(u)*sin(v);sin(u)*sin(v);cos(v)+log(tan(1/2*v));0;6.283;0.03;1.5;50;50;1;1;1;UV' );

Can you please post the My TrumpetSolid.js file so I can test it over here and take a look?


> When I try to run if from Max's Ext Scripts feature I get the
> following error:

That error looks like it's trying to execute that string as direct script code rather than seeing it as a command and parameter for that command. That will happen if the command is not recognized. Do you possibly have some spaces in the front before FxGraph3D ?

- 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:  Mike (MGG942)
6447.57 In reply to 6447.56 
Thanks, Michael.

Don't think that I have spaces where they shouldn't be, but ...

Attached my two files,

The one that works, MoebiusStripSolid.js, and the one that doesn't TrumpetSolid.js

Note that neither have an underscore preceding FxGraph3D - you may need to add that for your set up.

  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:  bemfarmer
6447.58 
I did observe the error with Trumpet.js, but after spending an inordinate amount of time, I managed to
fix the problem. I'm using _ before the _Trumpet.js, and also _ before _FxGraph3D.

- Brian

Edit: It has been very confusing.
3rd party .js scripts without leading _ show up in Max's Ext.Scripts list at the tail end, after all the ones with leading _. (Which is alphabetical.)
The same script with a leading _ show up at the front side of the Ext.Scripts list, without the _.

I use _FxGraph3D. Some other people use FxGraph3D, without the leading _. (So a missing .js error can occur, due to alternate names, with/without leading _.

Also, a carriage return, or cr/lf, in the .js can cause the first "(" to not match up with the last ")", which also causes a parse error.

EDITED: 31 Jul 2017 by BEMFARMER

  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
6447.59 In reply to 6447.57 
Hi Mike, both those files seem to be working ok for me over here (after adding an _ before FxGraph3D).

Can you give me some more details like where you're placing those files and how you're triggering them to be called?

- 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:  Mike (MGG942)
6447.60 In reply to 6447.59 
Thanks Brian and Michael.

Now working OK.

Suspect that the problem was having more than one instance of Moi running.

However, before thinking of that I added the leading underscore to _FxGraph3D.js and _FxGraph3D.htm and altered my files to match which did not fix the problem.
After that I shut all instances down and then started one only.
Then the files worked.

Bit hard to believe that the underscores were the problem so I suspect that while doing this sort of stuff with more that one instance of Moi running is a no-no.
  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

 

 
Show messages:  1-20  21-40  41-60  61-80  81-91