ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Ruby access to "hidden" v-ray materials

    2
    0 Votes
    2 Posts
    356 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
    748 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
    420 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
    623 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
    739 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
    540 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
    495 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
    651 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
    667 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
    306 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
    292 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
    638 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
    475 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
    586 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
    8k 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.
  • SU ruby questions part2

    8
    0 Votes
    8 Posts
    977 Views
    Dan RathbunD
    The last error is the result of the quirky implementation of Sketchup::Console class. (It is not a subclass of IO, but should have been.) Try some other way of testing your results. UI.messagebox or a webdialog.
  • Plugin recommended practices

    3
    0 Votes
    3 Posts
    336 Views
    S
    very much appreciated, thanks for the detailed response
  • Dialog box showing counter

    8
    0 Votes
    8 Posts
    782 Views
    D
    @sawdust_online said: Nevertheless I would have liked to save that bunch of files without blocking SU, webdialog box or not. what type of files are you saving? images, components? I think you can you the same approach as the two geometry making versions I posted... @unknownuser said: the following code seems to do the job! what's your take about it ? may it lead to crash ? for a mac it would be better if you used RUBY_PLATFORM =~ /(darwin)/ ? @dlg.show_modal() ; @dlg.show() bring_to_front doesn't achieve the same thing unless it was show_modal before the any focus change... I don't see why you need the timer, any short wait will happen anyway while the file is being written... BTW. sleep(0.25) will work the same as, but looks more like ruby than the fractional floats to me... john
  • Place a shape at regular intervals between two lines

    4
    0 Votes
    4 Posts
    335 Views
    TIGT
    Read up: http://www.sketchup.com/intl/en/developer/docs/classes.php When you add an instance you apply an initial transformation, but you can do more transforming later... A group is a special kind of component. For now let's assume a component existe. So let's assume you have a component-definition containing your 'box' with a reference to it called ' compodef'. Let's assume the references: model = Sketchup_active_model ents = model.active_entities Let's also deal with just one curve, for now... Let's assume you have a reference to just one of the edges that form it, called ' edge'. Let's also assume you'll place instances at its nodes - i.e. the edges' 'end' points. curve = edge.curve vertices = curve.vertices points = [] vertices.each{|v| points << v.position } now you have an array of the points defining the curve. points.each{|point| tran = Geom::Transformation.new(point) instance = ents.add_instance{ compodef, tran } } now you have an instance of the component 'box' located at every node point of the curve... This is a simplified explanation... At least should get you started... If you want to 'swivel' each box to span between the nodes in one curve and the equivalent node in a second curve, then you need to assemble two arrays of points - says points1 and points2 You iterate thus: ` points1.each_with_index{|point1, i| tranp = Geom::Transformation.new(point1) instance = ents.add_instance{ compodef, tranp } length = instance.bounds.length now get the second point point2 = points2[i] dist = point1.distance(point2) scale the box scalex = dist / length trans = Geom::Transformation.scaling(point1, scalex, 1.0, 1.0) instance.transform!(trans) rotate the box vec = point1.vector_to(point2) angle = X_AXIS.angle_between(vec) axis = X_AXIS.cross(vec) ### might be reversed - check ? trana = Geom::Transformation.rotation(point1, axis, angle) instance.transform!(trana) }` this is untested but should give you some ideas... It places the instance scales it so it'll stretch between the two points and the rotates the box so it spans between the two points. Obviously you need to do more work - like making the box component, checking the curve points for 'direction' and count-match etc... Good luck...

Advertisement