Parametric design in MoI?
 1-20  …  261-280  281-300  301-320  321-340  341-360  …  901-912

Previous
Next
 From:  BurrMan
7713.301 In reply to 7713.299 
Hey Max,
Here's the workflow error with the new styles element:



And then a quick error on the old "example" node:

  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:  Karsten (KMRQUS)
7713.302 In reply to 7713.301 
Hello Burrman,

please try to replace the marked area with shown line in nodes\basic.js - and give a feedback:-)


MoIOutput.prototype.updateObjects = function()
{
this.onClear();
var changeStyle = (this.properties.style[0] !== this.properties.style[1] && this.sIndex !== -1);
var inObj = this.getInputData(0, moi.geometryDatabase.createObjectList());
/////////////////////////////////////////////////
if(inObj!==null){for ( var i = 0; i<inObj.length; i++) this.tempobjects.addObject(changeStyle?inObj.item(i).clone():inObj.item(i));};
/////////////////////////////////////////////////
for ( var i=this.tempobjects.length; i>0; i-- ) this.tempobjects.item(i-1).setHitTest(0);
if (changeStyle) this.tempobjects.setProperty( 'styleIndex', this.sIndex);
moi.geometryDatabase.addObjects(this.tempobjects);
}

Have a nice day
Karsten
  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
7713.303 In reply to 7713.302 
That worked..... That eliminated the workflow error. Should ask Max to take a look.

Thanks Karsten.
  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
7713.304 In reply to 7713.303 
The example node error still exists in the construct.js file though.

I'm not going to be running all the created nodes because of such heavy development right now... Maybe Max should just keep "example" updated as needed with any major release... So I don't bug him about "an old node doesn't work...." stuff, when he already knows that, etc....
  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:  Karsten (KMRQUS)
7713.305 In reply to 7713.304 
Yes, I had also a look to that node, but I can't see any problems ... recreate 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:  Karsten (KMRQUS)
7713.306 In reply to 7713.304 
Hello Burrman,

I had another look into the v.0.4 code: The problem is quiet simple - loft node in V0.4 hasn't the feature for closed:-)

Have a nice day
Karsten
  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:  mkdm
7713.307 In reply to 7713.288 
Hi Max,

>> added Style property in the Output node

Thank you very much for this new feature!

It's exactly what i wanted.

P.S.

I noticed that the "Circle" node only generates one single circle whatever the input "pointarray" is.

So i wrote a little modified version called "Circles" that generates as many as the points contained in the array.

Furthermore, it is possible to limit the total number of generated circle, to a specified amount.

This amount can be >=1 AND <= the number of points contained in the array.

And is also possible to specify a step amount for the for-loop.

Here's the code :

code:
// Circles
function Circles()
{
	this.addInput("Center","pointarray");
	this.addInput("Radius","number");
	this.addInput("Elements","number");
	this.addInput("Step","number");
	this.addOutput("Out","objectlist");
	this.properties = { radius:1, elements:1, step:1 };
}

Circles.title = "Circles";
Circles.desc = "Circles";

Circles.prototype.onExecute = function()
{
	var output = moi.geometryDatabase.createObjectList();
	var centers = this.getInputData(0, new pointArray());
	var len = centers.getLength();
	this.properties.radius = this.getInputData(1, this.properties.radius);
	this.properties.elements = this.getInputData(2, this.properties.elements);
	if (this.properties.elements <= 0) this.properties.elements = 1;
	this.properties.step = this.getInputData(3, this.properties.step);
	if (this.properties.step <= 0) this.properties.step = 1;
	if (this.properties.step > len) this.properties.step = len;
	for (i = 0; i < len && i < this.properties.elements; i += this.properties.step) {
		var cir = factory( 'circle', true, centers.getFrame(i), null, this.properties.radius );
		output.addObject(cir.item(0));
	}	
	this.setOutputData(0, output);
}

LiteGraph.registerNodeType("Curves/Circles", Circles);



I've also done the "GetBBoxes" node that follow the same logic.

Here's the code :

code:
function GetBBoxes()
{
	this.addInput("In","objectlist");
	this.addInput("Elements","number");
	this.addInput("Step","number");	
	this.addOutput("Out","objectlist");
	this.addOutput("BBox Center","pointarray");
	this.properties = { elements:0, step:1 };

}

GetBBoxes.title = "BoundingBoxes";
GetBBoxes.desc = "Get BoundingBoxes";

