sketchucation logo sketchucation
    • Login
    1. Home
    2. slbaumgartner
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 19
    • Posts 1,020
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Intersect_with revisited

      @tig said:

      I recommend that 'ents3' should NOT be an 'entities collection'.
      Make it a single entity like 'group3' OR an array of entities like 'ents3.to_a'...

      Its API is very badly written πŸ˜’
      As you have noticed...

      Good point! In fact, I believe the method will throw an Argument Error if you try to pass an Entities collection rather than Entities.to_a! But the individual Entities will always be taken to be in model coordinates.

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • Intersect_with revisited

      After much struggle trying to get Entities#intersect_with, reading all of the examples but failing in bizarre ways, I think I finally wrestled this beast to the ground. Since I didn't see this explanation in any search hits, I thought I'd share it here.

      If you ponder Entities#intersect_with, you will notice a peculiar aspect: there are three Entities collections involved in the operation, but only two Transformations. The only possible interpretations are that the same Transformation is secretly applied to two of the Entities, or that one of the Entities collections is used untransformed. It turns out that the final Entities collection passed must already be in model coordinates; it will not be transformed before calculating the intersection. I was trying to use a ComponentDefinition's Entities for that third argument, and treating it as if it is already in model coordinates causes very strange results!

      All of the examples I found used Groups, and despite having an associated Transformation, the Entities in a Group are actually captured in model coordinates at all times. That is, when you transform a Group the Transformation is remembered but the locations of all Vertices in the Group are recalculated immediately in model coordinates.

      [edit: the above statement is false. The vertices in a Group are not recalculated when, for example, you move the Group. Instead, the movement is captured in the Group's Transformation. But a Group is acceptable as the final argument, ents3, because it carries this transformation along with it. This allows intersect_with to transform the Group's Entities to model coordinates. Faces and Edges do not carry their own transformations, though.]

      So, here's a reinterpretation of the API doc:

      ents_arr = ents1.intersect_with(recurse, trans1, ents2, trans2, hidden, ents3)

      The Entities in ents1 are transformed to model coordinates using trans1. This allows ents1 to come from a ComponentDefinition and trans1 to correspond to a ComponentInstance at a particular location and orientation (that actual instance does not need to exist in the model!)

      The intersection is calculated between (transformed) ents1 and (untransformed) ents3.

      The results are returned as ents_arr and are also placed into ents2 after transformation by trans2.

      Note that if trans2 is not the actual transformation of ents2, the results may go to strange locations.

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Call to Retina users (for Fredo6 plugins)

      @fredo6 said:

      I made a change to offer the possibility to scale up the button palettes (by a factor 2).

      ONLY FOR RETINA USERS
      Would you be be kind to

      1. Drop the attached file Lib6Palette.rb into the Fredo6_!LibFredo6 subfolder
        [attachment=1:1g1qxvfs]<!-- ia1 -->Lib6Palette.rb<!-- ia1 -->[/attachment:1g1qxvfs]

      2. Go to Windows > LibFredo6 Settings... and set the Retina Screen parameter to true (it is at the bottom of the dialog)

      3. Check with my plugins if the display has improved.

      4. If possible, post some screenshots so that I can see visually what is going on.

      @oli_sketch: I still don't understand why you get tiny text whereas other Retina users get normal text size

      Thanks very much

      Fredo

      Here's a screenshot. As you can see, this affected the button graphics, but not the text. BTW, different models of MacBook Pro Retina have used different GPU chips. In theory at least, that could cause some low-level variations from Mac to Mac...


      Screen Shot 2014-01-28 at 12.42.24 PM.png

      posted in SketchUp Discussions
      S
      slbaumgartner
    • RE: Call to Retina users (for Fredo6 plugins)

      @fredo6 said:

      Steve

      Thanks for these enlightful explanations.

      My idea was to scale the palette in my code, but I need to understand the problem with the text size. I wonder why oli_sketch gets a tiny text! whereas you and pbacot get a normal text size.

      By the way, did you check in the OpenGL preference panel if there are any option available talking about points.

      I am not sure the SU team is working on a solution in the short term.

      Fredo

      If there is an OpenGL preferences panel, I haven't been able to find it. Do you know there is one, or are you speculating? If you know how to open it please let me know and I will look at it. But, as discussed next, I don't think it would matter...

      OpenGL in itself doesn't provide any support for text (consult any book on OpenGL programming to verify this). To show text on the screen, an app has to draw the characters using one of the low-level OpenGL functions. There are libraries such as FreeType that an app can employ to add a text-drawing layer atop OpenGL, but I don't know whether SketchUp uses one or if so which one. Given this state of affairs, only the SU code itself can control the size and font used.

      Our test experience shows that the SU team did not write code that senses Retina and changes these parameters for view.draw_text nor did they expose a UI that lets a user specify them. So, until they do I think we are stuck. Considering that very few plugins/extensions use view.draw_text and that the problem is severe only on screens that pack a very high pixel count into a relatively small screen (i.e. MacBook Pro Retina vs a super-large monitor), I am not surprised that the SU team doesn't give this problem much priority.

      As an extreme workaround I suppose you could create your own library of character images at double size and place your text using collections of these. Clearly that is an awful lot of work to handle a small portion of your user base!

      Steve

      posted in SketchUp Discussions
      S
      slbaumgartner
    • RE: Call to Retina users (for Fredo6 plugins)

      Fredo,

      First answers to your specific questions, and then some discussion.

      1. My MacBook Pro Retina 15 has physical screen 2880(w) x 1800(h) pixels
      2. The viewport I am currently looking at in SketchUp reports 1912(w) x 1478(h).
      3. My current "resolution" setting is "Best for Retina", which scales the display to 1440(w) x 900(h) points. In this setting, a "point" is exactly 2x2 physical pixels. If I choose a different resolution and it is not an integer divisor of the physical screen pixel size, the graphics hardware scales the points onto the pixels, which causes the size of everything to change. In some settings the screen becomes a bit blurrier due to the interpolation needed to scale points onto pixels. "Best for Retina" is a compromise that is large enough for most people to accept, and is also an integer multiple of the physical screen pixels, so scaling can be done without blurring. When I change the display resolution setting, the view still reports the exact same width and height unless the new resolution causes the window to be larger than the display, in which case it will be clipped to fit. I didn't show a screenshot, but at full 2880x1800 resolution, your stuff is exactly the same size as on "Best for Retina". That is, everything else on the screen becomes just as tiny as your text, but the text stays the same.
      4. Screenshots attached for "Best for Retina", 1680x1050, and 1280x800 resolutions. These are full screen shots so that you can see the effect of resolution changes without being mislead by the screenshot clip window.
      5. No Preference or Model Info or other setting I have found has any effect on the text generated by view.draw_text.

      From the reported view sizes and behavior of the text, I conclude that SketchUp view.draw_xxx methods operate directly at the OpenGL level, in physical pixels not display resolution points. Some resolution settings seem to affect the size of the text, maybe as a side-effect of their scaling in the graphics system, but telling people they have to use a resolution smaller than (say) 1024 x 800 is hardly sensible! I really doubt there is any practical way for you to work around this. Without knowing the exact technique SketchUp uses to draw the text, it isn't even clear that you could sneak around the edge and somehow tell OpenGL to use a different size. I think the SketchUp coding team has to take this one on!

      Steve


      Screen Shot 2014-01-26 at 9.12.21 PM.png


      Screen Shot 2014-01-26 at 9.12.47 PM.png


      Screen Shot 2014-01-26 at 9.20.16 PM.png

      posted in SketchUp Discussions
      S
      slbaumgartner
    • RE: JScript innerHTML not working in WebDialog !

      @tt_su said:

      @onidarbe said:

      So Sketchup uses IE instead of Chrome, although I uninstalled IE? strange

      You cannot completely uninstall IE. You may have uninstalled the front-end, but the IE engine is embedded deep into the OS. Help files (chm files) are using the HTML engine, HTA files are also using it. And the embedded HTML IE webcontrol is more conservative in terms of compatibility, which is why you need to use META tags to force WebDialogs to use the very latest IE engine.

      And because so many things use the system HTML engine I recommend you keep IE up to date, even if you use a different browser. You can never remove it 100% anyway. The "uninstaller" is just a shim to please the public (and EU anti-trust).

      For Mac users, the equivalent statement is that SketchUp uses the WebKit Framework, not Safari. Just as on Windows, your choice of browser has no effect on what SketchUp's WebDIalogs do.

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Best way to iterate all nested entities

      @tt_su said:

      To use the same tolerance as SketchUp does, use the methods built into the Ruby API:

      vector = edge.line[1] vector.samedirection?(Z_AXIS)

      http://www.sketchup.com/intl/en/developer/docs/ourdoc/vector3d.php#samedirection?

      The components of a vector are floating point values so they should never be compared without a tolerance. For more information about floating point precision: http://floating-point-gui.de/

      Excellent advice! Do you know whether Point3d#on_line? and #on_plane? also include the tolerance? The API docs don't say.

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Error Message regarding missing rb files when opening SU?

      @sketchydog said:

      When I open SketchUp, I get the following message:

      Error Loading File auto_centerpoint.rb
      no such file to load -- ruby/singleton
      Error Loading File jointpushpull.rb
      undefined method `get_last_state' for nil:NilClass

      I'm not sure what the auro-centerpoint.rb relates to, but the error for "Joint Push Pull" is odd, because my JPP tools seems to function perfectly.

      It's annoying to have this pop every day. Any suggestions?
      Thanks!

      You almost surely have an incorrectly installed plugin which is either missing some of its files or looking for them in the wrong places. The tedious but ultimately guaranteed way to track this down is to turn off all the plugins (e.g. by renaming their extension to .rb!) and then turning them back on one-at-a-time until the issue reappears.

      posted in SketchUp Discussions
      S
      slbaumgartner
    • RE: Model in model sharing methods

      Seems to me this depends on what you are really trying to achieve. Are these printouts for your own use during development and testing (most likely) or for your end users (seems unlikely as they probably won't have Ruby Console open and won't have any use for file and line info)? If the former, what is wrong with coding MR::p? You can then turn off the effect globally by editing just the MR module so that p does nothing. Also, you really don't want to pollute the global namespace with a variant method. That is reserved for the Trimble team 😲

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: How to make webdialog with functionality of layer manager

      @rdx007 said:

      Hi all,
      I have a skp file which displays different parts of a design using layer manager. I want to make a form with drop down boxes in webdialog which is user friendly and performs the same function as layer manager . Is it possible to do so? If yes please let me know how go about it .

      There are numerous plugins that do things such as you seek. Search the Extension Warehouse and the sketchUcation plugin store for "layer".

      Steve

      posted in SketchUp Discussions
      S
      slbaumgartner
    • RE: What use are Tool id's?

      @dan rathbun said:

      @slbaumgartner said:

      So, what can you do with a Tool id except display it for curiosity sake?

      ON the PC they are actually the command IDs, so you can pass them as an argument to Sketchup::send_action()

      Thanks for all the info, Dan. Can I take it from this comment that this technique does not work on Mac?

      steve

      posted in Developers' Forum
      S
      slbaumgartner
    • What use are Tool id's?

      Is there any way to get a Ruby reference to a Tool identified by an id number returned from Tools.get_active_tool? For instance, model.select_tool wants a reference to a Tool, not an id. So, what can you do with a Tool id except display it for curiosity sake?

      Cursors are also identified by id numbers, but these numbers are what you pass to UI.set_cursor. Why not tools?

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: [Plugin] Dimension management tools

      @gnlmrc60b22f205v said:

      Very useful plugin, would be perfect if the tool "Dimensions to Layer", creating a new layer, write on the "Name for the New Layer" window a default name, for example "DIM-TEXT", so, if I wont I can change it, but I don't have to write it every time.
      Please, can you take me the rb file text modification to obtain this?

      Thank you very much anyway for the plugin.

      You are welcome!

      To make the change you describe, you need to modify line 147 of the Ruby to be

      
            new_layer_name_arr = UI.inputbox ["Name for New Layer"], ["DIM-TEXT"]
      
      

      That is, add the part ',["DIM-TEXT"]' to the end of the existing line. That makes "DIM_TEXT" the default value for the input.

      Steve

      posted in Plugins
      S
      slbaumgartner
    • RE: Transformation of single entities ???

      @tig said:

      Try something like this...
      vector.length = distance tr = Geom::Transformation.translation(vector) face.parent.entities.transform_entities(tr, [face])
      The 'face' [and its connecting edges/vertices] will be transformed by the 'vector', having set its length to 'distance'...
      You can get the 'entities' context in several ways - this gets it from the 'face' container...

      "entities.transform_by_vectors" needs matching arrays of vectors and objects [often vertices] - because all of the translations are the same in your case the "transform_entities" using a single 'translation-transformation' and a lone 'face' will suffice...

      I stand corrected and educated 😳 Never noticed that method on Entities. Thanks TIG.

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Transformation of single entities ???

      @artmusicstudio said:

      hi,
      again i cannot really find a solution in the api-description:

      when i have a group of 100 entities (edges and faces) and i know, that entity(50) is always the one i have to transform (it is a face),

      how can i MOVE this face (like with the mouse) , so that all connected edges and faces adapt automatically?

      i have the distance, the vector and the number of the entity.

      thanx for helping!
      stan

      I can't give you a working code snippet, but I can advise you that this operation is a lot more complicated than it might seem on the surface. The API has transform methods only for Group and ComponentInstance because primitive objects don't have Transformations associated with them. The GUI engine knows how to move primitive Entities such as Faces and Edges around, but it does so by continuously revising the Point3d values in them. I believe there is no way to alter these values via the API; you have to delete the existing objects and redraw them. The GUI also knows how to find and maintain the connected Edges and Faces. Perhaps this capability would be a reasonable feature request for a future release of the API.

      In pseudo-code, you want to:

      • get the Vertex positions of the Face you want to move
      • find all Edges and Faces connected to that Face
      • get the positions of the far end of each Edge emanating from a Vertex of your Face that is not one of the Face's own Edges
      • now delete your Face and all the Faces and Edges connected to it (!)
      • add your offset to the Vertex positions of your Face and redraw it.
      • redraw the Edges from each Vertex of your new Face to the corresponding original far end(s)
      • use the API to find the Faces associated with each Edge of your new Face

      Not having coded it, I'm not 100% sure there aren't some flaws in that sequence, but it makes sense to me πŸ˜•

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: [code] extract png thumbnail image from .skp file

      @nuagevert said:

      Hi,
      i would like to know how to extract with better resolution than a thumbail or how t oextract texture from skp files

      thanks a lot ?

      regards
      Gabriel

      SketchUp automatically generates a thumbnail image and saves it inside the skp file. That is what Jim's code extracts. You have no control over the size or quality of this image. In my experience, for a complex model it is almost useless. There just aren't enough pixels in it to avoid total blur of the contents.

      To get an image in which you control the size and quality, you must use one of the techniques Dan describes. As he notes, these are Ruby code that runs within SketchUp - though I suppose you could write code using the C API that would do it.

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Coordinates of a vector-cross-point?

      @mptak said:

      A bit of a semi-sequiter this one coming from Haine's Udacity Course on 3d Graphics. Traditionally points are stored with a 4 value list/array with the 4th value being 1 while vectors are stored also in a 4 value list/array with the 4th value being 0. Consequently if you subtract two points you get vector, if you add two vectors you get a vector and if you add a point to vector...you get a point. Adding two points gives you a 2 in the last position in an array which would be nonsensical. I am curious if this is the underlying data structure in sketchup as well?
      http://youtu.be/DXwQg9n9gqo

      It isn't documented that I am aware of (the Point3d and Vector class internals are opaque), but given the way that transformations are constructed it seems very likely that SketchUp follows this convention - at least for points. That is, transformations are represented using 4x4 matrices, allowing application to a point via a standard matrix multiply.

      Sorry, Stan, that probably went over your head too πŸ‘Ώ

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Web dialog on a Mac

      @s_k_e_t_c_h_y said:

      Thanks for the feedback,
      I'll try some of your ideas. I did know about the unload, but thought I'd taken care of that with a message back to ruby to let it know the DOM was loaded.

      Paul.

      What triggers the message? It could be that due to async timing it is never delivered!

      Steve

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Web dialog on a Mac

      No, there is no special option you have to set. However, you do have to be careful about the fact that javascript runs asynchronously on the Mac but not on Windows. This can cause a host of problems. One of the most common is that an onload event callback from the HTML body will not work, you have to use a script element as the last thing in the body.

      Take a look at TT's writeup https://github.com/thomthom/sketchup-webdialogs-the-lost-manual first to make sure you aren't doing something known to be wrong.

      posted in Developers' Forum
      S
      slbaumgartner
    • RE: Woodworking machinery models useful to others?

      Machinery models are very useful when planning the layout of a shop, and having a model pre-built for your specific machine is a great timesaver. Please share them via the 3D warehouse so that anyone can find them, not just us sketchUcation members.

      Steve

      posted in Woodworking
      S
      slbaumgartner
    • 1 / 1