MoI discussion forum
MoI discussion forum

Full Version: Node Wish List

Show messages:  1  …  302-321  322-341  342-361  362-381  382-401  402-421  422-425

From: WN
12 Jan   [#362] In reply to [#361]
Hi Barry.
In fact, there is no need for this node, since there are the necessary nodes for this.
I assume that you are aware of this. The node that I uploaded here is a small fix for
the 'Switch' node with a small addition from the 'Split' node that is in the 'logic' file.
I fixed the error and updated the file in the same message.

WN.
From: Barry-H
12 Jan   [#363] In reply to [#362]
Hi WN,
thank you for the node works fine.
Yes split node does the same (not used it before).
Many thanks
Barry
From: bemfarmer
12 Jan   [#364] In reply to [#362]
Hi WN,
It was a pleasure to review your RevSwitch file, to see the numerous corrections to the SwSPDT.js file that I did in an attempt to modify Max's Switch node.
Number of inputs and outputs, for each of the 3 datatypes was done.
(Code from Logic > Split node, I see.)
I broke the bezier color somehow.
I see that you modified the bezier, somehow, using the "same" code.
You introduced the dataNull.

Even though the RevSwitch function is already covered in the Logic > Split node, the Bezier indicator curve is nice to see.

- Brian
From: Barry-H
21 Jan   [#365]
Hi,
not sure if there is a answer for this
Shown is a photo showing a square that as one corner already filleted.
When object is selected and crvfilllet node used to fillet the remaining corners
it produces the result on the right or fails.
Any ideas ?
Cheers
Barry




Image Attachments:
Screenshot (776).png 


From: bemfarmer
21 Jan   [#366] In reply to [#365]
It looks like the node is trying to fillet points 4 and 5.

Is there a way to exclude the end points of the pre-existing fillet, from the new fillet?

- Brian

Can the initial object be posted?
Would a join help?

Is there some way to identify all of the characteristics of the points?
From: Barry-H
21 Jan   [#367] In reply to [#366]
Hi Brian,
the node needs away of knowing if the point is G0.
If the curve is rebuilt it works fine but you end up with a lot more control points.
Barry
From: bemfarmer
21 Jan   [#368] In reply to [#367]
Moi4 introduced a bunch of methods, tangents and derivatives...etc
From: pressure (PEER)
21 Jan   [#369] In reply to [#368]
Hi Brian,

Here's a function for checking if a pair of curves is G1.

- Peer

code:
// returns true if curve1 is tangent to curve2
function getCurvePairIsG1(curve1, curve2) {

    var curve1startPt = curve1.getStartPt();
    var curve1endPt = curve1.getEndPt();
    var curve1startTan = curve1.evaluateTangent(curve1.domainMin);
    var curve1endTan = curve1.evaluateTangent(curve1.domainMax);

    var curve2startPt = curve2.getStartPt();
    var curve2endPt = curve2.getEndPt();
    var curve2startTan = curve2.evaluateTangent(curve2.domainMin);
    var curve2endTan = curve2.evaluateTangent(curve2.domainMax);

    // flip one of the tangent vectors in the pair being compared for end-end and start-start cases
    var curve1startTanNeg = moi.vectorMath.createPoint(curve1startTan.x, curve1startTan.y, curve1startTan.z);
    curve1startTanNeg.scale(-1.0);

    var curve1endTanNeg = moi.vectorMath.createPoint(curve1endTan.x, curve1endTan.y, curve1endTan.z);
    curve1endTanNeg.scale(-1.0);

    var tol = moi.geometryDatabase.tolerance;

    // curve1 start curve2 end
    if (
        moi.vectorMath.distance(curve1startPt, curve2endPt) < tol &&
        moi.vectorMath.distance(curve1startTan, curve2endTan) < tol
    ) {
        return true;
    }

    // curve1 end curve2 start
    else if (
        moi.vectorMath.distance(curve1endPt, curve2startPt) < tol &&
        moi.vectorMath.distance(curve1endTan, curve2startTan) < tol
    ) {
        return true;
    }

    // curve1 start curve2 start
    else if (
        moi.vectorMath.distance(curve1startPt, curve2startPt) < tol &&
        moi.vectorMath.distance(curve1startTanNeg, curve2startTan) < tol
    ) {
        return true;
    }

    // curve2 end curve2 end
    else if (
        moi.vectorMath.distance(curve1endPt, curve2endPt) < tol &&
        moi.vectorMath.distance(curve1endTanNeg, curve2endTan) < tol
    ) {
        return true;
    }

    else {
        return false;
    }
}

From: pressure (PEER)
21 Jan   [#370] In reply to [#368]
Hi Brian,

Or for a planar joined curve you can use a G1 checker that's built into fillet factories. Search "GetCorners" in the API for an example of how to do that.

- Peer
From: MO (MO_TE)
21 Jan   [#371]
I tried to fillet a selected curve with code below.
It makes a list of "true" values for all corner points of the curve to fillet all of them.
Let's say I have a polyline consists of two segments and one corner point.
Logically, the corners List should be like this : {true}
This approach works on closed curves like a rectangle, but, fails on open curves. I need to add an extra "true" value to the list for open curves to work.
Also it fails on open and closed curves with an existing fillet or non "G0" continuity.
Like the one Barry showed in (9581.365)

Am I missing something?
code:
script:
var inputs = moi.geometryDatabase.getSelectedObjects().getStandaloneCurves();
var filletFacc = moi.command.createFactory('fillet');
var filletFacToGetCorners = moi.command.createFactory('fillet');
filletFacToGetCorners.setInput(0, inputs);
filletFacToGetCorners.generateVertices();
var corners = filletFacToGetCorners.getCreatedObjects();
filletFacToGetCorners.cancel();
var cornersList = moi.createList();
if(inputs.item(0).isClosed)
{
for ( var i = 0; i < corners.length; ++i ) {cornersList.add( true );};
}else
{
for ( var i = -1; i < corners.length; ++i ) {cornersList.add( true );};
}
filletFacc.setInput(0, inputs);
filletFacc.setInput(1, false);
filletFacc.setInput(2, cornersList);
filletFacc.setInput(3, 1);
filletFacc.setInput(4, 'Circular');
filletFacc.setInput(5, 1);
filletFacc.commit();
moi.log("inputs: "+inputs.length+"\n");
moi.log("Corners: "+corners.length+"\n");
moi.log("cornersList: \n");
for ( var i = 0; i < cornersList.length; ++i ) {moi.log(cornersList.item(i)+"\t")};
moi.log("\n");

From: bemfarmer
21 Jan   [#372] In reply to [#370]
Hi Peer,

Your code and reference look to be superb solutions.

At this time, I have too many projects, and too little time and energy, to work on this.

- Brian
( Not to mention limited ability :-)
From: pressure (PEER)
21 Jan   [#373] In reply to [#371]
Hi Mo,

Re: Am I missing something?

Is there a specific problem with the script, aside from the needed extensions that you list, or are you asking about the general approach?

One general potential problem is that the input currently accepts a list of curves, but it seems like the cornersList approach will only work for a single joined curve.

Also, filleting behaves differently if the input is 2 curves: it tries to mutually extend the curves and connect them with a fillet segment even though the input curves aren't G0.

- Peer
From: Barry-H
21 Jan   [#374]
Hi All,
Just to add to my previous post.
This issue does not happen if done manually with moi fillet tool.
So perhaps Michael can shed some light on the issue.
Anyway Brian’s crvFillet node woks fine with open / closed and 3D curves.

Brian
is it possible to comment out the select input ?
I tried but didn’t work.
Many thanks
Barry
From: MO (MO_TE)
21 Jan   [#375] In reply to [#373]
Hi Peer
>> One general potential problem is that the input currently accepts a list of curves, but it seems like the cornersList approach will only work for a single joined curve.

I wanted to keep it simple, this code is supposed to work just on a single curve.
I know I can fillet corner points of a curve, using a list of true/false values.
What I don't understand is why it won't work on for example an open curve with one corner point. (a V shape curve)
It actually needs a list of two (or more?) to work, while the generateVertices() method returns one vertex.
From: Michael Gibson
21 Jan   [#376] In reply to [#375]
Also since v4 there is this function on curve segments:

Added CurveSegment.getIsG1ToAdjacentSegment( 0 /* 0 for start, 1 for end */ );
- returns true if the next segment at the start or end is smooth to the current curve segment.

- Michael
From: MO (MO_TE)
22 Jan   [#377] In reply to [#376]
So, I found my mistake on fillet factory.
I thought the corners list's length should be equal to length of points generated by "generateVertices()" method.
But, It seems it should be equal to segments count.
That's why fillet node generates that curly effect in Barry's screenshots. It tries to fillet all corner points including the "G1" corner points

I just filtered the real "G0" points out of all corner points (segments start points).
code:
script:
var inputs = moi.geometryDatabase.getSelectedObjects().getStandaloneCurves();
var filletFacc = moi.command.createFactory('fillet');
var filletFacToGetCorners = moi.command.createFactory('fillet');
filletFacToGetCorners.setInput(0, inputs);
filletFacToGetCorners.generateVertices();
var corners = filletFacToGetCorners.getCreatedObjects();
var segments = inputs.item(0).getSubObjects();
var startPoints = [];
for(k=0; k<segments.length; k++)
{
	startPoints.push(segments.item(k).getStartPt());
}
filletFacToGetCorners.cancel();
var cornersList = moi.createList();
for ( var i = 0; i < startPoints.length; ++i ) 
{
	if(isG0Connection(startPoints[i],corners)){cornersList.add( true );}
	else{cornersList.add( false );}
}
filletFacc.setInput(0, inputs);
filletFacc.setInput(1, false);
filletFacc.setInput(2, cornersList);
filletFacc.setInput(3, 1);
filletFacc.setInput(4, 'Circular');
filletFacc.setInput(5, 1);
filletFacc.commit();
moi.log("inputs: "+inputs.length+"\n");
moi.log("Corners: "+corners.length+"\n");
moi.log("cornersList: \n");
for ( var i = 0; i < cornersList.length; ++i ) {moi.log(cornersList.item(i)+"\t")};
moi.log("\n");

function isG0Connection(point, G0Points)
{
	var isSamePoint = false;
	for(j=0; j<G0Points.length; j++)
	{
		if(point.x == G0Points.item(j).pt.x && point.y == G0Points.item(j).pt.y && point.z == G0Points.item(j).pt.z)
		{
			isSamePoint = true;
			break;
		}else{isSamePoint = false;}
	}
	return isSamePoint;
}

From: Barry-H
22 Jan   [#378] In reply to [#377]
Hi Mo,
can you make a node of your script please
I have very limited coding and will probably take forever.
Cheers
Barry
From: bemfarmer
22 Jan   [#379]
Link on (various) Fillet node(s), and Chamfer node(s), from 2 and 4 years ago, with good information from Michael:

https://moi3d.com/forum/index.php?webtag=MOI&msg=9666.1

(various Fillet and Chamfer nodes, are located in nodeeditor menus Curves2 and Construct2 menus. Some of them are probably not mature, fully functional nodes, and may need improvements from someone who knows what they are doing. And has understanding (?)) (Like grafting in MO-TE's code ?)

- Brian
From: Barry-H
22 Jan   [#380] In reply to [#379]
Hi Brian,
I've just removed them from my nodeditor as Mo added new versions of fillet and chamfer edges into the construct menu.
I think a new thread maybe worth starting to filter out some of duplicate nodes and add new developed nodes that people want to share.
Anyway many thanks for your input.
Cheers
Barry
From: bemfarmer
22 Jan   [#381] In reply to [#380]
Thankyou Barry.
It seems that my nodeeditor, for this pc especially, is not up to date, with some "obsolete"/ defective nodes.

- Brian

Show messages:  1  …  302-321  322-341  342-361  362-381  382-401  402-421  422-425