GetBBoxes.prototype.onExecute = function()
{
	var input = this.getInputData(0, moi.geometryDatabase.createObjectList());
	var len = input.length;
	var bbox = new pointArray();
	
	this.properties.elements = this.getInputData(1, this.properties.elements);
	if ((this.properties.elements <= 0) || (this.properties.elements > len)) this.properties.elements = len;
	this.properties.step = this.getInputData(2, this.properties.step);
	if (this.properties.step <= 0) this.properties.step = 1;
	if (this.properties.step > len) this.properties.step = len;
		
	this.setOutputData(0, input);
	
	for (i = 0; i < len && i < this.properties.elements; i += this.properties.step) {
		bbox.pushPoint(input.item(i).getBoundingBox().center);
	}
	this.setOutputData(1, bbox);
}

LiteGraph.registerNodeType("Objects/GetBBoxes", GetBBoxes);


Have a nice day.

Marco.

EDITED: 13 May 2016 by MKDM

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:  mkdm
7713.308 In reply to 7713.285 
Hi Karsten,

and thank you for code.

I was examining the code but i must admit that i can't figure out what are the data types that it accepts in input.

code:
function PtArrayConcat()
{
	this.labels = "abcdef";
	this.size = [60,20];
	this.internal = {a:1, b:1};
	this.addOutput("Out", "pointarray");
}


Could you kindly explain ?

Anyway...thanks for your reply.

Nice day.

Marco.
  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:  Karsten (KMRQUS)
7713.309 In reply to 7713.308 
Hello Marco,
since yesterday the code is obsolete - Max has implemented the node also in his new version. Nevertheless, inputs are of type pointarray.

A nice weekend
Karsten
  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:  mkdm
7713.310 In reply to 7713.309 
Hi Karsten,

thanks anyway and, if you want, take a look at my "Circles" and "GetBBoxes" nodes
that i posted some minutes ago.

Ciao!

Marco.

P.S.

How funny can be playing with nodes !!

Here's my other 3 nodes that follow the same rules of my "Circles" and "GetBBoxes" :

code:
// Cones
function Cones()
{
	this.addInput("Center","pointarray");
	this.addInput("Radius","number");
	this.addInput("Height","number");
	this.addInput("Elements","number");
	this.addInput("Step","number");	
	this.addOutput("Out","objectlist");
	this.properties = { radius:1, height:1, elements:1, step:1 };
}

Cones.title = "Cones";
Cones.desc = "Cones";

Cones.prototype.onExecute = function()
{
	var output = moi.geometryDatabase.createObjectList();
	var centers = this.getInputData(0, new pointArray());
	this.properties.radius = this.getInputData(1, this.properties.radius);
	this.properties.height = this.getInputData(2, this.properties.height);
	var len = centers.getLength();
	this.properties.elements = this.getInputData(3, this.properties.elements);
	if ((this.properties.elements <= 0) || (this.properties.elements > len)) this.properties.elements = len;
	this.properties.step = this.getInputData(4, this.properties.step);
	if (this.properties.step <= 0) this.properties.step = 1;
	if (this.properties.step > len) this.properties.step = len;
	
	for (i = 0; i < len && i < this.properties.elements; i += this.properties.step) {
		var frame = centers.getFrame(i);
		var cone = factory('cone', true, frame, null, this.properties.radius, frame.evaluate(0,0,this.properties.height));
		output.addObject(cone.item(0));
	}
	
	this.setOutputData(0, output);
	
}

LiteGraph.registerNodeType("Solids/Cones", Cones);

// Cylinders
function Cylinders()
{
	this.addInput("Center","pointarray");
	this.addInput("Radius","number");
	this.addInput("Height","number");
	this.addInput("Elements","number");
	this.addInput("Step","number");	
	this.addOutput("Out","objectlist");
	this.properties = { radius:1, height:1, elements:1, step:1 };
}

Cylinders.title = "Cylinders";
Cylinders.desc = "Cylinders";

