ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Center Webdialog over Sketchup window

    4
    0 Votes
    4 Posts
    406 Views
    A
    You could theoretically read the screen dimensions using JavaScript, divide by two and subtract half of the dialog's width and height (you can read the inner width without window border using JavaScript). This is not recommended. If it is not essential to the functioning of you plugin, think again if you can get along without it. This causes your dialog to launch initially with different dimensions and then "jump". On a multi-monitor setup, you don't know whether the dialog is on the second monitor, and the above formula will give you coordinates for the first monitor. The dialog will jump to the first monitor, if it was launched (by registry preferences) on the second one.
  • View draw_lines bug

    7
    0 Votes
    7 Posts
    337 Views
    tt_suT
    @jolran said: Bottom line is the crash does not occour when using GL_LINES. So for me all is fine.. We'd really like to close down any causes of crashes. So please send us examples if you come across it.
  • Clone PolygonMesh

    23
    0 Votes
    23 Posts
    919 Views
    jolranJ
    Yes, Thanks. I used that and noticed some increase in performance. But I have kind of abandoned the PolygonMesh for now. At least during the previewing state. I experimented building my own meshclass with indexing of points. Instead of using PolygonMesh class as a Point container. Keep arrays of indexes and a Hash containing Points. And the Transformation only deals with the uniq points(Hash) then. Quite a lot of speed improvements! The advantage here is that I can reuse the objects somewhat, while I can't purge/clear(?) a PolygonMesh. So the GC should work a little less. I'm sure you guys have/are doing something similar or more advanced...
  • How to get current active axis?

    9
    0 Votes
    9 Posts
    494 Views
    tt_suT
    If you are in the root context then you can't. If the user has set a custom axis then there is no Ruby API method to obtain that. We have that logged as a feature request.
  • Fastest way to pass geometry to C Extension

    2
    0 Votes
    2 Posts
    180 Views
    tt_suT
    This sound like a bleeding edge optimization - where you need to profile to get your answer. In general, try to create as few Ruby objects as possible. Reuse data. Make use of bulk functions if possible.
  • Face.position_material SketchUp 2014 regression

    6
    0 Votes
    6 Posts
    497 Views
    tt_suT
    Thanks for reporting!
  • Followme in ruby not working as expected

    5
    0 Votes
    5 Posts
    446 Views
    J
    Hi Jim, Yes that's exactly what I wanted! Thank you. I've managed to get the code to draw the internal leaf as well. The only small problem now is I'm repeating myself in the code to get this result, which seems wrong. Is there anyway to get this result without have almost identical code running twice? Is there anyway to push two faces along the same path at the same time to give the result below? [image: 2014-06-23_1143.png] fyi this is how the code looks now. ` mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection wallGroup = ent.add_group #face points pt1 = [0,0,0] pt2 = [0,10,0] pt3 = [0,10,100] pt4 = [0,0,100] pt5 = [0,20,0] pt6 = [0,30,0] pt7 = [0,30,100] pt8 = [0,20,100] #line points lpt1 = [0,0,0] lpt2 = [150,0,0] lpt3 = [100,150,0] lpt4 = [0,100,0] path = [] face = ent.add_face pt1, pt2, pt3, pt4 path.push ent.add_line lpt1, lpt2 path.push ent.add_line lpt2, lpt3 path.push ent.add_line lpt3, lpt4 #line = ent.add_line lpt4, lpt1 status = face.followme path path = [] face= ent.add_face pt5, pt6, pt7, pt8 path.push ent.add_line lpt1, lpt2 path.push ent.add_line lpt2, lpt3 path.push ent.add_line lpt3, lpt4 status = face.followme path`
  • Text variable within a component?

    3
    0 Votes
    3 Posts
    189 Views
    artmusicstudioA
    hi dan, yes, i understand. i solved the problem with the following solution: the component-related text is placed outside and with every calculation per ruby it is selectively deleted and placed with new parameters at the new components position. seems to work well. stan
  • Retrieving bounding-box-value from a component instance ?

    3
    0 Votes
    3 Posts
    250 Views
    artmusicstudioA
    hi dan,i willk take a look at it. yes, i was searching in the forum in the mean time a lot and found a topic from 2009 whit good ideas. i can now identify the component instance and retrieve its own height, especially when it is nested. there are still some minor problems , but the ruby returns the informations needed now. thanx for helping me! stan
  • [solved] a small syntax problem

    4
    0 Votes
    4 Posts
    212 Views
    jolranJ
    No problem, glad to help if the tip worked.
  • [Code] Raytest Util

    23
    0 Votes
    23 Posts
    1k Views
    jiminy-billy-bobJ
    I've been playing with raytest a bit. From my understanding, it works like this: It checks ALL entities in the model root context If something is hit and it's a face/edge/etc, the raytest returns the entity If the hit entity is a group or component, it again checks ALL entities in that group/comp And so forth until it hits a face/edge/etc So if you have a lot of loose geometry in one of the hit contexts, it will be damn slow. But you can have a shitload of geometry in a group/comp not on the path of the ray, and you'll have decent performances. To check if a group/comp is hit, the raytest doesn't look at the geometry inside it, but rather at its bounding box. This is really important because you could have a lot of geometry away from the ray, but if the bounding box of the containing group is on the ray path, all of that geometry will be checked. Resulting in a slow raytest. I hope it's clear?
  • Sketchup_json gem for sketchupRuby API

    8
    0 Votes
    8 Posts
    1k Views
    Dan RathbunD
    @penpendrum said: I wrote this JSON file named input.json(I saved it inside the Tools folder): { "name";"Stephen" > "age"; 22 } Each sub-object in JSON must be separated with a comma ( , ). This is resulting in the unexpected token when parsing, because it sees the 2nd "age" token object while it is trying to isolate the 1st "name" token. It should be like: { "name" ; "Stephen" , # <-- comma seapartor "age" ; 22 } @penpendrum said: and I wrote this simple ruby code in the Tools folder name testing.rb: require 'rubygems' This is not needed (but harmless,) as the Ruby loader already loads RubyGems for Ruby 2.x
  • Inputbox chedking for cancel

    6
    0 Votes
    6 Posts
    479 Views
    Dan RathbunD
    Sketchup::active_model.select_tool(nil) if results == false But Jim is correct. Your boolean expression in the conditional if statement was incorrect.
  • Template loaded programmatically doesn't use style

    8
    0 Votes
    8 Posts
    445 Views
    T
    @dan rathbun said: OK. Wait. I just re-read what you wrote in the OP. It seems that you believed that Sketchup.template=() would load a template (dynamically) into the currently loaded model. It should not. It only should set up subsequent calls to open a NEW model, to use the specified template. Sketchup.send_action("newDocument:") or Sketchup.file_new() To load a style dynamically, load a .style file into the styles collection, and set it active by name or index. Good catch, but I didn't believe that, actually. I was calling file_new after setting the new template, but the template style background still wasn't being used when it was outside the default templates directory for some reason.
  • About NameError: wrong constant name

    4
    0 Votes
    4 Posts
    761 Views
    pingpinkP
    Thank you kindly, Trogluddite and Dan Rathbun I understand from reading your advice. Maybe, it's about class reference. These are the 3 ways I tried to do, I can't find the problem in a code yet. renderer = Kernel;;HTMLRendererP.new(result_hash['round_dimensions'].to_s == "on" ? true ; false) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}" Error : [ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xd9a0f28 Error: #<NameError: uninitialized constant Kernel::HTMLRendererP> C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:271:in block in add_callbacks' -e:1:in call' format_string = result_hash['format'].to_s renderer = @options['round_dimensions'] == 'on' ? true ; false eval("@options['format_string']").new( renderer ) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}" Error : [ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xded0ed8 **Error: #<NoMethodError: undefined method []' for nil:NilClass>** C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:275:in block in add_callbacks' -e:1:in `call' format_string = result_hash['format'].to_s renderer = Kernel.const_get(format_string).new(result_hash['round_dimensions'].to_s == "on" ? true ; false) puts "[ToolWebUIP.add_callbacks('handle_run')] renderer; #{renderer}" Error : [ToolWebUIP.add_callbacks('handle_run')] parts: #PartListP:0xddb8f00 Error: #<NameError: wrong constant name ["HTMLRendererP"]> C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:270:in const_get' C:/Users/Windows8/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/CurtainWall/Export/CW_Panel/gui.rb:270:in block in add_callbacks' -e:1:in `call'
  • Identifying a group

    6
    0 Votes
    6 Posts
    267 Views
    Dan RathbunD
    @artmusicstudio said: now, i think of finding a way to iterate depending of the Z height. is there a way to say directly in the iteration routine, start with lowest elements and go up to the highest? You make an array COPY of the collection, and the sort the array using the sort() method that is mixed in from the Enumerable module. Use the entity bounds() method to get a Geom::BoundingBox, and it's min() method to get a Geom::Point3d, and use it's z() method to get Length objects for the compare expression. def z_sort(coll) coll.to_a.sort {|a,b| a.bounds.min.z <=> b.bounds.min.z } end The trick is that the Comparable module must be mixed into the final object's class, on both sides of the compare <=> operator. This will always be true for Numeric and String subclasses. At the console: Length.ancestors %(darkgreen)[>> [Length, Float, JSON::Ext::Generator::GeneratorMethods::Float, Numeric, Comparable, Object, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]] Notice that Comparable is already mixed in ?
  • Average color pasted instead of texture. Why?

    4
    0 Votes
    4 Posts
    277 Views
    M
    Thanks Dan, That is exactly what I needed!
  • Notepad++ Collaboration

    18
    0 Votes
    18 Posts
    3k Views
    ashscottA
    Right, Have been playing with Teamviewer lately and you could basically collaborate on SU through that - the letdown is simply refresh rate from connection speeds - hence my comment about 1Gbps. A non-technical answer
  • Ui - messagebox definition

    3
    0 Votes
    3 Posts
    430 Views
    artmusicstudioA
    hi jim, thank you so much. it works. again a step closer to my ruby. stan
  • Changing the height of an edge (line)

    3
    0 Votes
    3 Posts
    221 Views
    artmusicstudioA
    hi tig, thanx for your explanation. too high for me at the moment ( after several trials), but i keep on learning. i solved the problem by calculation of the bottom side at 0 directly during the creation of the elements. but one day i will also understand the vertices transormation... regards stan

Advertisement