sketchucation logo sketchucation
    • Login
    1. Home
    2. Francis Mc Shane
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 5
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [Code] wrapping operations

      Dan,
      thanks for this. It works. I don't know why though!
      Best,
      Francis

      posted in Developers' Forum
      F
      Francis Mc Shane
    • RE: Get Point3D from place_component

      @dan rathbun said:

      Now... model#place_component()

      (1) The API dictionary is incorrect, it does NOT return nil, it returns a reference to the active_model which is basically frivolous, but does allow call chaining.

      We have logged an API doc typo on this, as well as asking for something more useable to be returned (especially in the case of multiple insertions when the 2nd argument is true.)

      (2) When the 2nd argument is false, and only 1 instance is inserted, model#place_component() works the same as the native tool, ie: the selection is cleared, and the newly placed component instance's reference is pushed into the selection (as it's only member.)

      So you can get it's insertion point as discussed in the post above.

      FYI ... When the 2nd argument to model#place_component() is true, and multiple instances MIGHT HAVE BEEN inserted, the model's selection object IS NOT CHANGED.
      If something was previously selected, it still is. If the selection was empty, it will still be empty.

      Dan,
      thank you for you for your two posts which are very helpful. I would have ticked them both as 'resolve' but I had already done this for a previous post and 'the system' wouldn't allow me to tick more than one post as a 'resolved' post. I will be trying your ideas soon. Thanks again. Francis

      posted in Developers' Forum
      F
      Francis Mc Shane
    • RE: Get Point3D from place_component

      @sdmitch said:

      Model.place_component seems to be the tool that is used when you select a component for placement from the Components Browswer. I guess the only way to find the insertion points would be to search for all instances of the component to get the .transformation.origin. of each like this

      mod = Sketchup.active_model
      > ent = mod.active_entities
      > sel = mod.selection
      > cmp = mod.definitions["Component#1"]
      > puts "--insertion points of Component#1--"
      > cmp.instances.each{|ci| puts ci.transformation.origin}
      > puts "-----------------------------------"
      > 
      > 
      

      Thank you for this it's very helpful. I will try it.

      posted in Developers' Forum
      F
      Francis Mc Shane
    • Get Point3D from place_component

      Is there a Ruby way to get the insertion point of a component. Unfortunately model.place_component does not return a Point3D object, just nil.

      Thank you for any help you can offer.

      Francis

      posted in Developers' Forum
      F
      Francis Mc Shane
    • Makes a stair with component steps

      I based this Ruby script on the Google Ruby tutorial which draws a stair. This does the same but the steps are components so if you edit one they all get changed. I'm a complete beginner so I'm having trouble making the whole stair a group but otherwise it works in my version of SU 7.


      Makes a stair with component steps

      posted in Developers' Forum
      F
      Francis Mc Shane
    • 1 / 1