⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Problem when running Ruby Script from command line

    16
    0 Votes
    16 Posts
    4k Views
    TIGT
    @dan rathbun said: But I think his intention, is to do batch mode export to dae for a whole dir of skp files. So manual drag-n-drop is out of picture. He can use a shell script, no doubt,... ... but he could also do batch export, from within SU Ruby. You can drop multiple files onto a MAC command file or an 'applet', they are processed in turn, so the code could in turn make txt>>rb, open each SKP dropped; the rb file doing the SKP export, renaming itself txt and closing the SKP for each one. A much simpler way to export a folder of SKPs as .dae is to have a permanently loaded Ruby tool - I quickly wrote this as an example... http://forums.sketchucation.com/viewtopic.php?p=347277#p347277
  • Creating Components in Cab.rb

    26
    0 Votes
    26 Posts
    2k Views
    F
    I fixed a few things and realized I could call the instances I added to the global component by different names. It does run slow but I still haven't looked into optimising scripts so hopefully I can speed it up some though I don't mind it though, it's faster then creating a cabinet from scratch. Next on the to do/ to learn list is... Creating door and drawer fronts, creating drawers... shouldn't be a problem. Add a user defined number of shelves and insert them evenly spaced in the cabinet... I can do this manually/individually but the math involved in doing them automatically should be fun to figure out! Same thing for door and drawer fronts. And give a choice of creating an upper or lower cabinet since the building of these is different... I could use 2 different scripts like I did when moding the cab.rb script but I think it would be slick having it all-in-one. Add grain direction And eventually learning how to export the to a csv file so that I can populate an existing excel spreadsheet that I use... yes I know there are already some cut sheet/list scripts but this is more of a hobby/learning experience and I'd like to see what I can do. That should be it but I'm already happy with the progress I've made in just 3 or 4 days or learning this stuff. Again thanks for all the help I really appreciate your teach how to fish approach. Frank Test.rb
  • Some odd UV coordinates

    6
    0 Votes
    6 Posts
    239 Views
    thomthomT
    What are the UV coordinates you're getting that's so huge? I'm not sure if I've understood the issue. Is it with distorted textures?
  • Observers and undo question

    11
    0 Votes
    11 Posts
    456 Views
    thomthomT
    It's been a bit back and forth. I think it might be a combo - depending on what you do. Even they find the topic troublesome.
  • JQuery 1.5 Released

    3
    0 Votes
    3 Posts
    337 Views
    thomthomT
    @jim said: jQuery 1.6.2 released. Beware to read the change notes from 1.5.x to 1.6.x if you are upgrading.
  • Groups

    15
    0 Votes
    15 Posts
    370 Views
    TIGT
    Please don't reuse references or confuse them with methods etc - coding is complicated enough as it is I suggest you prefix new groups with a single meaningful letter, and suffix their entities with 'ents' So 'sgroup' > 'sents' and 'rgroup' > 'rents' etc. Then any other reference to 'step' or 'rail' will pass without incident... And you can easily spot the relationship of s=step and r=rail For example, I always call my temporary group 'tgroup' and its entities 'tents'.
  • Window handle from process

    37
    0 Votes
    37 Posts
    4k Views
    Dan RathbunD
    @tig said: Can't you can simply .... After having explained that using the title bar text is problematic (and subject to a bug while loading on Windows,) you still advise doing it? Again, the "Untilted" string is NOT the same on all language localizations, and some contain unicode characters. It's also possible that a SKP filename could contain unicode characters. Then you add two more situations that can "throw a shoe in the works". @unknownuser said: **, the designer and original implementor of C++":37wih2kn] "If you think it's simple, then you have misunderstood the problem" [floatr:37wih2kn]Did you really really say that? - Bjarne Stroustrup's C++ FAQ[/floatr:37wih2kn]
  • Requiring Socket on Mac crashes SU

    12
    0 Votes
    12 Posts
    1k Views
    Dan RathbunD
    @jhyuk said: Thanks a lot!!! I was able to change the symlinks and make it use 1.8.7 of the mac and copied the socket.bundle from that version and everything is working fine!! Now wouldn't it be nice if Sketchup had a button that you could press or a checkbox and it automatically used your full system Ruby install instead of that old v1.8.5 initial dead release ??
  • Draw on face

    4
    0 Votes
    4 Posts
    311 Views
    TIGT
    A line added in code will NOT split a face/edges unless you call some sort of entities.intersect_with() method... If the line is being added in in code you can check the picked points with a pick_helper to see if a face is picked under the point. Then you know the face is under a point, what the face is and then check that both points are on the same face ? http://code.google.com/apis/sketchup/docs/ourdoc/pickhelper.html#picked_face
  • NURBS plugin version 0.1

    28
    0 Votes
    28 Posts
    3k Views
    thomthomT
    @unknownuser said: How is thomthom doing the Bezier Surface? Ruby only? Currently in Ruby. But once I get things working and I can start profiling I'll probably move some stuff into a C Extension to do the main bulk of the bezier calculations etc.
  • SketchUp API Blog - Extensions

    7
    0 Votes
    7 Posts
    256 Views
    Dan RathbunD
    @aerilius said: Since I'm relatively new to ruby/plugins, I haven't yet dared to propose SketchupExtension in the Plugin-Installer-Tool discussion, I did. I asked Dana to have a look at my example, in another topic. @aerilius said: ...but also because I had the impression that in its current state, it is neither useful to users nor was I sure whether it's well designed (I can not really judge about that). Well, there is a difference between the Ruby functionality, and the Application UI functionality. Most users hate the Preferences dialog panel interface, for several reasons: Too small, only shows limited number in the list.* Panel cannot be sized.* The amount of attribute data displayed is fixed.* The list cannot be sorted (it's shown in load order.) Now... the Ruby functionality issues (or short-comings,) have prevented others from creating a better manager. The most glaring is the one Dana is working on, that is "one-click" installation and updating. This is also the number one complaint. @aerilius said: I think it's important for this discussion that we know if it's necessary to invent our own "standard" how to manage/disable plugins, It's more important that rubyists use a common class, that can be extended. For instance, we already have the issue where some plugins are Smustard Organizer compatible, but not SketchupExtension compatible, and visa versa. There are quite a few plugins (a most all of the Google authored plugins,) that already use SketchupExtension class instances. It does make sense not to orphan them. @aerilius said: or if SketchupExtension could once become a serious possibility (with some overhaul ). YES, and I've already done an overhaul, for my own use, and proved to myself that the class can be improved greatly (and the few current bugs fixed.) BUT.. I don't "own" the class, it's a standard API class, so I can't release the code. I have about $2500 labor into it, and was wondering, if anyone would be interested in donating toward it. If a "donation piggybank" reached that amount I'd release it. (I wonder if I can convince 100 people to donate $25, or 2500 to donate a buck?)
  • Unicode characters problem

    9
    0 Votes
    9 Posts
    369 Views
    voljankoV
    The problem was in the file,not in the code. I have saved the file in notepad as UFT-8 ,so I can "unpack" the character. I have tried to save the file in other formats (unicode,ANSI,unicode big endian) and is always giving me errors. So only UFT-8 is ok. Problem solved
  • Methods from Support files

    6
    0 Votes
    6 Posts
    264 Views
    TIGT
    Moved.
  • Ruby How to Select All Connected

    6
    0 Votes
    6 Posts
    2k Views
    TIGT
    I've moved this into the Developers' Forum as it's a general issue... You can get info about a curve. verts=curve.vertices returns the vertices, so if it's an arc etc then vf=verts.first and vl=verts.last are the end vertices. You can also get the start and end edges with ef=curve.first_edge and el=curve.last_edges You can get the edges that use any vertex with edges=vertex.edges so do that for vf and vl in turn - the array of edges will include the curve's edge so fedges=vf.edges; fedges.delete(ef); fedgeyouwant=fedges[0] ditto for vl/ el So you now have a way to find the two edges connected to ends of an curve. This assumes you have checked it's a curve, it's not looped etc; and if there isn't a connected edge you get 'nil'. or if there are more than connected edge then only the first one found is returned...
  • Web Dialog not firing a JavaScript function...

    14
    0 Votes
    14 Posts
    3k Views
    thomthomT
    Yes, one has to use a combo. If you look at the jQuery source you see the various methods they use to make it cross platform compatible. onReadyStateChange is used as a fallback for older IE versions. Mozilla, Opera, Webkit and newer IE use DOMContentLoaded. http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html
  • How can one calculate the smoothness of a bezier curve?

    11
    0 Votes
    11 Posts
    818 Views
    thomthomT
    @mac1 said: What criteria is used to determine smoothness is good enough?? RMS error or?? I was thinking that, from a user's point of view, one set a max angle. That the segments connecting each other would not exceed this max angle. Though, I am open to other definitions.
  • How to convert String to Path?

    10
    0 Votes
    10 Posts
    1k Views
    TIGT
    Thomthom you are right! Here is a fixed version if (pth=model.path).empty? ### do stuff with an alternative path else ### do stuff with 'pth' as it's not empty end
  • Bug Splat on erase!

    11
    0 Votes
    11 Posts
    595 Views
    voljankoV
    But also Dan's suggestions have positive results: In the activate method of the tool I have put the Sketchup.active_model.start_operation "myTool",true,true,false And I have put the Sketchup.active_model.abort_operation in the deactivate method of the tool and in the onPreSaveModel model observer. Now the group is disappear before saving the model. Thank you both.
  • Copy selection to new group?

    8
    0 Votes
    8 Posts
    2k Views
    TIGT
    Once you have the group you can get a reference to its definition defn=group.entities.parent It acts just like a normal component definition. So then use group2=model.entities.add_instance(defn, group.parent.transformation) [you must check it's not already in the model - if it is use group.transformation] then group.erase! So the collection is now called ' group2' and it is in model.entities...
  • Model observer problem

    3
    0 Votes
    3 Posts
    277 Views
    voljankoV
    Yes,I have thought about this right after sending my post,but want to test first. Now it is working ok and sorry for blaming observer for this problem. So this is the working code: class MyModelObserver < Sketchup;;ModelObserver def onPreSaveModel(model) UI.messagebox("onPreSaveModel; " + model.to_s) end end # Attach the observer. Sketchup.active_model.add_observer(MyModelObserver.new) class MyAppObserver < Sketchup;;AppObserver def onNewModel(model) UI.messagebox("onNewModel; " + model.to_s) Sketchup.active_model.add_observer(MyModelObserver.new) # Here is where one might attach other observers to the new model. end def onOpenModel(model) UI.messagebox("onOpenModel; " + model.to_s) Sketchup.active_model.add_observer(MyModelObserver.new) # Here is where one might attach other observers to the new model. end end # Attach the observer Sketchup.add_observer(MyAppObserver.new)

Advertisement