🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
  • " copy " in component name

    4
    0 Votes
    4 Posts
    377 Views
    Al HartA
    @jim said: Dynamic Components have a Copies behavior that, when set to > 0 adds another Component and appends "copy ###". Thanks for the reminder. That was it. [image: asn9_spacecopy1.jpg] Needs to become: [image: KDBC_spacecopy2.jpg] Its too bad they didn't use something more unique than ' copy ', so it wouldn't look the same as a component with 'copy' already in the name.
  • Draw2d GL_POLYGON

    7
    0 Votes
    7 Posts
    962 Views
    J
    @thomthom said: Oh... so convex shapes will all be drawn like that? That's a bit of a bugger... In fact. But good news, I applied my good still in ruby (started to program in ruby last friday) to translate an algorithm that fix just that which we call polygon triangulation. I converted the algorithm from c++ to ruby: (Original source code: http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml) # @param contour is an array of Vector2d # @return area def triangulateArea(contour) n = contour.length a = 0 p = n - 1 for q in 0...n do c1 = contour[p] c2 = contour[q] a = a + c1.x * c2.y - c2.x * c1.y p = q end return a / 2 end # Check is P is inside the triangle formed by A-B-C. # @param A Point3d of the triangle # @param B Point3d of the triangle # @param C Point3d of the triangle # @param P Point3d that have to be checked if inside A-B-C # @return true if inside. def triangulateInsideTriangle(ax, ay, bx, by, cx, cy, px, py) i_ax = cx - bx i_ay = cy - by i_bx = ax - cx i_by = ay - cy i_cx = bx - ax i_cy = by - ay apx = px - ax apy = py - ay bpx = px - bx bpy = py - by cpx = px - cx cpy = py - cy aCROSSbp = i_ax*bpy - i_ay*bpx cCROSSap = i_cx*apy - i_cy*apx bCROSScp = i_bx*cpy - i_by*cpx return aCROSSbp >= 0 && bCROSScp >= 0 && cCROSSap >= 0 end # param contour is an array of Point3d where z is not used. # param u is an index in tV # param v is an index in tV # param w is an index in tV # param n is the size of tV # param tV is an array in index in contour. def triangulateSnip(contour, u, v, w, n, tV) ax = contour[tV[u]].x ay = contour[tV[u]].y bx = contour[tV[v]].x by = contour[tV[v]].y cx = contour[tV[w]].x cy = contour[tV[w]].y if 0.0000000001 > (((bx-ax)*(cy-ay)) - ((by-ay)*(cx-ax))) return false end for p in 0...n do if p != u && p != v && p != w px = contour[tV[p]].x py = contour[tV[p]].y if triangulateInsideTriangle(ax,ay,bx,by,cx,cy,px,py) return false end end end return true end # @param contour is an array of Point3d for a polygon # @return an array of Point3d where all 3 points is a triangle which # can be drawn with "view.draw2d GL_POLYGON, result" def triangulateProcess(contour) result = Array.new n = contour.length if n < 3 puts "Error; contour.length < 3" return nil end # We want a counter-clockwise polygon in tV tV = Array.new if triangulateArea(contour) > 0 for v in 0...n do tV << v end else for v in 0...n do tV << ((n - 1) - v) end end nv = n # Remove nv-2 Vertices, creating 1 triangle every time count = 2 * nv # Error detection m = 0 v = nv - 1 while nv > 2 # if we loop, it is probably a non-simple polygon if count <= 0 # Triangulate; ERROR - probable bad polygon! puts "ERROR - probable bad polygon! ???" return nil end count -= 1 # three consecutive vertices in current polygon, <u,v,w> u = v if u >= nv u = 0 # previous end v = u + 1 if v >= nv v = 0 # new v end w = v + 1 if w >= nv w = 0 # next end if triangulateSnip(contour,u,v,w,nv,tV) # true names of the vertices a = tV[u] b = tV[v] c = tV[w] # output Triangle result << contour[a] result << contour[b] result << contour[c] m += 1 # remove v from remaining polygon s = v t = v + 1 while t < nv tV[s] = tV[t] s += 1 t += 1 end nv -= 1 # resest error detection counter count = 2 * nv end end return result end How to use: You have to call triangulateProcess with an array of point that compose the polygon. It will return an array of point. But, this array is formed in a way that every 3 points create a triangle and can be used directly by view.draw2d GL_TRIANGLES. Ex: array = [[0,20,0],[20,0,0],[30,30,0],[20,20,0]] r = triangulateProcess(array) if !r.nil? view.draw2d GL_TRIANGLES, r end I hope it will be help some of you, Sincerely, Jo EDIT: Fixed errors in the code.
  • V6.0 compatibility

    11
    0 Votes
    11 Posts
    512 Views
    J
    @honoluludesktop said: am drawing the icons in Sketchup, and sizing them down with a Win2000 utility. Hmmm...think that's the problem? I will try a high end image editor. Possibly (even likely.) There may be several settings to chose from when resizing the image; some designed for speed, others for quality. That may be all you need.
  • Parse a compiled file with ruby?

    3
    0 Votes
    3 Posts
    228 Views
    J
    Hi Chris, This code snippet reads a binary 3ds file using Ruby and writes out an ascii .obj file.
  • X-ray

    4
    0 Votes
    4 Posts
    254 Views
    J
    Many of the settings associated with Styles are stored in the RenderingOptions. Many of the keys are obvious, some not so much. http://code.google.com/apis/sketchup/docs/ourdoc/renderingoptions.html http://code.google.com/p/skx/wiki/RenderingOptions
  • SKM files

    10
    0 Votes
    10 Posts
    3k Views
    3
    Just wanted to be sure you guys were alert.....
  • Voronoi, convex hull, geometry modification toolset

    27
    0 Votes
    27 Posts
    14k Views
    F
    This is not for Mac OSX is it?
  • Identify groups by its attributevalue and delete them

    13
    0 Votes
    13 Posts
    600 Views
    thomthomT
    yea sure... it was a test.
  • Help with unhiding components.

    3
    0 Votes
    3 Posts
    215 Views
    honoluludesktopH
    OK, thanks. Btw, how did you learn this stuff? Am I not studying the API sufficiently? Addenda: OK, I get it, in OPPS, the child inherits the parents DNA:-)
  • Observer problem onDeleteModel ?

    4
    0 Votes
    4 Posts
    205 Views
    thomthomT
    I can try this on my Mac. It's one of the event's I've not managed to work out. http://www.thomthom.net/software/sketchup/observers/
  • Request_paint reverse

    9
    0 Votes
    9 Posts
    789 Views
    B
    Here it is: Paint_back_faces v2.0.rb
  • Arabic 3D text...WHY NOT POSSIBLE ?

    2
    0 Votes
    2 Posts
    2k Views
    charly2008C
    Hi hichem, Do you have installed an arabic font in windows? Charly [image: 9wfh_Bild2.jpg]
  • Global coordinates Question

    4
    0 Votes
    4 Posts
    326 Views
    B
    Thanks for the help,have got it sorted. Jim - I really appreciate you sharing the info about the nested components/groups saved a lot of time and effort Thanks Brett
  • Reset color to average texture color

    5
    0 Votes
    5 Posts
    283 Views
    Al HartA
    @thomthom said: @al hart said: But this stopped working. When? I don't know when it stopped working - sometime after I discovered that setting the color to nil did work (several years ago), and this past month when people started reporting bugs. (So of course, I suspected SU 8. But I just tried SU 7 and it fails there as well. So who knows...) The bug was interesting, because the color looked OK in the SketchUp model until you saved and reloaded the model. However, the material editor showed that the material color was not set. When you click reset color it sets the color properly. [image: G9hz_nil_color2.jpg]
  • Would anyone like a developer's IRC channel?

    19
    0 Votes
    19 Posts
    2k Views
    dereiD
    @richmorin said: since we only want SketchUp developers, I'm not sure where else would be appropriate... Well... more NEW Sketchup developers? ... the kind who didn't knew that they are Sketchup Developers until they hear about this ?
  • SF Bay Area Developer Workshop?

    6
    0 Votes
    6 Posts
    288 Views
    RichMorinR
    We've had 50+ views of this topic, but only two positive responses. If you are interested, please say so (either publicly or privately; I don't care). That way, I'll know whether there's enough interest to start things rolling.
  • Checking wether material exists before declaring it

    3
    0 Votes
    3 Posts
    215 Views
    K
    Ok, great. thank you. I'll change it this weekend. Hope you have a nice one Bye. Tim
  • Toolbar-command issue

    4
    0 Votes
    4 Posts
    481 Views
    Dan RathbunD
    @bluetale said: @dan rathbun said: I think you need to use MF_CHECKED for the active item, and MF_UNCHECKED (or MF_ENABLED ) for the other two. I tried it, but it did not work. Is there a way to get a radiobutton-like behaviour of toolbar-buttons? ..snip... Is there a way to get such a behaviour as explained above for the mac-version? There may be a bug in the Mac version. I see this issue has been discussed in more detail in your more recent topic: Toolbar Win vs Mac http://forums.sketchucation.com/viewtopic.php?f=180&t=32626
  • Need help with meta-attribute definitions

    2
    0 Votes
    2 Posts
    217 Views
    RichMorinR
    I have updated the page substantially, but still need feedback, etc. C'mon, folks...
  • Help!

    3
    0 Votes
    3 Posts
    223 Views
    B
    @unknownuser said: Well, for start, you could type in lowercase Because if your variable name starts with capital letter, ruby takes it as CONSTANT. You are lucky that ruby lets to redefine constants, most of programming languages don't allow . This is why you get the warning. use something like this, it's easier to read and those are local variables, not constants: > x_size = input[0].to_f > y_size = input[1].to_f > z_size = input[2].to_f > Thanks! it works perfectly now!

Advertisement