Replacing edges by components?
-
Is it possible to replace all basic edges in a selection (also see * and ** below) by instances of one single component that holds say multiple edges running in the same direction?
The replacements should respect the edge's directions and their individual lengths, to scale these instances accordingly.
So each edge becomes a component instance, local red along the replaced edge and component's box length equal to the replaced edge's length due to scaling that component per edge.(*) this might be the entire model's basic edges if nothing is selected
(**) The selection might also be inside a group or component when in editing context.
-
I wrote that very script for someone long long ago...
It's in the PluginStore:
http://sketchucation.com/pluginstore?pln=Lines2Components -
@tig said:
I wrote that very script for someone long long ago...
It's in the PluginStore........Thank you TIG, I'll see if it does what I am hoping for.
My ultimate goal is to be able to work on any selection of edges, not only the ones along current drawing axes but also the ones that have different values for all three coordinates at both ends, thus "true 3D". And thereby replace them all by 3D-Polyline with same lengths as the edges, hence the scaling of the component per instance.
Doing this manually, edge by edge is very laborious and silly if a plugin could do the job.
The 3D pPolyline is wrapped in the component with "definition scale 1:1" say 1000mmm in length.It would allow one to convert chunks of geometry into a visial reference without the ability, nor the hinder of inferencing to it.
Also see this thread about some options for using such a script:
http://sketchucation.com/forums/viewtopic.php?f=15%26amp;t=60655 -
For me this sounds like an extension of Chris Fullmers component stringer.
-
@cotty said:
For me this sounds like an extension of Chris Fullmers component stringer.
I believe that 'Component Stringer' uses a curve or a selection of edges without 'side roads'
I mean replacing geometry in in general, not necessarily along a string.
As an example: the drawer of a cabinet, a concrete floor slab, an entire roof structure.
3D Polylines display each in their own respective color while edges may be displayed 'all the same' (default black or changed to another overall color) at the same time. -
@tig said:
I wrote that very script for someone long long ago...
It's in the PluginStore:
http://sketchucation.com/pluginstore?pln=Lines2ComponentsTIG, the suggested plugin seems to only replace vertical edges. Not an entire structure's edges.
-
1 Profile builder
2 S4U to Components -
Could be as simple as this
mod = Sketchup.active_model ent = mod.active_entities sel = mod.selection sel.empty? ? ents=ent.to_a ; ents=sel.to_a cdn = mod.definitions.reject{|cd|(cd.group?||cd.image?)}.map{|cd|cd.name} inp = UI.inputbox(["Component;"],[cdn[0]],"Edge to Component") if inp #assume that edge vector matches components z axis cd=mod.definitions[inp[0]];cl=cd.bounds.max.z ents.grep(Sketchup;;Edge).each{|e| tr1=Geom;;Transformation.scaling(1,1,e.length/cl) p,v=e.line;tr2=Geom;;Transformation.new(p,v) ent.add_instance(cd,tr2*tr1) } end
-
@sdmitch said:
Could be as simple as this.....(code above)
Thank you Sam! Almost perfect.
I "baptized" the code samuel.rb and tried it (in Plugin folder) in SketchUp 8
It starts immediately with the template when opening SketchUp, .... then uses all the basic edges and also uses the first component in the 'In Model' component list. I can't seem to be able to use the plugin afterwards on a selection with the component of choice. Where do the plugin end up, like in which menu?
How do I get it to work when using the program, not only when I start SketchUp?
Is there any way to see the available 'In Model' component options to choose from?
Also there is no 'Undo' this way?Thank you for taking the time to look at it!
-
That code was just a "snippet", not packaged as a Tool, not added to any menu or toolbar, and not installed as an extension. It just runs once as SketchUp loads it and then goes away. Needs some work to fill it out.
-
@slbaumgartner said:
That code was just a "snippet", not packaged as a Tool, not added to any menu or toolbar, and not installed as an extension. It just runs once as SketchUp loads it and then goes away. Needs some work to fill it out.
I realized that it was too simple the way I did it. But that's what Sam wrote: "Could be as simple as this"
These things aren't simple to me though.I then used AlexSchreyer's ruby code editor within SketchUp 2015 as a workaround, at least for me.
Once the code snippet is loaded it does the job on demand. Also with a redo available. So you'll just have to peek in the 'In Model' component library prior to making your choice.
I would prefere a plugin over the snippet though. Some interesting things you can achive with it, as mentioned before. -
@sdmitch said:
.... a complete plugin created from the snippet I previously posted. I gave the file the same name as you did so that it will replace the one in the plugins folder.....
I really appreciate it Sam, I just replaced the snipped rb in SketchUp 8's Plugin folder and it works as expected. Now I'll need to find where to put it in/for SketchUp 2015 where I never seem to be able to find where *.rb files are stored. My memory vaguely tells me that it isn't in the SketchUp main folder and isn't called Plugin anymore.
-
For 2014 and I'm guessing the same for 2015, the plugins are located in
"\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins" under your User Account.
In 2014 at least, the plugins folder wasn't automatically created for some reason so i had to create it.
This was a rather "quick and dirty" exercise so there will be things that need to be added or changed.
-
Post deleted.
-
@sdmitch said:
For 2014 and I'm guessing the same for 2015, the plugins are located in
"\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins" under your User Account....
Thanks, yes I found it for SU2015.
Thanks again for the script, works great.
Here is a file with examples of the horrible 3D Polylines that I was trying to get into position.
These lines do have some advantages over edges in cases where inferencing is bothering you.
Some use of short straight "one segmented" colored 3D Polylines
-
@wo3dan said:
@sdmitch said:
For 2014 and I'm guessing the same for 2015, the plugins are located in
"\AppData\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins" under your User Account....
Thanks, yes I found it for SU2015.
Thanks again for the script, works great.
Here is a file with examples of the horrible 3D Polylines that I was trying to get into position.
These lines do have some advantages over edges in cases where inferencing is bothering you.Great, I'm glad that it proved to be of some use. The version you have doesn't remove the edge and always just gives you the the first component in the definitions list. I have sent you, by Personal Message, a version that truly replaces the edge with the component as well as giving you a drop down list of all the components in the model to choose from.
-
@sdmitch said:
Great, I'm glad that it proved to be of some use. The version you have doesn't remove the edge and always just gives you the the first component in the definitions list. I have sent you, by Personal Message, a version that truly replaces the edge with the component as well as giving you a drop down list of all the components in the model to choose from.
I'll try to look into it (the new version) tonight.
Great about the drop down list of components. My memory doesn't always recall which component to type in. Now I can create dashed lines and proper centerlines (and other types), sort of a library to choose from.I may have one or two other suggestions:-
- (not always) delete the replaces edges, a choice so to speak.
- a choice whether all replacing components should be grouped or not. All 3D Polyline components into one big group (as visual reference) or not, by choice of the user.
But I'll have to see /experiment with converting floor plans, symbols etc. to see what works best.
And then I still have to rely on what you are willing to add.If anyone has suggestions or hints, please post them here..
Thank you!
Advertisement