sketchucation logo sketchucation
    • Login
    1. Home
    2. johnwmcc
    3. Posts
    ⌛ Sale Ending | 30% Off Profile Builder 4 ends 30th September
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 18
    • Posts 105
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Request for help in developing a new Tool

      Many thanks for responding.

      The Ruby API docs say there should be two parameters to the view.draw_text method - point and text:
      point: A Point3d object.
      text: The text string to draw.

      Unfortunately, your suggestion doesn't work, though I can see why it should.

      Re-read the API docs for view.draw_text. Finally spotted that it says:

      View.draw_text
      This method is used to draw text on the screen.
      This method is usually invoked within the draw method of a tool.

      In my previous almost-working tool, I had the code in both places - the onMouseMove, AND in the draw_geometry method. When I put it in the draw method here, and drawgets called, it works. DOH!

      (Note to self: RTFM more carefully!)

      posted in Plugins
      J
      johnwmcc
    • Request for help in developing a new Tool

      I'm trying to redevelop from scratch a tool I had working (more or less), but in which the coding had got too tangled to take much further.

      It is based very heavily on the sample CLineTool by Jim Foltz. I've appended my working copy of this, since I can't find a definitive newer version either in the Extension Warehouse or the Plugin Store on this site.

      I want to start again to build the tool from scratch, this time trying to understand how the whole Tool class works, whereas last time I just fiddled with the existing code to adapt it, without really understanding quite a bit of how it works.

      I've put together a 'skeleton' ruby module and class, called DrawFraming, which I will eventually use to draw wood/timber framing in standard UK softwood sizes. In its former mostly working version, it allows me to

      • choose a standard cross-section of wood (by R-click from a menu), or define a custom size
      • place one corner in the drawing by mouse click at first pick point
      • choose what is to become the component's long axis, either normal to the face at the pick point, or using an arrow cursor key to toggle X, Y, or Z_axis lock on or off
      • orient the cross section by mouse movement around the first pick point, drawing the outline as feedback

      A second mouse click then creates the geometry for the cross-section in the chosen location, and then switches to the built-in PushPull Tool to pull it to the desired length, by inferencing or VCB input.

      I had most of that working, but decided I wanted it to be cleaner code, and also want to understand how to get working properly some features that I couldn't get to work quite the way I want - like suspend and resume the DrawFraming tool during Zoom operations, for example, or resume DrawFraming after the PushPull tool finishes.

      But I'm stuck at a couple of rather basic things which don't error, but don't work either, though as far as I can see they copy the relevant parts of Jim's code.

      I attach the current draft skeleton. I've only implemented parts of initialize, activate, reset, onMouseMove, onSetCursorand onLButtonDown. The other Tool methods are just stubs.

      I've got the tool to set the cursor image, but can't get it to display text at the cursor, nor to inference or display tooltips when hovering over existing drawing elements.

      In lines 94-98, the code

      
      # set the tooltip that should be displayed to this point
      view.tooltip = @ip1.tooltip
      ...
      # Display cursor text to give feedback at cursor
      view.draw_text view.screen_coords(@ip1), "Test0" 
      
      

      does nothing.

      In my older more complete version it DID work, and it does in the CLineTool too, but not here.

      I'd like to understand why. Perhaps I haven't initialized something properly? Missed a few lines of the clinetool_main.rb code that matters?

      Any clues would be most welcome.

      Another small point puzzles me. The onSetCursor method where my cursor is displayed seems to get called on every mouse move. I tried putting

      UI.set_cursor @cursor_id 
      

      in the activatemethod, but it does nothing there. Is this just the way it has to work? The Ruby API shows this code as an example, and it works, but it seems unnecessary to call it so often when I only have one cursor.


      jwm_draw_framing.rbz


      clinetool.rbz

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Plugin store updated to v2.5.3, and first post in this thread now links to it.

      Downloaded and tested it here in SU2015.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Once again, TIG, thank you for cleaning up my muddle, and for explaining what's gone on.

      I will make the changes on my original copy here too, and go back to just called the sub-modules by the same name as the SU Shapes ones - simply Shapes.

      Have you updated the Plugin Store rbz file, or do I still need to fix the files here then upload them? And would it now be better to delete the attached file in the first post, and replace that by a link to the Plugin Store?

      Must stop now for a while - will resume later tonight.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      I see you posted again while I was replying. Many thanks.

      Will make the changes asap.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      I wonder, TIG, if you can help me understand what's gone wrong in trying to separate the code here from that in the older SU Shapes on the Extension Warehouse.

      The current problem is a name error: I get this error for the Dome and Sphere tools now, which both try to call mesh_additions.rb and fail. The other shapes don't need mesh_additions.rb, so still work properly.

      Error; #<NameError; uninitialized constant JWM;;JWMShapes;;Sphere;;PolygonMeshHelper>
      

      My overall code structure for the Sphere tool goes as follows (Dome has just the same structure), and I don't really understand it (just copied from SU Shapes!).

      file jwm_shapes.rb has:

      module JWM;;JWMShapes
      ...
        class Sphere < Parametric
        ...
        end # class Sphere
      ...
      end # module JWMShapes 
      

      file parametric.rb has:

      module JWM;;JWMShapes
        class Parametric
        ...
        end # class Parametric
      end #module JWM;;JWMShapes 
      

      file mesh_additions.rb has:

      module JWM;;Shapes
      ...
        class PolygonMeshHelper
        ...
        end #class PolygonMeshHelper
      ...
      end #module JWM;;Shapes 
      

      Apparently, instead of (as I expected) the Sphere class looking for

      JWMShapes;;Shapes;;PolygonMeshHelper
      

      it is looking instead for

      JWM;;JWMShapes;;Sphere;;PolygonMeshHelper
      

      What have I done wrong here, and how do I fix it? If you can help, I'll be most grateful

      [Later] The original SU Shapes named the overall module CommunityExtensions instead of JWM, and the mesh_additions.rb code says

      module CommunityExtensions;;Shapes
      ...
        module PolygonMeshHelper
        ...
        end # module PolygonMeshHelper
      ...
      end #module CommunityExtensions;;Shapes
      

      I.E., as well as the name change JWM<-->CommunityExtensions and JWM::JWMShapes<-->CommunityExtensions::Shapes, PolygonMeshHelper was a module, not a class.

      Changing it back from class to module doesn't seem to fix the problem.

      Looking at the above, I see that my mesh_additions.rb SHOULD say JWM::JWMShapes instead of JWM::Shapes

      module JWM;;JWMShapes
      

      , but changing that doesn't seem to fix things either.

      Help please, if you can! I'm temporarily stuck, and thoroughly confused.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      I find I now get the same thing (not working) here - nothing is drawn.

      Will investigate asap.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      So sorry - I DID publish it at least once! But maybe not after my very last edit. Thanks again.

      J

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Bug now fixed in v2.5.2 - I'd made a typo in parametric.rb in the Module name - sorry.

      Works for me now.

      RBZ file uploaded both to Plugin Store and to the first post in this thread.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Hmmm. I get the same error. Sorry all round. Not sure what's happened, as I though I had only changed some internal references.

      Will investigate and update asap.

      John McC

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Version number updated to 2.51 in both jwm_shapes_loader.rb and jwm_shapes.rb files, and the Plugin Store. Makes no difference to operation, but should now show correct version internally

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Thanks for reminding me - will do later this evening.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Jo Ann - have you ever had another version of Shapes installed, whether from the SketchUcation Plugin store, or SketchUp or Trimble Extension Warehouse? There may still be a conflict, if so.

      Please go to your AppData/Roaming/Sketchup/SU 2014/Sketchup/Plugins folder, and delete any existing file(s) called shapes.rb or su_shapes.rb, jwm_shapes.rb or jwm_shapes_loader.rb; and delete any existing folder(s) with the name su_shapes or jwm_shapes (including all that folder's contents).

      Then reinstall the current version (v2.5 at time of writing) of the plugin from the Plugin Store here.

      If that doesn't work, I'm stumped.

      Best wishes, and I hope this works.

      John McC

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      I think all the documentation is now updated and the edits are saved - several links to image files were broken though, and I don't know why. Repaired now.

      NOTE: I found there were multiple copies of one image and deleting them didn't immediately show them as removed - small bug on the Files tab file uploads page?

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] SketchUcation Tools 2.6.1

      Thanks so much - that has solved my problem. The window is indeed too small, and I didn't realise there was a button to click. It is visible when I drag the bottom border of the window down, and a click on it then completes the installation.

      Could a double click on an element in the list perform the same action? That way, it wouldn't matter if the button is invisible.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Sorry about that - I hope I saved all the edits then - will check later today.

      Many thanks, TIG, for fixing my mistakes.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] SketchUcation Tools 2.6.1

      I've just downloaded and installed the current version of the Tools in SU2015 Pro 64 bit, on Windows 7 64 bit.

      When I tried to AutoInstall TIG's Mirror 4.2 plugin, I get a window popping up saying I have a choice of installation folder - the default, and a custom folder.

      Nothing happens when I click on either, or select either and press {Enter}. Does this version of the Tools not work on 64 bit SU?

      After it first happened, I restarted the machine in case that might help. No difference.

      I can install the Mirror plugin by download of the RBZ file, but I'm curious to know if AutoInstall ought to work, and if there's anything I can do to make it work.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      v2.5 changes the drawn shapes from groups to components, and allows the user to place them at any pickable point, not just insert them at the world origin.

      Thanks to Jim Foltz for providing sample code which I was able to adapt.

      See Plugin Store, or the first post in this thread, for the latest v2.5

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      There is an EXTREMELY old version of Shapes in the Plugin Store, by @Last: Shapes v1.0.

      The current one is authored by me and Trimble, and is found under the name "SU Draw Parametric Shapes v2.2.7"

      The version number currently in the Plugin Store is the same as the RBZ here (v2.2.7) - and has been for many months (I haven't updated it recently, and have no current plans for enhancements).

      I had wondered myself about the o umlaut in the folder name, but have no direct experience of using non-ASCII characters in Windows folder structures, though I do know they can cause problems.

      I don't think I know how to suggest anything further to help - I don't know of anything specific to this plugin that might cause the problem Emre has reported.

      posted in Plugins
      J
      johnwmcc
    • RE: [Plugin] 3D Parametric Shapes - makes placeable components

      Added missing validation checks in v2.2.9 to require minumum of 3 segments or sides for Tube, Pyramid and Torus.

      Uploaded latest v2.2.9 to Plugin Store, and updated Basic Info version number, Quick Start, and Documentation.

      posted in Plugins
      J
      johnwmcc
    • 1 / 1