Try the Ruby Depot: http://rhin.crai.archi.fr/rld/plugins_list_az.php
Just look for names and descriptions that imply a simple function.
-Kwok
Try the Ruby Depot: http://rhin.crai.archi.fr/rld/plugins_list_az.php
Just look for names and descriptions that imply a simple function.
-Kwok
You could get the vertices and get rid of the ones that form coliner edges. Make a new temporary face and go from there. Not pretty, but works. Maybe some has a better idea?
Oh, anyone got a simple/elequent way of getting the new vertices set, instead of what I did?
depth = 100
width = 100
model = Sketchup.active_model
entities = model.active_entities
ptsB = []
ptsB[0] = [200+0, 0, 0]
ptsB[1] = [200+width/2, 0, 0]
ptsB[2] = [200+width, 0, 0]
ptsB[3] = [200+width, depth, 0]
ptsB[4] = [200+0, depth, 0]
# Add the face to the entities in the model
face = entities.add_face ptsB
# Only keep non-colinear vertices
v = []
ver = face.outer_loop.vertices
n = (ver.length - 2)
v1 = ver[0].position
v2 = ver[1].position
u1 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!
u1_saved = u1
for i in 1..n do
v1 = ver[i].position
v2 = ver[i+1].position
u2 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!
if u1 != u2 then v.push ver[i] end
u1 = u2
end
v1 = ver[(ver.length - 1)].position
v2 = ver[0].position
u2 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!
if u1 != u2 then v.push ver[(ver.length - 1)] end
u1 = u2
if u1 != u1_saved then v.push ver[0] end
# make new face & loop
group = entities.add_group
face2 = group.entities.add_face v
loop = face2.outer_loop
status = loop.convex?
if (status)
UI.messagebox "Loop is Convex"
else
UI.messagebox "Loop is not Convex"
end
group.erase!
It's done like this:
model = Sketchup.active_model
ent = model.entities
sel = model.selection
ent.add_group(sel)
You don't want to write it out like this (long way). But this is what the above means(all one line):
Sketchup.active_model.entities.add_group(Sketchup.active_model.selection)
Are your paver shapes 2D? You should post a example sketchup file.
There are a few version numbers listed here:
http://www.filehippo.com/download_google_sketchup/
@heven7_floor said:
I just learning ruby code in SU, and found problem about draw a face onto existing face, I can identify any method in new face further , such as
<span class="syntaxdefault"><br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_face edges </span><span class="syntaxkeyword">----------></span><span class="syntaxdefault"> drawing it on existing face<br /><br />if not</span><span class="syntaxkeyword">(@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normal</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">samedirection</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">dir_vec</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">---------></span><span class="syntaxdefault"> get error </span><span class="syntaxstring">"undefine method 'normal' on nil "</span><span class="syntaxdefault"> <br /> puts </span><span class="syntaxstring">"change to initial direction"<br /></span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">reverse</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">end<br /></span>
any one please help me to explain why cause of this error , I don't understand why I can't undentify this method
thanks everyone in advance
I've run into this problem before. Sketchup won't let you make a internal face with the add_face method. For example, if you simply draw a rectangle inside the interior of a face. Delete the rectangle's face. Select the 4 edges. The following code using Jim Foltz's Ruby Web Console won't remake the face:
model = Sketchup.active_model
ent = model.entities
sel = model.selection
edges = sel.to_a
ent.add_face edges
You need to use the "find_faces" method, but that only returns the number of faces made. So you have to go through the trouble of finding the face it made. So rewriting your code, it would work this way:
#@cir_face = entities.add_face edges
edges[0].find_faces
faces = edges[0].faces
for i in (0..faces.length)
result = faces[i].classify_point(@f_point)
if result == Sketchup;;Face;;PointInside
@cir_face = faces[i]
break
end
end
I found this plugin very interesting. Here are some extra stuff, I cleared up at the beginning.
The "normal=@inputpoints[0].normal" was giving an error, like everyone pointed out. Looks like to me, its the same vector as "@dir_vec". So I set it equal to that vector:
#normal=@inputpoints[0].normal
@dir_vec = find_vec(@inputpoints[0],@inputpoints[1])
normal = @dir_vec
v_axes = @dir_vec.axes
And I found that your pushpull direction only went positive and not negative. So added these extra lines before your pushpull:
@pushpull_dir_vec = (@cpt_l-@f_point)
if !(@pushpull_dir_vec.samedirection? @dir_vec)
@cy_dist = -@cy_dist
end
status = @cir_face.pushpull @cy_dist,true
Here is the modified file:
circle_any_plan_&Pull(modified).rb
SU8 isn't default. It seem to go by which version was opened last. If v7 was opened last, then double clicking will open the file in v7.
The file structure is messed up in the zip file. You want this folder:
Flattery-1.0\Flattery\flattery and the flattery.rb file. And you can delete any .svn folder. There is a .svn folder in the final flattery folder. That's why you see those green and red circler revision icons.
-Kwok
@hellnbak said:
Is there a way, maybe a plugin, that will allow me to accurately rotate an object? What would be really good is a plugin similar to Nudge, that lets you use the arrow keys to move objects in small increments. I have searched extensively for something like this, have come up with zip, so any help will be much appreciated.
The rotix plugin does what you want. Works with groups & components.
http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=348
Did you figure it out? You just need to 1)put a blank filler in there to shift the original options down. And 2)rearrange your default values.
-Kwok
@diego-rodriguez said:
thanks.
you can add the option to remember the last setting used?
Done, new version 0.4 posted. 
Your welcome, DIEGO-RODRIGUEZ.
Everyone, I found a bug and have released a quick update. (from v0.3 to v0.3b ) Please, get the new version. The bug I fixed only has effect, if you chose the option not to use the input box.
-Kwok
Updated to v0.3. You now have the option to make components.
@kazmej said:
Kwok, implementing input box for push/pull value would be of great help 4 me.
Here you go. Get the new version here: http://forums.sketchucation.com/viewtopic.php?f=323&t=31279&p=279346
Updated to v0.2. Input box added.
What if I gave you a input box? Would that be useful? When the plugin is run, a input box opens up. You would hit "ok" to use the default thickness value. Or you could enter a new value.
-Kwok
@kazmej said:
Great job kyyu.
Is the a possibility to modify yours plugin that i'll be able to change the push/pull value in the Sketchup window?
Hi kazme,
I started a seperate thread for my plugin, if you want to check it out http://forums.sketchucation.com/viewtopic.php?t=31279. This question has been addressed there.
Basically, I plan to integrate this feature into my Pushpull & Group plugin. That plugin already has the ability to enter the pushpush value.
-Kwok
I don't normally use components, so don't even know how to code for it. If anyone wants to, feel free to modify this plugin for components. And I will post it above, as an alternative.
This was just a quick writeup, that I never intended to improve on. But what I plan to do is incorporate this plugin into my PushPull & Group Plugin, which already has most of the features requested by DIEGO-RODRIGUEZ. I did try my PushPull & Group Plugin, originally, but it could not handle faces that touched (adjacent). You guys can check out this video, of the current incarnation of the PushPull & Group Plugin: http://www.youtube.com/watch?v=lQgeMuFdpKU
-Kwok
This was a request for a plugin to automatically divide up a solid into individual solids. The use would be importing out game levels. I guess the game engine can't deal with holes, like a wall with a window opening. What this plugin does is not divide up a solid, but works on 2D divided faces and pushpulls them into individual grouped solids. The thickness value needs to be manually changed in the beginning of the ruby. Default is 0.25
Original request thread is here: http://forums.sketchucation.com/viewtopic.php?f=323&t=31112



[Original Version 0.1]
[Version 0.2]
I added an input box. Click ok to accept the default pushpull depth or enter new value. You can manual change two things in the code:
-change the value "thickness_default", to set the default thickness
-change to "use_input_box = false", if you don't want a input box

[version 0.3b]
The plugin now has the option of making components instead of groups. A component option has been added to the input box. Like the other values, you can change the default in the code. Just read the comments at the beginning of the code, for instructions.

Version 0.3b - added component option
[New version 0.4]
Now, saves changed input box values, for the entire sketchup session.