Cylinders.prototype.onExecute = function()
{
	var output = moi.geometryDatabase.createObjectList();
	var centers = this.getInputData(0, new pointArray());
	this.properties.radius = this.getInputData(1, this.properties.radius);
	this.properties.height = this.getInputData(2, this.properties.height);
	var len = centers.getLength();
	this.properties.elements = this.getInputData(3, this.properties.elements);
	if ((this.properties.elements <= 0) || (this.properties.elements > len)) this.properties.elements = len;
	this.properties.step = this.getInputData(4, this.properties.step);
	if (this.properties.step <= 0) this.properties.step = 1;
	if (this.properties.step > len) this.properties.step = len;
	
	for (i = 0; i < len && i < this.properties.elements; i += this.properties.step) {
		var frame = centers.getFrame(i);
		var cylF = moi.command.createFactory( 'cylinder' );
		cylF.setInput(0, true);
		cylF.setInput(1, frame);
		cylF.setInput(3, this.properties.radius);
		cylF.setInput(4, frame.evaluate(0,0,this.properties.height));
		var cyl = cylF.calculate();	
		output.addObject(cyl.item(0));
		cylF.cancel();
	}
	
	this.setOutputData(0, output);	
}

LiteGraph.registerNodeType("Solids/Cylinders", Cylinders);

// Spheres
function Spheres()
{
//	this.size = [60,20];
	this.addInput("Center","pointarray");
	this.addInput("Radius","number");
	this.addInput("Elements","number");
	this.addInput("Step","number");		
	this.addOutput("Out","objectlist");
	this.properties = { radius:1, height:1, elements:1, step:1 };
	
}

Spheres.title = "Spheres";
Spheres.desc = "Spheres";

Spheres.prototype.onExecute = function()
{
	var output = moi.geometryDatabase.createObjectList();
	var centers = this.getInputData(0, new pointArray());
	this.properties.radius = this.getInputData(1, this.properties.radius);
	var len = centers.getLength();
	this.properties.elements = this.getInputData(2, this.properties.elements);
	if ((this.properties.elements <= 0) || (this.properties.elements > len)) this.properties.elements = len;
	this.properties.step = this.getInputData(3, this.properties.step);
	if (this.properties.step <= 0) this.properties.step = 1;
	if (this.properties.step > len) this.properties.step = len;
	
	for (i = 0; i < len && i < this.properties.elements; i += this.properties.step) {
		var frame = centers.getFrame(i);
		var sphF = moi.command.createFactory( 'sphere' );
		sphF.setInput(0, true);
		sphF.setInput(1, frame);
		sphF.setInput(3, this.properties.radius);
		var sph = sphF.calculate();	
		output.addObject(sph.item(0));
		sphF.cancel();
	}
	
	this.setOutputData(0, output);
	
}

LiteGraph.registerNodeType("Solids/Spheres", Spheres);

EDITED: 13 May 2016 by MKDM

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:  Karsten (KMRQUS)
7713.311 In reply to 7713.310 
Hello Mauro,

Thanks for sharing ideas and nodes.
I like the idea more and more. Maybe it is also possible to use the mystic 7th value in the pointarry structure "scale" (radius * scale)?. I will definitively play with your nodes at the weekend :-)
Maybe you can make a Gif or some pictures, to give an impression of the functinallity!

Many thanks
Karsten
  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
7713.312 In reply to 7713.306 
""":V.0.4"""""

There's my problem. I wasn't looking for old stuff to work with the newer builds, i mistakenly thought of the "sample" node as a base for being sure builds work on a given system.
  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:  mkdm
7713.313 In reply to 7713.311 
Hi Karsten,

Thank you for your reply.

Only for info....my name's Marco, not Mauro.

Regarding my last nodes (Circles, GetBBoxes, Cones, Cylinders and Spheres), almost totally based on Max's original nodes,
i'll try to find time to publish some screen cap.
Meantime you could use the .node file that i posted in http://moi3d.com/forum/messages.php?webtag=MOI&msg=7713.310.

N.B. : All the nodes needs latest version of Max's node editor (0.65b).

In my garbage time i'm working on others ideas and little refinement for this fantastic plugin, that Max gave us.

1) Making nodes : Rectangles, Polygons, Stars

2) Creating a node that could do this thing :
a) Accept a Pointarray as input
b) Provide some criteria to define a sort of slicing rules to apply to the array.
c) Return a the resulting Pointarray or an "array of Pointarray"

For example, given a point array of 100 elements, define a criteria (using a math formula ?) to slice the original array
into 5 little arrays, each of which containing only certain elements of the original array.

3) Try to do a little refinement of the NodeEditor's UI, like illustraded in the attached pictures.


What do you think about these ideas ?

I also hope that Max will appreciate.

Ciao!

Marco.
Image Attachments:
Size: 291 KB, Downloaded: 61 times, Dimensions: 1637x1160px
Size: 1.3 MB, Downloaded: 61 times, Dimensions: 1917x1035px
  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:  Karsten (KMRQUS)
