Check out Febhouse | New extensions for Shadow Analysis in SketchUp Download

Subcategories

  • No decscription available

    20 Topics
    462 Posts
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Install gem with dependencies on SU2014+

    5
    0 Votes
    5 Posts
    869 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
    458 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
    517 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
    891 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
    2k 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
    659 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
    882 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
    11k 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
    1k 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
    507 Views
    S
    very much appreciated, thanks for the detailed response
  • Dialog box showing counter

    8
    0 Votes
    8 Posts
    1k 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
    452 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...
  • Sketchup internal matrix transformation error compensation ?

    4
    0 Votes
    4 Posts
    727 Views
    O
    I don't have any code right now, I will once I have access to it though, which should be in a couple of days. The general procedure works like this though. Before anything else, I store the initial orientation by making an axes type Transformation. Something like this if memory serves well : xaxis_ = cInst.transformation.xaxis yaxis_ = cInst.transformation.yaxis zaxis_ = cInst.transformation.zaxis @transform = Geom;;Transformation.axes(Geom;;Point3d.new(0,0,0),Geom;;Vector3d.new(xaxis_.x,xaxis_.y,xaxis_.z),Geom;;Vector3d.new(yaxis_.x,yaxis_.y,yaxis_.z),Geom;;Vector3d.new(zaxis_.x,zaxis_.y,zaxis_.z)) The translations to move to and from the origin are created using the center of the bounds of the component. The origin to object axes are also calculated with an axes type Transformation. I use the inverse to return from global to local. The rotation part of the external transformation is created from an array, with indices 3, 7, 11, 12, 13, 14 set to 0 and index 15 set to 1. Said array comes from extracting numbers from a string. I thought there might be some bug or some accuracy loss here, but it's a double to float conversion on mostly small numbers, and checking the orthogonality of the rotation component gives no error before the 12th digit. The translation part (which is global, not relative to the component, btw) is used to make a vector used to make a Transformation. I've had the skewing even when this was 0, though. And then it goes like this : -Store initial transformation. When transformation is received : -move to origin -switch from object to origin axes -Compensate the initial transformation if there is one. -Apply rotation -apply the inverse of the initial transformation -go to object axes -Apply translation (global) -Move back from the origin Granted, it's not the best workflow. However, given the accuracy I seem to have on the sole matrix that isn't created within SU, I don't understand how the skewing happens, particularly when multiplying all these external matrices together yields an error that is so tiny.
  • Any GOOD dxf writing guides? (Autodesk seems dead)

    4
    0 Votes
    4 Posts
    845 Views
    dereiD
    @tig said: Googling 'dxf reference guide' return lots of interesting hits - e.g. http://www.autodesk.com/techpubs/autocad/acadr14/dxf/dxf_reference.htm Also there are several RB file plugins in the PluginStore which do DXF import/export manipulation - so using those as 'cribs' would help too... So what more do you want ? Thanks for this... i did a lot of search, but I guess I used the wrong keywords ) never found this. Thanks a lot.
  • Load classification system via ruby code

    18
    0 Votes
    18 Posts
    3k Views
    tt_suT
    @blruuska said: Dan, Thanks for verifying. It is surprising that NotImplementedError wasn't raised, if that is the case here. Ackh! Yea, something is amiss here. Not sure if we intended to support enumeration type in the initial release of the API - but if that's the cause it should have been NotImplemented. However, I might confuse this with the "choice" type. Maybe something changed in the last moment. I need to investigate.
  • Adding two Point3d, is that impossible?

    11
    0 Votes
    11 Posts
    2k Views
    Dan RathbunD
    @dan rathbun said: @ziocleto said: The strong typization of Point3d and Vector3d is also very questionable as ... And this why the SketchUp API authors made both classes "compatible" with a basic 3 element array, ... OH.. also.. there is another way they could have gone for this particular method. And that is duck-typing the argument, instead of class-typing it. Ruby example (they are really implemented on the C-side): <span class="syntaxdefault">def </span><span class="syntaxkeyword">+(</span><span class="syntaxdefault">arg</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  raise</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">TypeError</span><span class="syntaxkeyword">,</span><span class="syntaxstring">"invalid&nbsp;argument&nbsp;type"</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">caller</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> unless<br />  </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">x</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">y</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">z</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||<br /></span><span class="syntaxdefault">  </span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> arg</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;[])</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> </span><span class="syntaxcomment"># be sure it has 3 members<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault">    arg</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">2</span><span class="syntaxkeyword">].</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(</span><span class="syntaxdefault">Numeric</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> rescue false </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxcomment"># rescue modifiers trap IndexError exceptions<br /><br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># the method body<br /><br /></span><span class="syntaxdefault">end</span> If you are only concerned with Ruby 2.0+, then you can use a refinement module to correct the method for you code only.
  • Deleting an Edge knowing 2 points

    4
    0 Votes
    4 Posts
    539 Views
    K
    Thanks TIG and Dan I applied the code to the Tails part of my Dovetail Tool and now the result is a part with tails that is still a solid. No left over edges or faces. The strange thing was that when selecting the component edges if you selected them clockwise (edge1 to edge2) the part was clean but selecting in a counter clockwise direction there were left over faces. Now thanks to your help edge selection direction works either way. Thanks Keith
  • Fails succeeds fails......

    6
    0 Votes
    6 Posts
    621 Views
    sdmitchS
    @tig said: I don't have time to dissect your code in detail... But it seems to me you are replicating my Latticeizer plugin ? Look at that... http://sketchucation.com/pluginstore?pln=Latticeizer You need to offset the perimeters of the edges' faces [which sometimes fails, just like native-offset - so it perhaps needs my Smart_Offset?] It's NOT easy... Don't waste your time dissecting it since this is a just for fun exercise. I have found a number of bugs but have a few more to go. I have no intention of publishing it since, as you say, there is Latticeizer and others already out there.
  • Return values from ruby system calls

    3
    0 Votes
    3 Posts
    697 Views
    Dan RathbunD
    SketchUp 2014 was bugged in this regard. The workaround was to pipe to a text file, I think. I think it was fixed in SketchUp 2015. I recall having written a patch script that overrode the Kernel.backquote method. (I have to have a look for it.)
  • Load a vismat / vray material into sketchup??

    2
    0 Votes
    2 Posts
    491 Views
    Dan RathbunD
    A good question for: http://forums.chaosgroup.com/

Advertisement