⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Access module variables from inside a module class

    2
    0 Votes
    2 Posts
    351 Views
    Dan RathbunD
    "Programming Ruby - The Pragmatic Programmer's Guide" explains it all.
  • Webdialog - getting started?

    21
    0 Votes
    21 Posts
    1k Views
    thomthomT
    I tried once more, and this time it's listed. (no idea why it wasn't earlier - but at least it's working now.) Very nice feature.
  • Importing don't have to bring inherit of lenz

    2
    0 Votes
    2 Posts
    299 Views
    kimpastroK
    well.. that's embarrassing... actually the "problem" is that i had overloaded "onElementAdded" method.. and put: @service.recent_inherit! entity now i send a new attribute, then it becomes: if entity.definition.get_attribute 'dynamic_attributes', 'imported_entity' @service.recent_inherit! entity end sorry about that and thanks for your time. cheers.
  • Custom tool creating instances of text labels

    5
    0 Votes
    5 Posts
    476 Views
    S
    @tig said: Here's how I would do it... Let's first assume that a component-instance has no label. The user clicks on it. It is confirmed as a component-instance. It is also checked for a special attribute, tid=instance.get_attribute("SensorNodeInfo", "tid", nil), in this case it returns nil as it has no label. unless tid > ### add_label_code > else > ### delete_label_code > end The 'add_label_code' will make the Text object, and give it a 'tid', a matching 'tid' will also be given to the picked instance... ` tid=Time.now.to_f+rand instance.set_attribute("SensorNodeInfo", "tid", tid) some code to add the Text object - referenced as 'label' label.set_attribute("SensorNodeInfo", "tid", tid)` Now the instance and its label are pair with a matching [unique] tid attribute. The 'delete_label_code' erases any related 'label', by matching its 'tid'. The 'label' Text object will have been previously given a unique 'tid' returned in the 'instance' match that was NOT nil, so you need to iterate the instances context to get possible candidates, labels_to_go=instance.parent.entities.grep(Sketcup::Text).select{|e| e.get_attribute("SensorNodeInfo", "tid", nil)==tid } then instance.parent.entities.erase_entities(labels_to_go) if labels_to_go[0] Thanks that's very helpful.
  • Ruby access to "hidden" v-ray materials

    2
    0 Votes
    2 Posts
    393 Views
    dkendigD
    those don't sound like issues that were in the latest service release. The V-Ray material information is stored in the material's attribute dictionary in xml format. Multi-Materials have the child material xml included with them.
  • I wish to hire a developer

    10
    0 Votes
    10 Posts
    871 Views
    dkendigD
    I know I'm late to the game, but I am just seeing this now. I am wrapping up development of another extension, and will be ready to take up my next project soon. Are you still looking for a developer to make this for you?
  • Need to hire developer for extension creation

    2
    0 Votes
    2 Posts
    452 Views
    dkendigD
    I'm wrapping up development on another plugin, and will be available for my next project soon. Are you still looking for a developer to help you create this?
  • Which folders does SU look for gems in?

    3
    0 Votes
    3 Posts
    676 Views
    S
    Thanks, I will test this and come back to post the results.
  • Ruby code for selecting Component Instances by name

    3
    0 Votes
    3 Posts
    782 Views
    M
    Many thanks TIG, your first code line does perfectly the job. In fact I have many instances of the same component, and each one is differentiated by a unique name. And just by removing s.clear I can make multiple selections, which is exactly what I intended to do. You made my day !!
  • Move a Transformation.rotation object to x, y and z position

    7
    0 Votes
    7 Posts
    620 Views
    kimpastroK
    @dan rathbun said: @kimpastro said: PS: don't know if i'm using the correct terms for elements like: model, entity, modules, etc. Sorry about that. Yes you are misusing the term module. In your examples, "loaded_module" is a "loaded_component_definition". module is a ruby keyword, and a block of code that forms a namespace. Thanks, I'll be careful next time. I'm confusing about module because we use the same term to determine the "master entity" of our projects to our clients.
  • Get X,Y,Z of active_model with Ruby

    5
    0 Votes
    5 Posts
    536 Views
    thomthomT
    @dan rathbun said: The origin of the active_model is [0,0,0], which is referenced as ORIGIN. If the model came from Google Earth, then the real world co-ordinates (in inches) will be in the GeoReference attribute dictionary. > mdl = Sketchup;;active_model > if mdl.georeferenced? && > !mdl.attribute_dictionary('GeoReference',false).nil? > [ > mdl.get_attribute('GeoReference', 'ModelTranslationX', 0.0), > mdl.get_attribute('GeoReference', 'ModelTranslationY', 0.0), > mdl.get_attribute('GeoReference', 'ModelTranslationZ', 0.0) > ] > else > ORIGIN.to_a > end > Or Model.point_to_utm http://www.sketchup.com/intl/en/developer/docs/ourdoc/model#point_to_utm
  • Move group to left corner of screen

    11
    0 Votes
    11 Posts
    832 Views
    S
    Wow! This is awesome! It works! Thanks a lot. I almost gave up! Good to know, that there are real experts in this forum who are willing to help. Thanks again.
  • Install gem with dependencies on SU2014+

    5
    0 Votes
    5 Posts
    730 Views
    S
    if anyone is interested I found a solution without editing any files, using the instance_variable_set methods. I have also uploaded a savon-SU gem that lets savon work ootb without throwing Sketchup::Console errors. Gem;;Platform.local.instance_variable_set(;@cpu,'x86') x86 Gem;;Platform.local.instance_variable_set(;@os,'mingw32') mingw32 Gem;;Platform.local #<Gem;;Platform;0x473bf20 @cpu="x86", @os="mingw32", @version=nil> Gem.install 'savon-SU' [#<Gem;;Specification;0x5448888 nori-2.6.0>, [#<Gem;;Specification;0x92b9a94 mini_portile-0.6.2>, #<Gem;;Specification;0x3bc3010 nokogiri-1.6.6.2-x86-mingw32>], #<Gem;;Specification;0x5a70410 wasabi-3.5.0>, #<Gem;;Specification;0x4685dfc builder-3.2.2>, #<Gem;;Specification;0x4fb40a4 gyoku-1.3.1>, #<Gem;;Specification;0x512df18 akami-1.3.1>, #<Gem;;Specification;0x3ce9f88 savon-SU-2.11.1>] require 'savon' true client = Savon.client(wsdl; "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl") #<Savon;;Client;0x279f5e8 @globals=#<Savon;;GlobalOptions;0x279f5a0 @option_type=;global, @options={;encoding=>"UTF-8", ;soap_version=>1, ;namespaces=>{}, ;log=>false, ;filters=>[], ;pretty_print_xml=>false, ;raise_errors=>true, ;strip_namespaces=>true, ;convert_response_tags_to=>#<Proc;0x279f3a8@C;/Users/Administrator/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-SU-2.11.1/lib/savon/options.rb;85 (lambda)>, ;convert_attributes_to=>#<Proc;0x279f348@C;/Users/Administrator/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Gems/gems/savon-SU-2.11.1/lib/savon/options.rb;86 (lambda)>, ;multipart=>false, ;adapter=>nil, ;use_wsa_headers=>false, ;no_message_tag=>false, ;follow_redirects=>false, ;unwrap=>false, ;host=>nil, ;wsdl=>"http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"}>, @wsdl=#<Wasabi;;Document;0x279e8b0 @document="http://www.w3schools.com/webservices/tempconvert.asmx?wsdl", @adapter=nil, @request=#<HTTPI;;Request;0x279e7c0 @follow_redirect=false>>>
  • References not behaving the same with string vs My_object

    3
    0 Votes
    3 Posts
    343 Views
    Dan RathbunD
    b='hop' is the same as: b=String::new('hop') The Ruby interpreter "reads" the literal string 'hop' and passes it to String::new "behind the curtain". = is the reference assignment operator. a="hip" means "the variable a shall reference the string object 'hip'." a=b means "the variable a shall reference the object that b is referencing."
  • I Need My VisMap!

    2
    0 Votes
    2 Posts
    396 Views
    WhyDiW
    Hello MartinRinehart, I take the opportunity of your thread to thank you for the Edges to Rubies you link in your signature. I found out your tutorial some month ago and pages 15 and 16 made me on the track of animation. Just what I needed to jump into and now I am developing my own code I have just named a class the same of your 'Transformable' in your honour. It's quit different from your but the name makes me remember your excellent tutorial. A thousand of thanks once more. Have a good day Sorry for the sidetrack. Second time today!
  • Mac users? I would like to know...

    9
    0 Votes
    9 Posts
    684 Views
    WhyDiW
    You're right about the sidetrack but it's just a small piece of distraction in a flow of coding! and we are not so far from Sketchup as you may see on that website I made for fun. I am a woodworker hobbyist and never get money from woodworking as I spent all my spare time making small furniture for myself - not enough free time for the others! Besides the ruby code I am writing these days is a continuation of the pictures on the website that I would like to animate. May it turn to any plugin ? wait and see... Have a good late afternoon
  • Ruby code to retrive sketchup version of a model

    18
    0 Votes
    18 Posts
    1k Views
    sdmitchS
    @jim said: "A".ord http://ruby-doc.org/core-2.0.0/String.html#method-i-ord Thanks for the info and especially the link.
  • Unglue multiple component instances

    3
    0 Votes
    3 Posts
    520 Views
    TIGT
    This code is not exhaustively tested, but it should give you enough ideas: model = Sketchup.active_model model.start_operation('Unglue', true) insts = model.selection.grep(Sketchup;;ComponentInstance) insts.each{|inst| inst.glued_to= nil } model.commit_operation One step undo-able... It un-glues all selected component-instances.
  • Apply images to terrain using ruby code

    6
    0 Votes
    6 Posts
    652 Views
    sdmitchS
    @sonjachr said: Many Thanks, this works, I really appreciate your help! I feel ashamed as I should have found the solution by myself. I will try to work harder on my Sketchup/Ruby knowledge, but I will never become an expert as you are. Great, glad I could help.
  • SU Ruby + XML

    48
    0 Votes
    48 Posts
    9k Views
    P
    Thanks for that guys. I managed to get a hack working by compiling/installing onto my standalone Ruby and copying the needed Nokogiri files and folders across.

Advertisement