7713.314 In reply to 7713.313 
Hello Marco,

>>>>> Only for info....my name's Marco, not Mauro.
sorry for that! I know it :-)

I have made a quick test of your nodes and I like them :-) I hope that Max will integrate it. One thing I would prefer, is to collect new nodes first in a separate JS-File, so e.g. curvesMKDM.js with a separate Menu, so everybody can set apart the nodes from Maxs core development. And you can register them for tests very simple in the index.htm.
Updates and a discussion about is in my opinion also easier.
Anyway, the idea is good and we have some new nodes for playing:-)

Have a nice weekend
Karsten
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Message 7713.315 deleted 9 Aug 2020 by JFH

Previous
Next
 From:  mkdm
7713.316 In reply to 7713.314 
Hello Karsten,

Here's my new node : PatternSelectArray

It's an idea based on the Max's script PatternSelection.
(http://moi3d.com/forum/index.php?webtag=MOI&msg=6518.11)

code:
// PatternSelectArray
function PatternSelArray()
{
	this.addInput("In","pointarray");
	this.addOutput("Out","pointarray");
	this.addOutput("Elems","number");
	
	this.properties = { pattern:"+-", elems:0 };
}

PatternSelArray.title = "PatternSelArray";
PatternSelArray.desc = "PatternSelArray";

PatternSelArray.prototype.onExecute = function()
{
	var output = new pointArray();
	var source = this.getInputData(0, new pointArray());
	if (this.properties.pattern == '') this.properties.pattern = "+-";
	var len = source.getLength();
	
	var cn = 0;
	for (i = 0; i < len ; i++) {
		if ( this.properties.pattern[cn] === '1' || this.properties.pattern[cn] === '+') {
					
			var source_elem = source.getElement(i);
			
			output.push(source_elem.pt.x,
				source_elem.pt.y,
				source_elem.pt.z,
				source_elem.AngleX,
				source_elem.AngleY,
				source_elem.AngleZ,
				source_elem.Size);
		}
		cn = (cn < this.properties.pattern.length-1) ? cn+1 : 0;
	}
	
	this.properties.elems = output.getLength();
	
	this.setOutputData(0, output);
	this.setOutputData(1, output.getLength());
}

LiteGraph.registerNodeType("Arrays/PatternSelArray", PatternSelArray);


In order to use it, it's necessary to add this function definition to the "pointArray" section of the file litegraph.js

code:
pointArray.prototype.getElement = function(n)
{
	var shift = n*this.recordLength;
	
	var element = {"pt":this.getPoint(n),
		"AngleX":this.data[shift+3],
		"AngleY":this.data[shift+4],
		"AngleZ":this.data[shift+5],
		"Size":this.data[shift+6]};
		
	return element;
}


I hope it can be useful.

Ciao!

Marco.
Attachments:

Image Attachments:
Size: 114.2 KB, Downloaded: 40 times, Dimensions: 1520x822px
Size: 912 KB, Downloaded: 49 times, Dimensions: 1917x1035px
  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:  mkdm
7713.317 In reply to 7713.315 
Hi James,

>I wonder though whether it would be simpler to just add these to
>the CloneToArray node rather than to each of the curve/solid nodes,
>to achieve the same effect?

It could be a very good idea, but i don't know if the results would be the same.

That is, CloneToArray can generates Points, whilemy intention was to maintain the output as plain Pointarray.

But i'm sure that all this things could be intermixed.

I will make some test.

Anyway, thanks for your interesting suggestion.

Regards.

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

Message 7713.318 deleted 25 Apr 2019 by JFH

Previous
Next
 From:  Karsten (KMRQUS)
7713.319 In reply to 7713.317 
Hello Marco,

I don't have tested the pattern manipulation at the moment, but it's another very interesting idea. I'm not a "pattern man", but I can't avoid some ideas to the stuff (damn, I really wanted to do something different ;-): Is it possible to make a random option? Would it then be possible to create sinter materials, porous materials like cheese, particles ... with some clicks? Or is it possible to split in two,three, ... streams of pointarrays (random or structured) to create mosaics???

Anyway, let the ideas flow and share them:-)
Many thanks
Karsten
  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:  Karsten (KMRQUS)
7713.320 In reply to 7713.319 
@Marco,
in my opinion, the idea with the node overview panel can help a lot in the future, but think about scrollbars:-) Max should have a look!
  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  …  241-260  261-280  281-300  301-320  321-340  341-360  361-380  …  901-912