[Request]Radial lines 2D, 3D
-
If not yet exist
Radial lines from a same point with a measure given or not
For avoid to come back at the start point!
(difficulty is avoid also faces creation (option Y/N)
Will be nice in the 2D Tools set by TIG
-
### (c) TIG 2010 ### 'radiallines' for Pilou ### select one cpoint and some edges/faces ### type radialllines in the Ruby Console. ### it adds clines from the cpoint to every selected vertex ### and central text for the distance. def radiallines() model=Sketchup.active_model ss=model.selection sa=ss.to_a cp=nil vs=[] sa.each{|e| cp=e if e.class==Sketchup;;ConstructionPoint e.vertices.each{|v|vs << v if not vs.include?(v)} if e.class==Sketchup;;Face if e.class==Sketchup;;Edge vs << e.start if not vs.include?(e.start) vs << e.end if not vs.include?(e.end) end#if } if not cp UI.messagebox("Selection must contain a Cpoint!") return nil end#if if not vs[0] UI.messagebox("Selection must contain a Vertex!") return nil end#if model.start_operation("Radial Lines") ### ss.clear layer1=model.layers.add("RADL-LINE") layer1.visible=true layer2=model.layers.add("RADL-LINE-TEXT") layer2.visible=true ents=model.active_entities base=cp.position cb=ents.add_cpoint(base) cb.layer=layer1 points=[] vs.each{|v|points << v.position} points.each{|p| pc=ents.add_cpoint(p) pc.layer=layer1 cl=ents.add_cline(base,p) cl.layer=layer1 dis=base.distance(p) mid=base.offset(base.vector_to(p), dis/2) text=dis.to_l.to_s txt=ents.add_text(text,mid,[0,0,0]) txt.layer=layer2 txt.leader_type=0 txt.arrow_type=0 txt.display_leader=false } ### model.commit_operation end ###
It adds clines BUT you can change 'add_cline' to 'add_line' to make 'Lines'...
You can also NOT change the lines/text layers by ### out those lines... -
If you want to add lines to any points within a range of max/min distances then that's different...
-
Hi TIG
Could you please turn this into a proper plugin file that would appear in the plugins menu.
I have saved the code to an .rb file in notepad but i can't find it in sketchup or load it from the console...This could help a lot with urban analysis but also in creating a series of guidelines from say a column head out to a series of points on a roof to create a wireframe of a roof structure which could then be converted into actual stuctural elements using say profile builder or otherwise. An option to leave the text off in the latter case would be good too!
Thanks
Dave
-
I'll issue it as a script...
@Pilou - the current text needs to go into a file calledradiallines.rb
in thePlugins
folder,
Currently to run it you typeradiallines
in the Ruby Console.
A 'cpoint
' is a Guide [Construction] Point - and a 'cline
' is a Guide [Construction] Line. -
Oh Speedy reply
Just some precision and questions
I suppose I must save the text code above as radiallines.rb for use it?
It's a "standalone RB"?
for the moment I obtain thatError; #<NameError; (eval);27; undefined local variable or method `radiallines' for main;Object>
What is exactly a "Cpoint" it's given by the Tape measure tool or the Protractor tool or... I have a little problem of memory on this
It's a "Guide Point"? (so a tool's bar of Didier Bur have that) -
Ok that is that I had presummed, but there is always the error message above
I select a Cpoint, and some faces, segments
then call the plug by the ruby console but error message above persists -
Its working on my side (via the console)... I had to change the cline to a line so that i could 'trace' them into structural entities... profile builder didn't recognise the cline...
Is either cline or line an option that can be built in?
Dave
-
Here's the new 'tool' that does what you want... http://forums.sketchucation.com/viewtopic.php?p=273614#p273614
-
Never works for me with the console but now with the new ruby that works like a charm
Advertisement