FredoBend | Powerful new bending tool for 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
  • Need help on writing threaded plugin code

    10
    0 Votes
    10 Posts
    1k Views
    RichMorinR
    @thomthom said: UI.timer ? or a Javascript timer? This has to be a UI.timer, because it runs in the plugin (telling the plugin when to look for proxied messages from the JavaScript client code). I'm using SU 8, so the bug you mention isn't a problem for me. However, it would be nice to have a solution that works for earlier versions.
  • PBI - emulate WebDialogs in a browser?

    6
    0 Votes
    6 Posts
    1k Views
    RichMorinR
    @morgan_greywolf said: Sure, I'll take a look at it. I'm running SU8 on Linux/Wine. Great. You can get started with the proxy server and the test page; send me a note off-list (rdm@cfcl.com) letting me know what you find out. As soon as I have my example plugin ready for Alpha testing, I'll let you know. FYI, the plugin no longer sits in a read loop. Instead, I use UI.start_timer to perform periodic scans of the input directory. This seems to work quite nicely, but it does require SU8, because it's using a sub-second interval. Also, I'm still hoping for a CygWin and/or native Windows tester!
  • Inputbox prompts by variable

    3
    0 Votes
    3 Posts
    315 Views
    J
    In the first example, prompts is an Array of Strings, which is the correct form. In the second, p just a String; so when you write prompts = [p], y0u get an Array containing a single String. p = [] p << "What is your Name?" << "What is your Age?" << "Gender" prompts = p Do not use p as a variable. Although it does work, p is a shortcut for the .inspect method. p prompts is the same as puts prompts.inspect
  • Making an objects parallel to a line. (lookat function)

    5
    0 Votes
    5 Posts
    384 Views
    Chris FullmerC
    Then I too think it already exists. Check out Honolulu's script.
  • Testing user input as valid geo-location

    7
    0 Votes
    7 Posts
    400 Views
    honoluludesktopH
    Done, Thanks Dan. Haven't gotten back to working on this part of the code yet.
  • [Help!] creat a face from edges on existing face

    13
    0 Votes
    13 Posts
    1k Views
    K
    @heven7_floor said: I just learning ruby code in SU, and found problem about draw a face onto existing face, I can identify any method in new face further , such as <span class="syntaxdefault"><br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_face edges                     </span><span class="syntaxkeyword">----------></span><span class="syntaxdefault"> drawing it on existing face<br /><br />if not</span><span class="syntaxkeyword">(@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normal</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">samedirection</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">dir_vec</span><span class="syntaxkeyword">)</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">---------></span><span class="syntaxdefault"> get error </span><span class="syntaxstring">"undefine method 'normal' on nil "</span><span class="syntaxdefault"> <br />  puts </span><span class="syntaxstring">"change to initial direction"<br /></span><span class="syntaxdefault">  </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">reverse</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">end<br /></span> any one please help me to explain why cause of this error , I don't understand why I can't undentify this method thanks everyone in advance I've run into this problem before. Sketchup won't let you make a internal face with the add_face method. For example, if you simply draw a rectangle inside the interior of a face. Delete the rectangle's face. Select the 4 edges. The following code using Jim Foltz's Ruby Web Console won't remake the face: model = Sketchup.active_model ent = model.entities sel = model.selection edges = sel.to_a ent.add_face edges You need to use the "find_faces" method, but that only returns the number of faces made. So you have to go through the trouble of finding the face it made. So rewriting your code, it would work this way: #@cir_face = entities.add_face edges edges[0].find_faces faces = edges[0].faces for i in (0..faces.length) result = faces[i].classify_point(@f_point) if result == Sketchup;;Face;;PointInside @cir_face = faces[i] break end end I found this plugin very interesting. Here are some extra stuff, I cleared up at the beginning. The "normal=@inputpoints[0].normal" was giving an error, like everyone pointed out. Looks like to me, its the same vector as "@dir_vec". So I set it equal to that vector: #normal=@inputpoints[0].normal @dir_vec = find_vec(@inputpoints[0],@inputpoints[1]) normal = @dir_vec v_axes = @dir_vec.axes And I found that your pushpull direction only went positive and not negative. So added these extra lines before your pushpull: @pushpull_dir_vec = (@cpt_l-@f_point) if !(@pushpull_dir_vec.samedirection? @dir_vec) @cy_dist = -@cy_dist end status = @cir_face.pushpull @cy_dist,true Here is the modified file: circle_any_plan_&Pull(modified).rb
  • &quot; copy &quot; in component name

    4
    0 Votes
    4 Posts
    433 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
    1k 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
    615 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
    259 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
    297 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
    15k Views
    F
    This is not for Mac OSX is it?
  • Identify groups by its attributevalue and delete them

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

    3
    0 Votes
    3 Posts
    248 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
    236 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
    973 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
    430 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
    345 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]

Advertisement