@urgen said:
Very good script
, but in SU5 unfortunately does not work ...
Can you try this version. It may be slower however!
@urgen said:
Very good script
, but in SU5 unfortunately does not work ...
Can you try this version. It may be slower however!
Serieux. Je suis a la recherche de cas ou il y a des problemes, pour savoir si on peut y faire quelque chose (de mon cote j'en ai quelques uns!). La methode que j'utilise est plutot empirique et en plus Sketchup est assez capricieux question creation et orientation de faces.
Si ca se passe pas trop mal, direction Ruby Depot, avec ta permission.
Juste pour ne pas oublier mes chers compatriotes, j'ai publie a l'essai un script de push pull jointif dans la section Ruby. La doc est pour l'instant en anglais.
http://www.sketchucation.com/forums/scf/viewtopic.php?f=57&t=4840&st=0&sk=t&sd=a
Une petite image pour illustrer l'intention:

@greyhead said:
Fantastic, enjoyed playing with it. Now I need to find a place to use it.
Thanks, Bob
PS Confirming bellwells image earlier, if you use Joint push-pull on non-contiguous faces of an polygon block then the side of the extrusions have a mix of angles, some are rectilinear (as from the Vector extrusion) some are aligned to the center of the block.
GreyHead
Thanks for appreciation.
Regarding the non contiguous faces, what you get is normal, because it depends on what you want to achieve. If you wish the borders to be perfectly normal, you must select NO in the option "Extent influence to non-selected neighbors", as explained in the Tutorial, in section 1.7, p.12. Otherwise, the macro compute the direction as if you would also extrude the neighbouring face. Unless I missed something....
Fredo
@daniel s said:
Edit:PS. Yes.. like bellwells says... there are hidden edges.. in a lot of cases don´t looks good... would be better to use "soften edges"
Actually, I did not know what was the most appropriate, hidden or soft, because there are advantages for both in any situation.
This is easy to fix (see attached file modified).
The question is whether I leave this as an option
Here is a very first version of what I call Joint Push Pull, which is a compromise between the classic Sketchup push pull along individual face normals and the Vector Push pull whihc keeps faces contiguous. In other terms, how to extrude faces along their normal, but generate a contiguous shape.
I guess the pictures attached are self-explanatory on what the script tries to achieve.
The ZIP archive should be unzipped in the Plugins folder and create in the Plugins folder:
There is a full doc in PDF, but it is too large to upload on this site. So I put it on the Google forum at http://groups.google.com/group/Ruby-API/browse_thread/thread/6ae80c5c688083fb.


to unzip in the Plugins folder - Update with smooth / soft edges
Coincidentally, I am currently working of this type of transformation which I call Non Uniform Linear Transformations (NULT), that are not native in Sketchup and end up recreating the drawing element.
I had completed the Plane Shear a while ago and need to finish the box shear.
Plane Shear is actually a transformation that would deform a rectangle into a parallelogram (in 3D space). Box shear, is a variant that allows non uniform scaling, typically transform a sphere into an egg. The question here is more how you specify what you want to do (my current idea is to do it via a transformation box)
Attached in the Plane Shear. You specify the plane, the reference direction and the angle. This is why the tool behaves pretty much as a Protractor tool. The tool applies to the Selection, but you can include what you want in it (groups, components, images, etc...) at any nested level. It preserves and deforms textures, as well as layers, attributes and properties. The only restrictions are:
Here is a basic example with a simple parallelepiped, but you can find a more complex situation at http://escargot-archi.eu/forum/viewtopic.php?t=2299 (a French site, but the image is self explanatory). For this kind of objects with 1,400 faces, it takes longer (the macro has a progress bar anyway).
There is no documentation at the moment, and this is why I do not publish it yet.
The Zip archive attached contains 5 files, all to go to the Plugins Directory:
Feedback welcome. Thanks
Fredo


@daniel s said:
The only problem is that every time i make a shear... the new object appears with hidden lines..
My mistake, as the macro is not fully tested. I reloaded the Zip file with correct behavior (I hope).
@daniel s said:
This plugin can be converted into a Lattice tool?
Yes. That's what I call the NULT Box, which is a downgraded version of lattice tools you can find in many 3D design tools (such as Blender), as the deformed box must keep its 6 faces planar. What I am working on is the GUI to specify the deformation. The transformation algorithm is exactly the same as for Plane shear (i.e. based on vertex non uniform translation).
Can someone check if Sketchup changed the version of the Ruby Interpreter (normally 1.8), because these messages maybe a sign of an evolution on the Ruby side.
Just use e.material, where e is an instance of a Group, as a Group is a Drawing Element.
This set the material for the group, used as a default by its elements if they do not have a material by themselves.
Sorry, I meant e.typename == 'Group'
If you prefer to use class id, then you must NOT enclose it between quotes
--> e.class == Sketchup::Group
You should check the type too (e.type == 'Group') as there may be other drawing elements with the same name
Then you need to add one line of code (in the When 'Face' section)to change the "soft" property of the edges bording the faces. This slows down the script a little bit, but I undersatnd why you need it.
def process_faces
model = Sketchup.active_model
model.start_operation "erase all faces"
process_faces_at_level model, {}
model.commit_operation
end
def process_faces_at_level(grp, hcomp)
list_entities = []
grp.entities.each do |entity|
case entity.typename
when 'Group'
process_faces_at_level entity, hcomp
when 'ComponentInstance'
edef = entity.definition
next if hcomp[edef.to_s]
hcomp[edef.to_s] = edef
process_faces_at_level edef, hcomp
when 'Face'
list_entities.push entity # or do what you want with the face
entity.edges.each { |e| e.soft = false } #Keep smooth edges
end
end
grp.entities.erase_entities list_entities
end
I am not clear on what you want.
Do you want to keep faces which have at least one edge smoothend or softened?
Or do you want to change the property of these edges, and still erase all faces?
If you need to earse all faces at all levels, then you must do it differently
Here is a code sample
def process_faces
model = Sketchup.active_model
model.start_operation "erase all faces"
process_faces_at_level model, {}
model.commit_operation
end
def process_faces_at_level(grp, hcomp)
list_entities = []
grp.entities.each do |entity|
case entity.typename
when 'Group'
process_faces_at_level entity, hcomp
when 'ComponentInstance'
edef = entity.definition
next if hcomp[edef.to_s]
hcomp[edef] = edef
process_faces_at_level edef, hcomp
when 'Face'
list_entities.push entity # store faces in the list
end
end
grp.entities.erase_entities list_entities #or do what you want with the faces
end
Note the specific treatment of component instances, as you must delete the face only once in its definition (which will propagate then to all instances)
Here is a simple code to select all faces at the model level
def select_all_faces
model = Sketchup.active_model
model.selection.clear #empty the current selection
model.entities.each { |e| model.selection.add e if e.typename == 'Face' }
end
Note that you cannot select entities at different levels, for instance in the first level of the model and at the same time within groups or component instances
@unknownuser said:
ps Fred, if you are saving 3D points as attributes - what happens when a user moves the spline?
Very interesting question, that I did not ask myself (actually, I just inherited the method from the previous bezier.rbscript by @Last). But magically, it seems to work fine, whether you move, scale or rotate the curve.
There must be a trick!
But this macro is full of surprise, for instance with an undocumented method "curve.move_vertices", which allows moving the vertices of a curve without having to recreate one.
I had the same problem with binary strings, because Sketchup stops the decoding at first \0 character.
But if you just wish to store an array of fixnum, why don't you store it 'naturally'. Sketchup entity attributes does it well, back and forth. I used this for my bezierspline.rb macro, where I do store arrays of 3D-points in this way.
Thanks very much Todd.
There are strange things on the Mac, like the fact that several keys (alphas and numpad) do nt seem to be trapped on the KeyDown, but only on the KeyUp event. This is also the case for Tab, Del and Backspace. This may be due to the VCB interference.
I'll see what I can do.
Thanks again
Fredo
Thanks.
For the time being, I will follow your advice (and also use File.join instead of building the string with /