Divide_Cpoint.rb > Question for Didier Bur
-
Hi John,
@unknownuser said:
Would it be possible for this script to work on Polylines (arcs, circles, "welded" segments, etc.)
Why not ? I will look into it when I've some time.
@unknownuser said:
It looks like you are able to load the script without specifying the .rb name
No, it's a regular rb and if it is not in the Plugins folder it won't load.
Maybe you are talking about the fact that it "loads on demand" via the context menu when a valid selection is active ? -
"No, it's a regular rb and if it is not in the Plugins folder it won't load.
Maybe you are talking about the fact that it "loads on demand" via the context menu when a valid selection is active ?"Yes that must be it. I don't think I've ever investigated "load on demand" before.
a) So what code segment specifically tells SU to load this script?
b) And I take it that model.start_operation "Divide with construction points" defines what is shown in the menu, correct?Reason I ask is that I almost always change the menu name displayed by adding the script's file and author in brackets; for example, "Add Construction Points at Equal Intervals [Divide_CPoint.rb Didier Bur]. Even though my menus get rather large, its easy for me to identify which script is responsible for a particular menu item.
-
@unknownuser said:
what code segment specifically tells SU to load this script?
None. The script IS loaded from SU start, BUT the option appears in the context menu only under precise circumstances. Here the "divide_cpoint_valid_selection" function checks for a selection of 1 element of type "Edge".
@unknownuser said:
model.start_operation "Divide with construction points" defines what is shown in the menu, correct?
Nope. It's the label after the "Undo" in the Edit menu when you undo the operation. It tells SU to "memorize" all what's hapenning from that point until the "commit_operation" statement in the code, to further undo it globally if needed.
If you want to change the menu, go to the line
menu.add_item("Divide with construction points") { divide_cpoint } and edit between the quotes.
Regards, -
Thanks Didier, for taking the time to explain.
Ingenious how it works.
Regards, John
-
Works great, thanks.
You know what this leads to ... an option to explode the line/arc/circle at construction points. :}?
-
I also add a quarter of an hour "free time" to implement arcs and circles
Polylines are more tricky...
Download it here (same link than first version):
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633&p=32173#p32173 -
Do-able. Wait 5 mn
Edit: Explode working for lines, arcs, circles.
DL here 'same link than previous versions):
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633&p=32173#p32173 -
Didier, it kind of works.
Try the attached .skp; 3-segmented arc with points for 7 divisions.
Similar results with other arcs.
Some vertices without a point are divided and segments with points not being divided. Divisions that are defined by begining with a point, then a vertex, and end with a point are not equal in length to other divisions.
I just tried dividing a 3-segment arc into 11 divisions, the last division got deleted.
Also could cpoints be automatically group?
-
Updated.
http://www.sketchucation.com/forums/scf/viewtopic.php?f=153&t=5633
Should work OK now, BUT, it is unfortunately impossible to rebuild several curves between cpoints, because new segments to draw do not have the same lengthes within a sub-curve, so there's no way to retrieve the same curve than the original.
Regards, -
Merce, Didier.
Regards, John
Advertisement