ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Coordinates entered with InputBox

    5
    0 Votes
    5 Posts
    746 Views
    TIGT
    The last line newFace = selection[1].offset(-.25) is wrong! Try selection=model.selection newFace = selection[1].offset(-0.25) OR newFace = model.selection[1].offset(-0.25) The error is actually quite clear - it is telling you that 'selection' hasn't been defined ... Note it's best to use 0.25 NOT .25 Also how do you know what selection[1] is going to be ??? The API's offset() method is to offset a point3d by a vector3d + an optional length BUT there is an offset() method that can be added for faces, edges etc - BUT this is added by another script [by Rick Wilson?], but I don't see you 'requiring' it at the start of your code... Another tip: your input... defaults = [10,20,15] fixes the inputs as integers, if you want the input in inched use decimal numbers: defaults = [10.0, 20.0, 15.0] OR defaults = [10.inch, 20.inch, 15.inch]
  • Learning Ruby by Writing a Working Shell?

    9
    0 Votes
    9 Posts
    351 Views
    M
    Thanks Dan, coincidentally I just bought the pick axe. I'll be hammering though my way through that starting this weekend Sent from my Galaxy Nexus using Tapatalk
  • Transforming an array of points

    27
    0 Votes
    27 Posts
    557 Views
    jolranJ
    Yet Another test Don't know how reliable this test is but it appears face get appended in the same order as indexed in Polygonmesh. But Polygonmesh Count indexes starting at 1. Edit: Updated for adding c_point in polygonmesh index as well. But wonder how hidden edges affect the Index ordering.. The API says: @unknownuser said: The negative values should not be used as an index for point_at, take the positive value of the index value in the polygon array Perhaps hidden edges will only happend if mesh is constructed from a collection of Sketchup::Face's. Not relevant in this case. In that case maybe use index.abs or perhaps double negation: index = index<0 ? -index : index ents = Sketchup.active_model.active_entities def centerpoints(f) cx = (f[0].x + f[1].x + f[2].x + f[3].x)/4 cy = (f[0].y + f[1].y + f[2].y + f[3].y)/4 cz = (f[0].z + f[1].z + f[2].z + f[3].z)/4 return Geom;;Point3d.new(cx, cy, cz) end face1 = [ Geom;;Point3d.new(-5,-5,0), Geom;;Point3d.new(5,-5,0), Geom;;Point3d.new(5,5,0), Geom;;Point3d.new(-5,5,0) ] #create points for 4 faces faceHash = {} for i in (0...4) faceHash[i] = face1 face1 = face1.collect{|pt| pt.offset([20,0,0])} end #get refference to the center of "face"#3 Before appending to mesh. fC = centerpoints(faceHash[2]) ents.add_cpoint(fC) # Bit strange to loop hash this way, but they get ordered. msh = Geom;;PolygonMesh.new for n in (0...faceHash.length) msh.add_polygon(faceHash[n]) end #Test PolygonMesh index. How does hidden edges affect indexes for this ? # +1 index for polygons in Mesh. 2 c_points should get added at same spot meshface3 = msh.polygon_points_at(2+1) mc = centerpoints(meshface3) ents.add_cpoint(mc) group = ents.add_group group.entities.add_faces_from_mesh(msh) faces = group.entities.grep(Sketchup;;Face) #Red material to face 3 faces[2].material = "red"
  • Trim along a sandbox outline

    8
    0 Votes
    8 Posts
    592 Views
    BoxB
    I'll leave it at that, You are an advanced user and are obviously talking over my head.
  • Glued_to problem

    6
    0 Votes
    6 Posts
    320 Views
    tt_suT
    @existme said: Thanks so much It's a pity that you cannot glue to other component's faces via API. Indeed.
  • Co planar test

    27
    0 Votes
    27 Posts
    658 Views
    tt_suT
    With an Point3D version of the Oct tree I don't think the point comparison will be an issue any more. From the tests with vertices it scaled very well. Though I have some more ideas for the PolygonMesh class.
  • Thumbnail images as textures

    3
    0 Votes
    3 Posts
    227 Views
    A
    Thanks TIG.
  • Excluding from undo stack

    8
    0 Votes
    8 Posts
    309 Views
    Chris FullmerC
    If this system is entirely under your control, it would be easy to include all the geometry in the template model. Then when the user opens a new model, all those components are there without any possibility of being undone.
  • Store Patterned Data

    4
    0 Votes
    4 Posts
    229 Views
    pingpinkP
    Thank You So much,Tig. It works ! This is the idea to revise a model from architect by storing data at the first time. And later use to recheck data for tagging panels , and take the panel out in order that the facade engineer can do the life size panels to do mapping back on sub-dividing panels. The method I do : The subdividing faces are in the "Layer0". The patterns are in the Layer-"Patterns". So , they are not mix together in the same layer. For the shortage time to "delete coplanar edges or patterns" , I have to select edges by degrees and use your code to delete edges because the group edge and original edges are overlap that I have to delete original edges.So , it doesn't affect to bring tagging panels out , and I can recheck the patterned data to do retag panels. For the store patterned data , maybe it comprise of 3 functions : 1.Make edge group 2.Select Coplanar edges by degrees 3.Delete Coplanar edges selection
  • How to subclass a drawing element

    7
    0 Votes
    7 Posts
    402 Views
    Dan RathbunD
    @curator said: How can I add, sets say, an option like "change radius" or "change position". How do I add such an option only to "sphere", and not to "cube" or whatever. IF you use a group: UI.add_context_menu_handler {|menu| sel = Sketchup.active_model.selection if (not sel.empty?) && sel.single_object? && sel.first.is_a?(Sketchup;;Group) && sel.first.entities.parent.name == "Curator_Sphere" menu.add_item("Change Radius") { # do code here, or call a method like; Curator;;SphereWorx;;set_radius(sel.first) } end } IF you use a component instead: UI.add_context_menu_handler {|menu| sel = Sketchup.active_model.selection if (not sel.empty?) && sel.single_object? && sel.first.is_a?(Sketchup;;ComponentInstance) && sel.first.definition.name == "Curator_Sphere" menu.add_item("Change Radius") { # do code here, or call a method like; Curator;;SphereWorx;;set_radius(sel.first) } end }
  • Check if component exists before making it

    6
    0 Votes
    6 Posts
    346 Views
    TIGT
    At best it will find a match immediately 1/2000, at worst at go 2000/2000, on average at go 1000/2000. You can but test it and see... If you are adding all cube-instances in the same SketchUp session then why not make a @points array to push [ <<] all of the points you will use during the placements - these need to be as arrays so they are 'comparable' [use point.to_a] - points are comparable as == but include? is faster [most probably] with array comparisons ? Then... instead of finding all instances and comparing each 'instance.origin' to 'point' use: @points.include?(point.to_a) If the tested point is in the current list then it's taken and you skip the operation... Of course this doesn't work when instances have been erased or across SketchUp sessions
  • 2013 Unconference

    4
    0 Votes
    4 Posts
    272 Views
    tt_suT
    That will be released later as we get closer to releasing SketchUp 2014. We cannot release all the details publicly yet. We do have a great amount of recordings from the event.
  • Intersect_line_line question

    8
    0 Votes
    8 Posts
    314 Views
    s_k_e_t_c_h_yS
    Ah, Good point sl. I used a similar test for a line-plane intersection test.
  • From string to not a string

    9
    0 Votes
    9 Posts
    2k Views
    renderizaR
    Dan Rathbun I can't thank you enough you sir are brilliant!
  • Add_face gives error duplicate point in array

    16
    0 Votes
    16 Posts
    2k Views
    G
    In this example I increased the width of the stringer which results in a small triangle that you can see. Width is 304 mm. Where the sketchup error occurs the stringer width was 300 mm and the small triangle would not be visible at this zoom. What I have done for now, which works in these type of situations, is simply use a rescue block. I would normally consider this bad form as it can hide errors. This code only works on the last section when the stair has a heel and when we should have a triangle. The sketchup error was misleading and cost me a bit of time trying to track this down. begin # try to add the face ent.add_face( pts ) rescue puts( pts ) if ( debug_level > 0 ) end Any thoughts on this? [image: EYAC_collinearissue.JPG]
  • Variables - issue

    7
    0 Votes
    7 Posts
    306 Views
    artmusicstudioA
    @massimo said: Moved to developers forum. Hi Stan, would you mind to post such threads in developers section of the forum? Usually the newbie section is about SU's usage. Thanks. hi massimo, sorry, of course, didn't think about that , i'll be carefull in the future! stan
  • Soften-Edges using by ruby

    23
    0 Votes
    23 Posts
    4k Views
    TIGT
    The unexpected reversion of smoothed edges to solid is a known bug. Never save when in a edit session. Even an auto-save can trigger this, so never stay inside an edit session for longer than you need to...
  • Error in 'require' when running via Sketchup Bridge

    11
    0 Votes
    11 Posts
    933 Views
    P
    You're not going to believe me, but the puts wasn't working in the Ruby console for the past 2 days, but it just started working right now. Ghost in the machine I guess. I'm still getting a crash when I run the motion_sample.rb script I mentioned above. I think it might have to do with not being able to access the gems, although there is no error message. I'm investigating it and will get back with any questions. Thanks again!
  • Find the location of an object using Ruby

    20
    0 Votes
    20 Posts
    3k Views
    Dan RathbunD
    You should study the drawline.rb in the "Examples" sub-dir.
  • Detect update scene

    34
    0 Votes
    34 Posts
    4k Views
    TIGT

Advertisement