Show messages:
1-3
4-23
24-31
From: Zooen
Bonjour,
There is also this script that works well, even if you sometimes have to select edges several times. I use it every day. There, I selected one of the edges > F5 (my keyboard shortcut for the script (the whole loop is selected) > Fillet with Distance 2 / Circular / Library Solid++.
script :/* Extend Edge Selection */ var angle_degrees = 20; var cos_ang = Math.cos( angle_degrees * Math.PI / 180.0 ); var done_edges =[]; while ( 1 ) { var any_change = false; var edges = moi.geometryDatabase.getSelectedObjects().getEdges(); for ( var i = 0; i < edges.length; ++i ) { var e = edges.item(i); if ( done_edges[e.id] ) continue; done_edges[e.id] = true; var ptA = e.getStartPt(); var ptB = e.getEndPt(); var done_faces = []; var faces = e.getFacesOfEdge(); while ( faces.length> 0 ) { var f = faces.item( faces.length-1 ); faces.removeObjectAt( faces.length-1 ); if ( done_faces[f.id] ) continue; done_faces[f.id] = true; var edges2 = f.getEdges(); for ( var j = 0; j < edges2.length; ++j ) { var e2 = edges2.item(j); var ptC = e2.getStartPt(); var ptD = e2.getEndPt(); var tol = 1.0e-6; var A = false, B = false, C = false, D = false; if ( moi.vectorMath.distance( ptA, ptC ) < tol ) { A = true; C = true; } else if ( moi.vectorMath.distance( ptA, ptD ) < tol ) { A = true; D = true; } else if ( moi.vectorMath.distance( ptB, ptC ) < tol ) { B = true; C = true; } else if ( moi.vectorMath.distance( ptB, ptD ) < tol ) { B = true; D = true; } if ( A || B ) { var tan_e = e.evaluateTangent( A ? e.domainMin : e.domainMax ); var tan_e2 = e2.evaluateTangent( C ? e2.domainMin : e2.domainMax ); if ( Math.abs( (tan_e.x * tan_e2.x) + (tan_e.y * tan_e2.y) + (tan_e.z * tan_e2.z) )> cos_ang ) { if ( !e2.selected ) { e2.selected = true; any_change = true; } } var faces2 = e2.getFacesOfEdge(); for ( var k = 0; k < faces2.length; ++k ) { var f2 = faces2.item(k); if ( !done_faces[f2.id] ) faces.addObject( f2 ); } } } } } if ( !any_change ) break; }
Below is the script file "Extend_Edge_Selection.js to put in C:\Users\xxx\AppData\Roaming\Moi\scripts
Nota : I reloaded the file "Extend_Edge_Selection.js" today 12/08/2024, there was a typographical error, it missed the hyphens of the 8!
From: style7
wow, merci beaucoup!
I just tried it a bit, but it seems to work very well. Amazing!
From: Frenchy Pilou (PILOU)
<< to put in C:\Users\xxx\AppData\Roaming\Moi\scripts
Maybe better to put it in the normal folder commands for have it in the list of custom Ui ?
From: Psygorn (DRILLBIT)
Hi Pilou,
Could you show me how it works in one of your fancy gifs?
It seems I do not know how to work with it!
- Psygorn
Message 11506.8 was deleted
From: MO (MO_TE)
Hi Zooen
The code you posted has a little typo. I think you missed the last bracket at the end.
Here is the correct one:
code:
script :/* Extend edge selection */ var angle_degrees = 20; var cos_ang = Math.cos( angle_degrees * Math.PI / 180.0 ); var done_edges =[]; while ( 1 ) { var any_change = false; var edges = moi.geometryDatabase.getSelectedObjects().getEdges(); for ( var i = 0; i < edges.length; ++i ) { var e = edges.item(i); if ( done_edges[e.id] ) continue; done_edges[e.id] = true; var ptA = e.getStartPt(); var ptB = e.getEndPt(); var done_faces = []; var faces = e.getFacesOfEdge(); while ( faces.length> 0 ) { var f = faces.item( faces.length-1 ); faces.removeObjectAt( faces.length-1 ); if ( done_faces[f.id] ) continue; done_faces[f.id] = true; var edges2 = f.getEdges(); for ( var j = 0; j < edges2.length; ++j ) { var e2 = edges2.item(j); var ptC = e2.getStartPt(); var ptD = e2.getEndPt(); var tol = 1.0e-6; var A = false, B = false, C = false, D = false; if ( moi.vectorMath.distance( ptA, ptC ) < tol ) { A = true; C = true; } else if ( moi.vectorMath.distance( ptA, ptD ) < tol ) { A = true; D = true; } else if ( moi.vectorMath.distance( ptB, ptC ) < tol ) { B = true; C = true; } else if ( moi.vectorMath.distance( ptB, ptD ) < tol ) { B = true; D = true; } if ( A || B ) { var tan_e = e.evaluateTangent( A ? e.domainMin : e.domainMax ); var tan_e2 = e2.evaluateTangent( C ? e2.domainMin : e2.domainMax ); if ( Math.abs( (tan_e.x * tan_e2.x) + (tan_e.y * tan_e2.y) + (tan_e.z * tan_e2.z) )> cos_ang ) { if ( !e2.selected ) { e2.selected = true; any_change = true; } } var faces2 = e2.getFacesOfEdge(); for ( var k = 0; k < faces2.length; ++k ) { var f2 = faces2.item(k); if ( !done_faces[f2.id] ) faces.addObject( f2 ); } } } } } if ( !any_change ) break; }
PS:
One trick to select the edges faster for symmetrical objects is to use the "SelectSimilarLengthEdges" and "ExtentEdgeSelection" scripts together.
Here is a modified version of the "SelectSimilarLengthEdges" script I'm using. It can work on multiple selected edges.
code:
script:/* Select Similar Length Edges ( Multiple Selection ) */ try { var selectedEdges = moi.geometryDatabase.getSelectedObjects().getEdges(); for(p=0; p<selectedEdges.length; p++) { var edge = selectedEdges.item(p); var tollerance = 1000; var edgeL = edge.getLength(); var min = edgeL - edgeL/tollerance; var max = edgeL + edgeL/tollerance; var edges = edge.getParentBRep().getEdges(); for ( var i = 0; i < edges.length; ++i ) { var edgeLoopL = edges.item(i).getLength(); if ( edgeLoopL> min && edgeLoopL< max) edges.item(i).selected = true; } } }catch(e){}
From: Zooen
thank's
the last parenthesis at the end is added in the post.
The .js file was correct and works.
From: Frenchy Pilou (PILOU)
@ Psygorn Sorry for the delay!
Say I have clicked on my list of functions of the custom UI the Extend Edges Selection (Alphabetical sorted)
For me it's more easy than to learn hundred of shortcuts for my old brain!
So
I have just to click one edge then Right Click for recall the last function used (so here the Extend Edges Selection) ;)
with this box of filleted edges or any volumes for any edges selection wanted for any reason...
Remarks :) Same result if you click a liittle filleted edge!
you can select several edges in the same time!!! And on several VOLUMES in the same time!!!
PS The Loop selection don't work for this case!
script:/*Loop selection*/moi.geometryDatabase.selectLoop();
From: Psygorn (DRILLBIT)
Hi Pilou and Zooen,
I don't know why but for some reason this doesn't work for me! when I select an Edge and then run Extend Edges Selection command MOI says "Select Boundary Objects" and it does nothing!
@Pilou I remade your box with fillets on it, but was not able to reproduce what you are showing in your Gif.
- Psygorn
From: Frenchy Pilou (PILOU)
here the file that i used...
https://moiscript.weebly.com/uploads/3/9/3/8/3938813/extendedgeselection.js
And that is working like a charm!
As you see you can select on different volumes in the same time before call the function !
From: Zooen
Hi Psygorn,
I've created a short video in case
1-where the loop you want to select is executed all at once.
2-where the loop you want to select cannot be selected all at once.
The link
https://vimeo.com/997450276
The method is explained in post 11506.8
Can you make your file or object available so we can test it?
From: Psygorn (DRILLBIT)
Hi Zooen,
My model is a simple cube with fillets (take a look at the attached file)
The problem is that it seems the Extend Edge Selection doesn't work for me (Of course I have installed the js script) I did not made a short key for it though!
So, either I did not install the correct script or there is something I cannot figure it out at the moment!
- Psygorn
Attachments:
Extend Edge Selection_Not_Working_for_me.3dm
From: Frenchy Pilou (PILOU)
@ Psygorn
your cubic volume is woking fine for me!
So mystery is total! :)
PS i am on PC
From: Psygorn (DRILLBIT)
Hi Pilou,
so, the Js file is this right?
script :/* Étendre la sélection d'arêtes */ var angle_degrees = 20; var cos_ang = Math.cos( angle_degrees * Math.PI / 180.0 ); var done_edges =[]; while ( 1 ) { var any_change = false; var edges = moi.geometryDatabase.getSelectedObjects().getEdges(); for ( var i = 0; i < edges.length; ++i ) { var e = edges.item(i); if ( done_edges[e.id] ) continue; done_edges[e.id] = true; var ptA = e.getStartPt(); var ptB = e.getEndPt(); var done_faces = []; var faces = e.getFacesOfEdge(); while ( faces.length> 0 ) { var f = faces.item( faces.length-1 ); faces.removeObjectAt( faces.length-1 ); if ( done_faces[f.id] ) continue; done_faces[f.id] = true; var edges2 = f.getEdges(); for ( var j = 0; j < edges2.length; ++j ) { var e2 = edges2.item(j); var ptC = e2.getStartPt(); var ptD = e2.getEndPt(); var tol = 1.0e-6; var A = false, B = false, C = false, D = false; if ( moi.vectorMath.distance( ptA, ptC ) < tol ) { A = true; C = true; } else if ( moi.vectorMath.distance( ptA, ptD ) < tol ) { A = true; D = true; } else if ( moi.vectorMath.distance( ptB, ptC ) < tol ) { B = true; C = true; } else if ( moi.vectorMath.distance( ptB, ptD ) < tol ) { B = true; D = true; } if ( A || B ) { var tan_e = e.evaluateTangent( A ? e.domainMin : e.domainMax ); var tan_e2 = e2.evaluateTangent( C ? e2.domainMin : e2.domainMax ); if ( Math.abs( (tan_e.x * tan_e2.x) + (tan_e.y * tan_e2.y) + (tan_e.z * tan_e2.z) )> cos_ang ) { if ( !e2.selected ) { e2.selected = true; any_change = true; } } var faces2 = e2.getFacesOfEdge(); for ( var k = 0; k < faces2.length; ++k ) { var f2 = faces2.item(k); if ( !done_faces[f2.id] ) faces.addObject( f2 ); } } } } } if ( !any_change ) break; }
and I have installed it in commands folder here: C:\Users\Myname\AppData\Roaming\Moi\commands but there is not .htm file with it could that be the case?
- Psygorn
From: Frenchy Pilou (PILOU)
hml is when there are some menus! It's not the case here! :)
so no htm !
And yes i have the same than your folder!
From: MO (MO_TE)
Hi Psygorn
"Extend Edge Selection.js" has a couple space characters in its name.
When you run the script by typing its name in the input field or setting a shortcut key, it'll run the first piece of the name before the space character.
So, when you type "Extend Edge Selection", it will run the "Extend" command.
There is a simple solution for this:
Change the script name to something without spaces like:
ExtendEdgeSelection.js
or
Extend_Edge_Selection.js
From: Frenchy Pilou (PILOU)
Bravo ! Mystery maybe revealed! :)
But it was on my image list example! ;)
And inside my name file linked! ;)
And no problem if you use the Custom UI because it takes the name itself of the file! ;)
(made without spcace(s) ) Valid_Name, VALide_NAME, etc...
From: Zooen
Hi everyone,
My apologies. As I'm translating the names of the srcipts into French, I had to re-translate them into English to make them available and omit the dashes in the 8. I've corrected this in post 11506.4, I'm really sorry.
That said, the simplest method for this kind of script (if you use them very often) is to copy the "Extend_Edge_Selection.js" file into the C:\Users\xxx\AppData\Roaming\Moi\scripts folder. Then create a shortcut in Options>Shortcuts.
To avoid making a mistake with the name of the script, simply right-click on the file, select Rename from the drop-down menu, only the file name (without the extension) is selected, right-click again on the selection, select Copy from the drop-down menu. All you have to do is Paste into Options>Shortcuts in the command box opposite the shortcut you've created. The explanation may seem a bit long, but it's really quick.
What's more, with the Moi folder and its sub-folders, when a new version of MoI3D is released (perhaps also for beta versions?) we'll have all the scripts and so on directly available! Michael explained this, I don't know in which thread (if anyone can find it).
Message 11506.22 was deleted
From: Frenchy Pilou (PILOU)
you can also to copy the file's name input the numeric box after press Tab ! Then Enter...
the function will be applyed to an edges selection...
Here just before Enter (or even Right Click ! ) for valid the selection!
Next use only Rigth Click after another selection(s) for recall last function used! ;)
Show messages:
1-3
4-23
24-31