⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Beginning Ruby Tutorial

    16
    0 Szavazatok
    16 Hozzászólások
    938 Megtekintések
    Al HartA
    Chris, Thanks for making a ruby tutorial. Its always inspiring to look at someone else's code. Here is a version which use a hash instead of arrays to count all entities types; def count_entities model = Sketchup.active_model entities = model.entities count = {} # start a new hash entities.each do |e| stype = e.typename # start new count, or add 1 to existing count count[stype] = count[stype] ? count[stype] + 1 ; 1 end#loop sorted_keys = count.keys.sort sorted_keys.each do |key| printf("Total %-12s; %5d\n", key, count[key]) end#loop return nil end#def The weird line: count[stype] = count[stype] ? count[stype] + 1 : 1 would be easier to read as if (count[stype]) count[stype] = count[stype] + 1 else count[stype] = 1 end#if Keep up the good work
  • Test if a point is between 2 points?

    7
    0 Szavazatok
    7 Hozzászólások
    324 Megtekintések
    Chris FullmerC
    Very good to know. I've never tested anything like that, but I had a suspicion that it is true. Thanks for thiking of a method that uses SU native natives. Mine involved an algebraic formula being applied to each x,y,z coordinate, and if it got fed zero's would return NaN or Infinity, so I also had to teste everynumber before it passed through. In the end, it was quite long and I'm sure it was slow. I've got it set up where I could do a time test on it, Id be interested in seeing how much faster it is. Thanks Fredo! Chris
  • Lisp getpoint (not finished!)

    9
    0 Szavazatok
    9 Hozzászólások
    716 Megtekintések
    M
    I thought about that work-around method... I will use it until something better... Thank you Chris!
  • Method library?

    3
    0 Szavazatok
    3 Hozzászólások
    216 Megtekintések
    Chris FullmerC
    I was leanin towards something like that too at first, but then when I remembered the [code] tag, I started liking that idea. Maybe a sticky that has a link to all [code] threads so its easzy to sort through them. I'm thinking a single thread might tend to have a method, then some posts and discussions, then another method, and some discussion, and on an one. And it might make it tricky to dig through 20 pages, with only 1 method per page or something. That is my onoly concern with doing a single sticky thread. I have a bezier method I'd like to post. It requires as input: point1, handle1, point2, handle2, segment_count. Thats it, and it returns an arc object, or with a tweak it just returns an array of Point3d objects. So thats one method I'd like to post. Another is one that will take any series of connected edge segments and return them in an ordered array of points from the beginning to end. Chris
  • Using the Registry - Any Gotchas?

    5
    0 Szavazatok
    5 Hozzászólások
    336 Megtekintések
    J
    Thanks Adam, I was actually using the following: str.gsub!(/\\/, '\\\\') But I think simply changing it to '/' is a better solution, and will modify inputbox.rb I suppose it's possible for someone to want to use \ for some other string, though. I'm also escaping double-quotes: str.gsub!(/"/, '\"') Thanks.
  • Swap between 2 lines

    12
    0 Szavazatok
    12 Hozzászólások
    842 Megtekintések
    A
    No, but SWEEP 2 RAILS plugin will be very usefull for me!
  • Please install progressbar.rb

    11
    0 Szavazatok
    11 Hozzászólások
    7k Megtekintések
    Chris FullmerC
    Hehe, yeah my scripts aren't nice enough to check if you have progressbar first. They just crash. Chris
  • Loft questions

    26
    0 Szavazatok
    26 Hozzászólások
    4k Megtekintések
    pilouP
    @unknownuser said: in what program are you making those loft images? Moment of Inspiration (Moi) (just image colorisation is made in 2D prog for fun & variety I don't believe that SU can actually makes the same than Zbrush! There are 8 000 000 polys in normal way at level 7 of subdivision ! And it just one object! So when you will make many objects in the same time SU will freeze before
  • Checkerboard painting ? (or selection)

    18
    0 Szavazatok
    18 Hozzászólások
    3k Megtekintések
    A
    @unknownuser said: Not yet released but you can try this one lol, come on, it was already said that Random Painter isnt able to create a checkbox pattern, since, of course, its randon
  • Inside-out transformation?

    6
    0 Szavazatok
    6 Hozzászólások
    307 Megtekintések
    A
    I'm pretty sure the only way to effect an instance without effecting the definition is just the Transform. But that will just effect the instance as a whole. You can't reverse the faces (I don't think) without interacting with the actual geometry, thus changing the definition.
  • Make Curve...

    6
    0 Szavazatok
    6 Hozzászólások
    266 Megtekintések
    Chris FullmerC
    Ahh weld, of course, good thinking Remus. I was thinking of a script that would automatically find all arc and turn them into true SketchUp arcs. Overkill. Weld, of course, Chris
  • Strange error when setting component axes

    8
    0 Szavazatok
    8 Hozzászólások
    313 Megtekintések
    Chris FullmerC
    Yeah, I tried it and I also get the errors. I should have tried sooner. There are other tools that send errors to the ruby console too. Oops! So I would say it is woorking as expected. Chris
  • .get_front_UVQ return unexpected results

    5
    0 Szavazatok
    5 Hozzászólások
    340 Megtekintések
    thomthomT
    @adamb said: But perhaps a better way of doing this is to use a PolyMesh and just explicitly set UVs. Never used Polygon Meshes before. So to map existing faces I'd convert them to PolyMeshes?
  • Rotation interface with Ruby extension -- possible?

    6
    0 Szavazatok
    6 Hozzászólások
    389 Megtekintések
    A
    @chris fullmer said: I would imagine that it is possible. Are you interested in learning Ruby? This is a great place to learn it. Chris I did a little Ruby tutorial a few years ago, but it kept crashing on me at a certain point. So I guess I know the reeeaal basics. (ooooooor.. could quickly remember them if I seem em again!) If you could give me some ideas (like methods, functions, etc.) of how I can make this thing work with a Ruby plugin, that'd be great.
  • Control Projected Textures via the API?

    2
    0 Szavazatok
    2 Hozzászólások
    238 Megtekintések
    T
    Google seems to be deaf to our requests. There is no built-in method for recognising if a face has a projected texture or not. It can be done through writing a texture to a Texturewriter of especially created temporary face with no distortion and then writing a texture of a face being examined. If the number of textures in TW increases it means the face has a photomatched texture. I have seen a texturewritter2 in the SU SDK, but it is not reflected in Ruby. I haven't tried to control a position of a projected texture, but I am afraid it can be pretty hard. Mostly because we have no sample code that would show how to do basic modification. Tomasz
  • Su slow to open

    12
    0 Szavazatok
    12 Hozzászólások
    614 Megtekintések
    R
    You should be ok as long as you dont add all of them
  • Observer Usage

    4
    0 Szavazatok
    4 Hozzászólások
    224 Megtekintések
    Chris FullmerC
    Hanks, lots of us are going through it. There is a thread at the top of this forum called API typos and something or another. If you have suggestions for the API, put it in that thread. The Google guys who write the API and SketchUp Ruby watch that thread and incorporate the suggestions and typos that are posted there. If it was confusing to you, it probably will be for someone else! Chris
  • It is about installing plug-in

    6
    0 Szavazatok
    6 Hozzászólások
    223 Megtekintések
    Chris FullmerC
    Well, to give credit where credit is due, Great job Gaieus! and a big thank you! Chris
  • Edges problem

    6
    0 Szavazatok
    6 Hozzászólások
    299 Megtekintések
    J
    Is there maybe a way to divide an object into triangles? because the add_face instruction can draw traingles.. is there a function for this? thanks
  • Can something cancel observer events?

    8
    0 Szavazatok
    8 Hozzászólások
    411 Megtekintések
    thomthomT
    I was going to look into the Transaction events. I've been avoiding them so far due to the warming in the docs. And you answered a question I had actually; "can you do stuff in onTransactionCommit?" Another thing I tried was to wrap the transformation change into a transparent start_operation. Tried start_operation 'TTDC - Change', true, false, true and start_operation 'TTDC - Change', true, true, false and start_operation 'TTDC - Change', true, true, true in hopes that would prevent the cancellation of events. But no luck there.

Advertisement