sketchucation logo sketchucation
    • Login
    1. Home
    2. dagobo
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 9
    • Groups 1

    dagobo

    @dagobo

    10
    Reputation
    1
    Profile views
    9
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    dagobo Unfollow Follow
    registered-users

    Latest posts made by dagobo

    • Link an entity to a dynamic component

      Hi,

      I am trying to link an entity created by a Tool (a construction point) to a dynamic component animated by the same Tool.
      For now, my tool moves and modifies a little bit my DC (length, width), then creates a construction point.

      Is there any possibility to link the two entities with a Ruby command ?

      I was thinking of adding the construction point as a sub-component of my DC (which already counts three sub-components). But my DC should keep the same name at the end.

      Thanks a lot for your help.

      posted in Newbie Forum sketchup
      D
      dagobo
    • RE: Issues with the onMouseMove method within a Ruby Tool

      OK so if I make a simple draw method that way :

      def draw(view)
      	view.line_width = 3       
      end
      

      and if I create a draw_beam method that way :

      def draw_beam()
         @component.set_attribute("dynamic_attributes","angle_h", @angle_horizontal_degres)
         @component.set_attribute("dynamic_attributes","angle_v", @angle_vertical_degres)
         $dc_observers.get_latest_class.redraw_with_undo(@component)
      end
      

      which I can call inside my onMouseMove, will it work correctly ?

      posted in Developers' Forum
      D
      dagobo
    • RE: Issues with the onMouseMove method within a Ruby Tool

      Thanks Jim.

      I am actually trying to implement my draw method within my tool ruby script that way :

      def draw view 
      	@component.set_attribute("dynamic_attributes","angle_h", @angle_horizontal_degres)
      	@component.set_attribute("dynamic_attributes","angle_v", @angle_vertical_degres)
      	$dc_observers.get_latest_class.redraw_with_undo(@component)
      end
      
      

      The draw method is called within my onMouseMove method.

      What I am trying to get is to make my tool draw and direct my component (@component) towards the right direction (given by both the attributes "angle_h" and "angle_v").

      For now, my script doesn't return any error message, but it doesn't do the right operation.
      My component is directed toward the same direction each time I compute the script, which is not the good direction.

      The lines I use to direct the component are perfectly working within my onLButtonDown method, but not within my onMouseMove method (through the draw method) as you can see.

      How could I fix this ?

      Thanks a lot,

      Marie

      posted in Developers' Forum
      D
      dagobo
    • RE: Get an origin point inside a Dynamic Component

      I tested it and it is actually the good origin point which is returned by the .origin method.
      I need to call the method for the nested component as I decided another point for the container component's origin.

      And I will use a for loop to get the right subcomponent (with the right name).

      Thanks a lot !

      Marie

      posted in Developers' Forum
      D
      dagobo
    • RE: Dynamic Component rotation through Ruby code

      Thank you TIG !

      It works perfectly.

      posted in Developers' Forum
      D
      dagobo
    • Issues with the onMouseMove method within a Ruby Tool

      Hi all,

      I've got some troubles to understand the view.invalidate command implemented inside the onMouseMove method within a Tool Ruby script.

      This method is called to refresh the view and to allow the tool to draw some temporary graphics.

      If I want the draw method to draw something different either I clicked once or twice, can I create two draw methods (draw1 and draw2) ?
      Or should I use a variable (first_click=true or false) to tell the draw method which graphic it must draw ?

      Eventually, I don't want the draw method to draw simple lines in real time, but I want a component attribute to be modified (LenX) and immediatly displayed when the onMouseMove method is active.
      It is a bit like the Push-Pull method : can I tell the draw view to update the LenX attribute's value in real time and to display immediatly the component with the good dimensions ? Or should I use another method than the draw method to allow my onMouseMove method to do that in real time ?

      Thanks a lot for your help,

      Marie

      posted in Developers' Forum
      D
      dagobo
    • RE: Get an origin point inside a Dynamic Component

      But will the Point3D returned by the transformation method be the same point I decided for the origin of my sub component when I created it in SketchUp ? (in SketchUp : right-clic on the component, "Modify axes")

      And if I named the sub component ("Light_Beam") of my component ("Light"), could I get directly the sub component from the selection ?

      Instead of writing :

      selection=Sketchup.active_model.selection
      sub_component = selection[0].definition.entities[2].definition.instances[0]

      to get my sub component, and then get the origin point with sub_component.transformation.origin

      The [] method is said not to be very efficient in the Google SketchUp Ruby API. And I don't want to use the .each method as I want to get only one sub component I named.

      posted in Developers' Forum
      D
      dagobo
    • Get an origin point inside a Dynamic Component

      Hi all,

      I want to get the coordinates of an origin point inside my Dynamic Component.

      I created a Dynamic Component composed of three sub components.
      Every sub component has an origin point and axis to get oriented in a different way.

      I want to get the origin point position of one of the sub component in order to use it in my Ruby code.

      I actually want to draw a line from this origin point to the point of the mouse's current location, inside of a onMouseMove method within my Tool Ruby code.

      Does anybody know an answer ?

      Thank you every one,

      Marie

      posted in Developers' Forum
      D
      dagobo
    • Dynamic Component rotation through Ruby code

      Hi all,

      I am trying to write a Ruby tool that needs to access a dynamic component's attributes.
      I created two attributes within my component : two rotation angles along two different axes.

      First issue I had : the name I gave to the attributes wasn't the good one for the ruby code.
      So I downloaded the AttributeManager to see the real name of the attribute.

      Then, I tried to actually make my component rotate through the ruby code.
      But it seems like the value of the attribute has changed, but not the view in the design.
      So my component stays exactly at the same position and doesn't rotate at all.

      How can I do the refresh the value or refresh the view in my code, in order to make my component move each time I compute my code ?

      Thanks every one for your help,

      Marie

      posted in Developers' Forum
      D
      dagobo