🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download
  • Basic question - groups as array ?

    5
    0 評價
    5 貼文
    334 瀏覽
    artmusicstudioA
    hi, thank you all, i tried to put my groups in the suggested ways into a loop, but i always get errors. with '@@groups' i would reach all grups, wouldn't i ? i will try to describe the whole problem: i have a defined amount of groups with one basic construction point (thanx dan), the amount changes by user input, so it must be variable, so there may be 2 or 20 @group_handlauf_mitte - groups. @group_handlauf_mitte1 @group_handlauf_mitte2 @group_handlauf_mitte3 @group_handlauf_mitte4 and so on i cannot find out, how can i access those 'group_handlauf_mitte ' groups in a loop to be able to select a group by @group_handlauf_mitte[index].entities. (my index here ist PODESTNR) i also tried to create the group name as a string-combination within a loop for step 1..20 a = "group" + step.tp_s.name a.name = a end but that's obviously not working , too. at the moment i have to define like this: if @podestnr == 1 entities = @group_handlauf_mitte1.entities new_line = entities.add_line rl13, rl14 entities = @group_handlauf_mitte1.entities elsif @podestnr == 2 entities = @group_handlauf_mitte2.entities new_line = entities.add_line rl13, rl14 entities = @group_handlauf_mitte2.entities elsif @podestnr == 3 entities = @group_handlauf_mitte3.entities new_line = entities.add_line rl13, rl14 entities = @group_handlauf_mitte3.entities elsif @podestnr == 4 entities = @group_handlauf_mitte4.entities new_line = entities.add_line rl13, rl14 entities = @group_handlauf_mitte4.entities end instead of this i would like to make a loop in which STEP decides, which grop's entities will become ENTITIES, but only for those groups, not all groups i have. hopefully i can once understand the syntax for group selection by index, because i could then make the ruby-code many times shorter. in this loop i need the griup name 1,2,3,4 to become dependent from the index MTH model = Sketchup.active_model y1 = 0 - @run ## the overall variables come from earlier code !!! y2 = 0 y3 = @run z = @rise pf = [] for mth in 1..10 entities = @group_handlauf_mitte1.entities ### MTH instead of 1 needed entities.erase_entities entities[0] rl1 = [0, y1, 0] rl2 = [0, y2, z] group = @group_handlauf_mitte1 = entities.add_group ### MTH instead of 1 needed entities2 = @group_handlauf_mitte1.entities ### MTH instead of 1 needed new_line = entities2.add_line rl1, rl2 length = new_line.length pf[mth] = [0, 0 - @run+@run*@il*(mth-1)+@run*@la*(mth-1)+@ro.abs, (mth-1)*@il*@rise+@sr] #mitte #point1 = Geom;;Point3d.new pf51 #constpoint = entities.add_cpoint point1 centerpoint = pf[mth] new_line = entities2.add_line rl1, rl2 vector = new_line.line[1] vector2 = vector.normalize! edges = entities2.add_circle centerpoint, vector2, @thradius kreis = entities2.add_face edges entity1 = entities[0] kurvem = entity1.all_connected status1 = kreis.followme kurvem end thanx for helping stan
  • Convert from .kml to .dae

    2
    0 評價
    2 貼文
    2k 瀏覽
    Dan RathbunD
    The kmz is a zipped archive file. It has the dae file within it, inside the "models" folder.
  • RBZ update issue

    22
    0 評價
    22 貼文
    1k 瀏覽
    jiminy-billy-bobJ
    Hmmm, right. Thanks
  • Material Take-Off by layers

    3
    0 評價
    3 貼文
    393 瀏覽
    pingpinkP
    Wow ! I changed the codes and it can analyze the layers. Thank you very very much , Dan !! selection.each { |s| is_group = s.is_a? Sketchup;;Group is_component = s.is_a? Sketchup;;ComponentInstance if s.layer.name == "Aluminium" ----continue---- }
  • Problem with component-definition in a loop

    2
    0 評價
    2 貼文
    226 瀏覽
    Dan RathbunD
    See the BBcode help page You need to use the [ code ] ... [/code ] bbCodes around your code example and it will look like this: [code:11ffgczd] Some example code; a = [1,2,3] last = a.pop puts last[/code:11ffgczd]
  • [Webdialog] freeze during Ruby operation

    9
    0 評價
    9 貼文
    1k 瀏覽
    jolranJ
    Draw method, in a tool. Sorry, my misstake. Calculations for nodes are done outside the tool class. Passing through those methods I collect information to be sent to a container that the Tools draw method fetches information for rendering. I have a bit of work left there to get things organized. The data changes constantly so it will probably cost more to iterate what is needed to be updated then to redraw everything in 1 go. Since mostly dealing with Points and vectors, the new data will probably be totally different then the old anyway. I just clear the old data and bring in new, sort of, without going into details.. There are different types of data though. Persistent data that references to a Sketchup entity for ex, can be cached and updated only when switched. Anyway got a new situation now(TOPIC), have to redesign a lot on the Ruby side. I've studied your render cache. It's very nice and good example. Need to study it more though. Thanks for the input
  • Coordinates entered with InputBox

    5
    0 評價
    5 貼文
    858 瀏覽
    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 評價
    9 貼文
    558 瀏覽
    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 評價
    27 貼文
    903 瀏覽
    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 評價
    8 貼文
    739 瀏覽
    BoxB
    I'll leave it at that, You are an advanced user and are obviously talking over my head.
  • Glued_to problem

    6
    0 評價
    6 貼文
    421 瀏覽
    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 評價
    27 貼文
    1k 瀏覽
    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 評價
    3 貼文
    295 瀏覽
    A
    Thanks TIG.
  • Excluding from undo stack

    8
    0 評價
    8 貼文
    457 瀏覽
    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 評價
    4 貼文
    301 瀏覽
    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 評價
    7 貼文
    505 瀏覽
    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 評價
    6 貼文
    389 瀏覽
    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 評價
    4 貼文
    392 瀏覽
    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 評價
    8 貼文
    504 瀏覽
    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 評價
    9 貼文
    2k 瀏覽
    renderizaR
    Dan Rathbun I can't thank you enough you sir are brilliant!

Advertisement