[REQUEST] Reverse Curve Direction (Start and End)
-
I was wondering if there is a standalone script that can reverse the "direction" (the start and end points) of an existing curve (similar to what Chris Fullmer's stringer curve has built in it).
It would come in a handy for a curve which needs to be reversed in order to match the "direction" of other curves.
-
I do not know of a script or plugin for this. I suppose that it would be a rather simple one.
Some of the members here may have already packaged it. Some others I suspect run SU with the ruby console open and do some things directly in there to affect what they are modeling, right ThomThom?, TIG?, Chris? -
There is also this script made by Thomthom: http://forums.sketchucation.com/download/file.php?id=29675
-
@pixero said:
There is also this script made by Thomthom: http://forums.sketchucation.com/download/file.php?id=29675
hm... I have no recollection of that. But it is signed by me... I'm too young for my mind to be slipping...
-
But it works
You might want to have it show up you list of scripts.
Thanks to the both of you for your scripts.
-
@thomthom said:
@pixero said:
There is also this script made by Thomthom: http://forums.sketchucation.com/download/file.php?id=29675
hm... I have no recollection of that. But it is signed by me... I'm too young for my mind to be slipping...
You posted the code in the forum thread and I put it together as a script.
(It was when I was experimenting with animation and curves.)Heres that thread: http://forums.sketchucation.com/viewtopic.php?f=81&p=164025
And the one where I posted the script: http://forums.sketchucation.com/viewtopic.php?f=180&t=20173
-
-
Gentlemen;
First, let me apologize to Fredo for not using his name in vain in my earlier reply. I think I mentioned the others because of recent ruby discussions I have seen. You all have my respect and admiration for your contributions and generosity.
I am happy to see I was wrong about reverse curve. -
@mitcorb said:
Gentlemen;
First, let me apologize to Fredo for not using his name in vain in my earlier reply. I think I mentioned the others because of recent ruby discussions I have seen. You all have my respect and admiration for your contributions and generosity.
I am happy to see I was wrong about reverse curve.Actually this function should be provided natively by SU, because the non-destructive solution can only be done based on the intimate structure of the model.
However, in most plugin, script writers would arrange to manage the right result whatever is the orientation of the curve or explicitly ask for begin and start regardless. So this is why the function was not absolutely needed before.Fredo
-
To reverse a curve non-destructively you could reform it 'in place', inside of a group.
Then you explode the original curve and immediately explode the group over the top of it... the new curve should them replace the old one - a curve exploded on top of edges seems to take precedence ?
-
@tig said:
To reverse a curve non-destructively you could reform it 'in place', inside of a group.
Then you explode the original curve and immediately explode the group over the top of it... the new curve should them replace the old one - a curve exploded on top of edges seems to take precedence ?
TIG,
Of course, that was my first idea. Unfortunately, SU does not replace edges from an explosion if it already exists, regardless of its orientation (and its property, soft, smooth or even hidden). The only thing I did not try is to see if by putting the edges on another layer and then explode the group.
I think we should all try to explore more the secrets of the Group explode operation to understand what it does and what it does not. On my side, I am still trying to find out what are the rules, why it can be slow or fast, etc....
Any lights on this would be useful
Fredo
-
You can of course get the hidden/soft/smooth/material/attributes[even] properties of each of the curve's edges and reapply them to the new edges in the reversed-curve, but in the correct order ?
Also if you explode a curve into its edges and then immediately explode a group containing an equivalent curve over the top of it, then that curve should replace those edges - I've used this successfully before in copying curves into groups etc - see EEbyVector ?
You could of course get 'all_connected geometry' that comes with the curve that you want reversing: recreating it all in a group with exactly the same properties [all as listed above and more] for each and every face, edge, line, curve, arc etc - EXCEPT for the curve you want to be reversed [which you make 'backwards'] - then you erase the original 'all_connected geometry' and then explode the group to replace it with no risk of 'clashes'...
However, this seems a lot to do do reverse a single curve !!!
-
@unknownuser said:
On my side, I am still trying to find out what are the rules, why it can be slow or fast, etc....
I think explode's speed will depend on the amount of geometry in the
Entities
collection the group/component/image is parent to. I think it relates to SU's slowness when adding geometry - gets slower the more entities in theEntities
collection you add to. -
@tig said:
Also if you explode a curve into its edges and then immediately explode a group containing an equivalent curve over the top of it, then that curve should replace those edges - I've used this successfully before in copying curves into groups etc - see EEbyVector ?
Yes it does, and this is how you do Welding.
The issue here is that it seems to keep the order of edges of the underlying edges to create the curve.
If you have time, give it a try, because I may be wrong and may have missed something.Fredo
-
Can't help but think: the user should not need to be concerned about the direction of a curve internally in SU. A script can easily rearrange the points internally.
-
@unknownuser said:
@tig said:
Also if you explode a curve into its edges and then immediately explode a group containing an equivalent curve over the top of it, then that curve should replace those edges - I've used this successfully before in copying curves into groups etc - see EEbyVector ?
Yes it does, and this is how you do Welding.
The issue here is that it seems to keep the order of edges of the underlying edges to create the curve.
If you have time, give it a try, because I may be wrong and may have missed something.
FredoI only really use it top replace edges with curves [a la weld where the 'direct' is unimportant] so I am unclear about this reported invulnerable vertex order - BUT if what you say is true and the original edge directions mess up the new curve's direction - can't we fix the original curve's exploded edges - by reversing each edge in turn - using add_line to re-draw it to make the start the end and vice versa ? Adding properties back to match ? Perhaps replacing the original edges first with the reversed edges and then those reversed edges with the reversed curve from the explosion of a group or two ?
-
I've written quite a few scripts where I have to sort the edge directions on my own. I always think its tedious. I would love it if SU allowed control of that through the Ruby API.
Chris
-
Here is one script ("Revert Curve" in the contextual menu).
Actually, there is no simple method, because changing the order of segments impacts the whole model structure for Sketchup.The attached script works fine on isolated curves.
On curves which are linked to faces and other edges or curve, the scripts has to erase the edges and reconstruct the faces. So you'll loose the material and other properties of these faces.EDIT 01 Feb 10: Attachment removed. See this post to get the plugin
http://forums.sketchucation.com/viewtopic.php?f=323&t=25710#p221170Fredo
PS:
-
The contextual menu item appears on a selection which contains one or more curves. Elements in the selection which are not curves are simply ignored.
-
You do NOT need LibFredo6.
-
Advertisement