EggOvoid script
 1-9  10-25

Previous
Next
 From:  bemfarmer
10525.10 
A question for Michael, please.

Is there some way to create a dropdown list, somewhat like the Build menu for Lineweb, where each choice has an associated list of parameters,
which will populate the menu's below the dropdown list, (perhaps including sliders)? (Rather than having to manually enter the various default values.)

For example, choices in the Build menu are Hen or Duck, etc:

Hen, L = 62, B = 45.5, wShift = 5.7, D = 35.6.

Duck, L = 80, B = 50, wShift = 6, D = 34. (fictitious numbers)

Thank you,
Brian

(I tried some trial and error, without success.)
  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:  Barry-H
10525.11 In reply to 10525.10 
Hi Brian,
thanks for version 2
Is it possible you can update your previous Egghalf script to give tangency also.
If not no problem.
Cheers
Barry
  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
10525.12 In reply to 10525.9 
Brian,
You are the man!!!
  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
10525.13 In reply to 10525.11 
Hi Barry,

The EggOvoid2 script is a modified version of the EggOvoid script.
If only the top half of the full profile is desired, the user can just trim with a line along the x axis and delete the bottom half.
This could be added to the EggOvoid2 script as a checkbox and a bit of code...

- Brian
  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:  Barry-H
10525.14 In reply to 10525.13 
Hi Brian,
I'm referring to your old (10 years ago) EggHalf script not your current versions.
Cheers
Barry
  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
10525.15 In reply to 10525.14 
Hi Barry,
It must have been called something else. I dont see an "EggHalf" command from Brian.

Most likely it was called by its math name... Like "Enniper" or something. But i dont know which math curve equals an egg shape.

Do you have the old one available?
  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
10525.16 In reply to 10525.10 
Hi Brian,

re:
> Is there some way to create a dropdown list, somewhat like the Build menu for Lineweb, where each
> choice has an associated list of parameters,
> which will populate the menu's below the dropdown list, (perhaps including sliders)?
> (Rather than having to manually enter the various default values.)

Yes, for that use a <select> element, it's this part in LineWeb.htm :

code:
			<table>
				<tr>
					<td>Build:</td>
					<td>
						<select id="Build">
							<option value="lines">Lines</option>
							<option value="polylines">Polylines</option>
							<option value="curves">Curves</option>
							<option value="points">Points</option>
						</select>
					</td>
				</tr>
			</table>


If you give the select element an id value then when it is changed it will generate a UI event of that name in the script's event loop.

Or you can also put in script code in the .htm file using an onchange="" handler, something like:

code:
        <select id="Build" onchange="moi.ui.alert( 'changed' );">


Let me know if you're still stuck on this part.

- 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:  Barry-H
10525.17 In reply to 10525.15 
Hi Burr,
the link to the script discussion http://moi3d.com/forum/index.php?webtag=MOI&msg=4489.1
Attached the script.
Cheers
Barry
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:  bemfarmer
10525.18 In reply to 10525.17 
Hi Barry,

It should be possible to make the full profile, with the vertical tangents. I'll have a look later

- Brian
  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
10525.19 In reply to 10525.14 
Barry,
Here is a revised version of the 10 year old EggHalf script, renamed EggHalf2021.
It is a full closed profile, with two vertical tangents.

- Brian
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:  Barry-H
10525.20 In reply to 10525.19 
Hi Brian,
many thanks perfect.
It's a funny coincidence that I have been using the old script in the last few days and then you have produced a new one with more versatility (spooky).
There's a slight difference with the old script shape that I can't just replicate with the new script thus the request for the update.
Anyway again many thanks.
Barry
  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
10525.21 In reply to 10525.16 
Thank you Michael for your help.
The (auto) populate input fields from dropdown selection is still vary murky.
I looked up a bunch of posts about "populate input fields based upon dropdown html", but they are very difficult to follow.

<select id = "Build" onchange = "moi.ui.populateinputs('????');">
// where populateinputs is a javascript function in <script> section </script.>

The 4+ parameter values will be in a 2d array or list, indexed by the dropdown selection. Each row can be for one species of animal.
Look up the 4+ values for the selected animal. They vary for different animals.
aSlider.value = 1.2;
bSlider.value = 0.42;
etc.
Then set the different Sliders, which have binding to input fields,
(or to inputs aValue, bValue, etc.)

moi.ui.fireUIEvent("aSlider");
moi.ui.fireUIEvent("bSlider"); etc.
Or moi.ui.fireUIEvent('aValue")...

- Brian
(I've started a new script with some biological curves and structures...
It has 12 input fields plus some 3 more boxes, plus 10 buttons to become a dropdown select,
which will take up a lot of screen space...)

EDITED: 12 Dec 2021 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
10525.22 In reply to 10525.21 
Hi Brian, check out this modified version of your EggOvoid2 that has the type of dropdown set up like I think you're looking for.

In the .htm file I added a <select> element like this:

code:
			<table>
				<tr>
					<td>Preset:</td>
					<td>
						<select id="Preset">
							<option value="Chicken">Chicken</option>
							<option value="Roc">Roc</option>
							<option value="Alligator">Alligator</option>
						</select>
					</td>
				</tr>
			</table>	


Then the easiest way to make it do something will be to do it in the event loop in the .js file. If it were only going to be modifying UI values and not generating geometry then it could go in an onchange="" handler on the <select> tag. But you probably want it to call Update() in your .js file when it is changed and that will be easier to call from your .js file.

So inside _EggOvoid2.js I added a function UpdatePreset() that gets the current value of the dropdown and sets the values of the other controls.

Then in the main DoEggOvoid() function, it calls UpdatePreset() on startup so the controls will be initialized to the value of the Preset dropdown when the command first starts up and then had it look for the 'Preset' UI event that will be generated when the dropdown is changed here:
code:
		if ( dlg.event == 'LValue' || dlg.event == 'BValue' <....> || dlg.event == 'Preset')


And t hen just inside that:
code:
			if ( dlg.event == 'Preset' )
			{
				UpdatePreset();
			}


So when the dropdown with id="Preset" is changed, it will generate UI event and the script event loop will see it and call UpdatePreset() which sets the values of the other fields and then do an Update().

Let me know if this wasn't what you meant.

- 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:  bemfarmer
10525.23 In reply to 10525.22 
Thank you Michael,

Your Presets techniques are exactly what I need.

- Brian
  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
10525.24 
As requested by Barry-H:

A simple node assemblage, to create an egg outline.
This is just a collection of pre-existing nodes, with the trigonometry formulas which create the "egg shape", not a new .js node program.

U is run from minus PI to plus PI, for full egg.
Change minus PI to 0 for half egg, or trim full egg.
U num for the number of Points is set at 500.

- Brian

I noticed that the sliders do not have a reset to defaults.

Also, the curve always appears as style RED.
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
 From:  bemfarmer
10525.25 In reply to 10525.24 
Node documentation:
The Style color of the output object can be manually changed in the output node.

- Brian
  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-9  10-25