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

    Posts

    Recent Best Controversial
    • RE: [Plugin] JointSU 1.0

      Ok. For example, assuming already 2 components created and it's axis origin positioned at the center of the cilinders, this is the Workflow as they appear in the video:

      1. Drop 2 JointSU into the model
      2. Make each JointSU child of each Component
      3. Name both JointSUs
      4. Using "Zero" function, position each JointSU at the Components origin.
      5. Make Component#2 child of Component#1 (create of a product structure)
      6. Using "Set" function, establish the connection of the joints.
      7. Using "Panel" function, reverse the direction of the joint (Flip=true).
      8. Using "Set Anime" function, make this joint able to be part of the animation.
      9. Using "Anime Start", animate the whole model.
      10. Using "Anime Stop", stop model animation.
      11. Using "Panel", re-align the joint to it's original position.

      [flash=425,344:tbflk7u5]http://www.youtube.com/v/xe6SCnkbyjo[/flash:tbflk7u5]

      If interested I have the WMV video in much better quality, but it's 1.3 MB. (do not recall if there is a place to upload such files here).

      Regards
      Marcio

      posted in Plugins
      M
      MarcioAB
    • RE: Posting plugins...

      Starting from Jim's SketchUp-Ruby Resources, what about tag plugins by classes ?
      For example: Mechanical tools, Architecture tools, Kinematics tools, Geometry creation tools, Geometry Modification tools, Measurement tools, (running out of imagination), but I'm sure there could be a nice group of classes out there.
      Having plugins organized by classes, maybe we can extract more conclusions about wants and needs.

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: JoinstSU tutorial ?

      Well, I found something strange in your model: The axis of the JointSU component was not in the center of the component. I do not think you can precisely control things with that, despite the result in your model was interesting. To propose a planet system model, I changed the axis of your jointSU back on center.


      EDIT: The JointSU component in fact is just its axis (and the name). The geometry we create around this axis is just anything to make easy to position this axis in it's parent component. I just created new geometry around the axis of your JointSU and deleted the old one that was far away from the axis. See how your joints were working.
      atom1.skp

      Obs: I prefer to name joints with numbers instead letters. But its just preference.

      Each Planet_System (child of Sun) will have one joint(1) to be aligned with the Sun joint(A).
      This Planet_System joint(1) will control the rotation speed around the Sun (year rotation). So, you need to animate this Planet_System joint(1).

      Each Planet_Ball (child of Planet_System) will have one joint(1) to be aligned with the Planet_System joint(2).
      This Planet_Ball joint(1) will control the rotation of the Planet arount it's axis (day rotation). So, you need to animate this Planet_Ball joint(1).

      And so on ...

      I let the model very incomplete so you can have fun modeling the solar system, by the way an interesting training. You can also model the Moon around Earth, etc ... nice.

      We can not animate the translation of the joint for now, but that is not difficult at this point. With that it's possible to establish a elliptical orbit instead a circular one ... as soon I find some more time.

      I put some stuff on hide in order to make a nicer animation. Just start animation ...

      atom2.skp

      Regards
      Marcio

      how many Joint-children can be allocated to a parent?
      No limitation, but there is no check for an hiper-static condition, for example:
      Parent has joint(1) and joint(2).
      Child has joint(1) and joint(2).
      Establish joint connections (1)-(1) and (2)-(2). This is an hiper-static condition and I do not know what will happen if we ask (1)-(1) to rotate in one direction and (2)-(2) in another ... but the idea is not complicate too much. It's already enough complicated.

      PS: Found more errors on the code, so ... new update.
      JointSU.rb
      JointSU_GUI.rb

      posted in Developers' Forum
      M
      MarcioAB
    • RE: JoinstSU tutorial ?

      Hum ... because the line numbers for JointSU.rb (this time the main classes file) in your side do not match with the ones I have here, maybe you have a previous version. This is part of what I call "software hell".

      Just to remove this doubt, can you replace your JointSU.rb by this one:

      JointSU.rb

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: JoinstSU tutorial ?

      I got your file and I see you are working with GROUPs instead COMPONENTs.
      Well, JointSU is not ready to GROUPs yet, (because they are very different types of objects from programming point of view).
      By the way, I do not use Groups (yet) and I wonder where they are better than components ...

      So, I transformed you file from Groups to Components (follow the file)
      JointSU premiers pas2.skp

      ... and played a little around. Follow the YouTube movie (need improve resolution):

      Obs: After established the joint (with Joint/Set) I just did not made any transformation (like flip, rotate or translate) on the joint and jumped directly to animate the joint. During animation I made the transformations: First flip (HOME key) to make both box front-front, then translations (ARROWS keys). To make large translations I used the "turbo" (SHIFT key). See on the bottom of the screen the values.
      [flash=425,344:2z85ina3]http://www.youtube.com/v/8iyTy0wiNl4[/flash:2z85ina3]

      By the way, I found an error in the GUI plugin (in the animation part). Follow the new one.
      JointSU_GUI.rb

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: JoinstSU tutorial ?

      Yes, sure ( as soon as finish to reinstall all stuff in the new upgraded computer - I blew up my Windows and all installations 😞 during this upgrade).

      In the mean time, the idea is the following:

      1. Make sure you have the component called JointSU. You can use COMPONENTS panel (on SketchUP Windows menu) to double-check if JointSU is there. The plugin has a menu item to create it. It has a special shape to make easy to position it.

      2. Make your first BOX1

      3. Using the COMPONENT panel bring one JointSU into the view.

      4. Using OUTLINE (on SketchUp Windows menu) make this JointSU component child of your BOX1.

      5. Using the several plugin features position the JointSU exactly where you want a joint.

      6. Repeat steps 2-5 for BOX2. (That means at the end you will have 2 BOX and 2 JointSU.)

      7. Using OUTLINE make BOX2 as a child of BOX1. This is the biggest difference from the initial version of this plugin. We can discuss later why this was necessary.

      8. Using the several plugin features, establish a joint/connection between these 2 JointSUs.

      9. Using the other plugin features, control this joint (explode, animate, assemble, etc).

      Give a try and post here what steps do I need to provide further explanations.

      I need to finish the installation of this machine and them will create a YouTube video and manual with pictures.

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: [Plugin] Camera OrbitOnTarget v1

      Great. Let me know if we can improve the interface or anything else.

      Regards
      Marcio

      posted in Plugins
      M
      MarcioAB
    • RE: New Ruby Idea

      Great.

      In parallel, for precise usage (that was my original intention), I think it is better to orbit around a selected point then the center of the bounding box (of a component), but it is not difficult to add.

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: [Plugin] Camera OrbitOnTarget v1

      @xrok1 said:

      please explain the purpose of your plugin?

      Make a simple cube. Center it (using the double-click you mention) targeting any specific point over the cube and Orbit.

      You will find it will not always orbit around that expected point.

      The OrbitOnTarget plugin makes it orbit on the selected point (and by the way, the selection is made using the Inference Engine).

      Regards
      Marcio

      posted in Plugins
      M
      MarcioAB
    • RE: New Ruby Idea

      @daniel s said:

      Not exactly, but something similar that can help you:
      Camera OrbitOnTarget v1

      Daniel S

      πŸ˜‰ ... and what I found great regard the SketchUP is the natural SU inference engine that I used with this tool. You just move the mouse around the model and the inference engine jumps to nice points to Orbit.

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: [Plugin] Camera OrbitOnTarget v1

      @xrok1 said:

      hey! the MMB double click works for me. 😍

      Humm ... my initial expectation regard the Middle Mouse Button was to replace the default tool currently associated with the MMB - that is the standard SketchUP Orbit tool - by this one. But its not possible yet.
      So I think in this case it is pointless to connect any function to MMB if I can only use it when the OrbitOnTarget tool is activated.

      Regard any further development: I used that code in JointSU plugin with minor changes - When you are assembling components I find useful to have "OrbitOnTarget" with the target automatically set on the origin of the component axis you are working on. So, I think the idea now is to embed this "OrbitOnTarget" code into more specific plugins.

      What else could be improved in a tool like this ?

      Regards
      Marcio

      posted in Plugins
      M
      MarcioAB
    • [Plugin] JointSU 1.0

      Advantages to use JointSU:

      1. Easier to handle assembles (specially when reusable).
      2. Re-assemble after move components (explode view).
      3. Animation

      Workflow:

      1. Create a JointSU component (one per model).
      2. Apply an instance of JointSU on any component ("joint-enable" the component).
      3. Structure 2 joint-enabled components as parent-child.
      4. Establish a connection between them.
      5. Repeat for other joints.
      6. Assemble, Animation, Hide/Unhide/Select.

      Pack files:

      The zip pack (MS Windows) has 4 files. JointSU_GUI.rb, JointSU.rb, bike.skp and this file
      For developers, the idea is to have one Ruby file for GUI and Menus stuff and a GUI-less file with classes and modules. Both are necessary to make it work with my proposed GUI.

      The bike.skp demo is my test bed ready for use. You can open the bike file and use << Plugins/JointSU/Animate/Start>> to check the animation. You can move components and sub-components (using normal StechUP move tool) or use << Plugins/JointSU/Explode >> and re-assemble all using << Plugins/JointSU/Assemble >>.
      You can open the SkecthUP Outliner and see my proposed structure for the bike and play around.

      Workflow in Details:

      1.1. Use << Plugins/JointSU/Create JointSU compo >> menu to generate a component with a geometry easy to position on its parent. Or you can create your own geometry. What is important is just this component axis and the name: it must be "JointSU".

      2.1. From << Window/Components >> drag an instance of JointSU into the model and use << Window/Outliner >> to allocate it below the component that will be "joint-enabled".

      2.2. To position the JointSU instance, use SketchUP Move function or << JointSU/Position >> contextual menus over the joint (in Outliner or in the View). The UI (user interface) can be mouse, keyboard or panel.

      2.3. On OUTLINER, edit the associated component of the JointSU and take note of its axis positions, specially, the Z-axis for Alpha rotation. The position tools will be based on these axis.
      Alpha: rotation of the JointSU around this Z-axis.
      Beta: angle relative this XY-plane
      Torsion: rotation around JointSU X-axis
      tip1: use SketchUp "Show component axes" (on Window/Model Info/Components menu) to see the axes.

      3.1. Use << Window/Outliner >>. This is the trick part to establish the behavior of the mecanism.

      4.1. To (easier) establish the joint-joint connection: on OUTLINER, use << JointSU/CameraOnTarget >> on parent-joint and zoom-in. Then on OUTLINER, use << JointSU/Set >> on child-joint and pick in the model view the parent-joint that is zoomed-in. The child-joint (with the corresponding attached joint-enabled component) will snap-on the parent-joint.

      4.2. To handle JointSU geometric parameters (axial translation, axial rotation and flip) use << JointSU/Joint >> contextual menus over the joint (in Outliner or in the View). The UI (user interface) can be keyboard or panel.

      6.1. Use menu << Plugins/JointSU/Assemble >> to re-assemble all the joints back on its original (in dictionary) parameters. You can use SketchUP Move tools to mess all around with the components and than just re-assemble in one click.

      6.2. Use menu << Plugins/JointSU/Explode >> to create an exploded view of the structure. OBS: This must be improved because the generated exploded view is "ugly" to say minimal. But at least it is a starting point to manually create a looking better exploded view.

      6.3. Use contextual menu << JointSU/Joint/Set anime >> to set animation parameters (active true/false and the rotation step) ... this will be improved in the future.

      6.4. Use menus << Plugins/JointSU/Animate/Start>> and << ../Stop >> to initiate the animation.

      6.5. Use menus << Plugins/JointSU/Hide/Unhide >> to hide/unhide/select the joints.

      Extra: JointSU/CameraOnTarget

      1. Select component (on Model View or Outliner).
      2. Activate CameraOnT (on JointSU contextual menu).
      3. The Component axis will be centered on the View.
        • Rotate (LButton), Zoom (+Shift) and Pan (+Ctrl) the View related this axis.
        • ReCenter (Double click) to bring back the Component axis to View center.
      4. Escape (Esc) or select another tool to exit.

      Works only for Components and the target is always fixed (on Component axis). There is another plugin for general use.

      JointSU pack.zip

      ENJOY
      Regards

      Marcio de A. Braga - Jan/2009

      posted in Plugins
      M
      MarcioAB
    • RE: [Plugin] JointSU (in drafting)

      Finally I have version 1.0

      Now it's highly dependent of the product structure (or OUTLINER), but seems to work well ... I will post it in a NEW thread. Enjoy and lets see how to improve this ...

      Regards
      Marcio

      posted in Plugins
      M
      MarcioAB
    • RE: [HowTo] update view to make animation

      @malaise said:

      Hello MarcioAB

      Best wishes for 2009
      Your script sounds promiser, let's know us your improvements πŸ˜„.

      MALAISE

      Welcome. I'm having fun with this. I will post it later today.
      I need to include some animation of the bike based on it's joint-enabled-components.
      ... and some documentation.

      posted in Developers' Forum
      M
      MarcioAB
    • RE: [HowTo] update view to make animation

      @unknownuser said:

      All you need should be to invalidate the view inside your loop, as long as you have a Tool class. Post a small, complete, failing example.
      Todd

      This is the code I was expecting to work:

      
      def callA
        joint=JointSU.new # see explanation below
        Sketchup.active_model.select_tool(ViewSpinner2.new(joint))
      end
      
      class ViewSpinner2
      def initialize(j)
        @jointSU=j
        r=@jointSU.getParentComponents
        @c=r[2]
        t2=r[0].transformation
        @t=Geom;;Transformation.rotation(t2.origin,t2.xaxis,-PI/45.0)
        for i in 1..10
         @c.transform!(@t)
         Sketchup.active_model.active_view.invalidate
         sleep(0.1)
        end
      end
      end # Class
      
      

      No error message. I see the @c instance in the first position and than in the last position. I do not see the intermediary positions.

      Obs: JointSU is now a (long) class (I will post it later today), but for this discussion, the method "getParentComponents" provide data to allow establish a point and an axis for the @t rotation transformation.

      On the meantime I just found this code in the examples and it works:

      
      def callB
        joint=JointSU.new
        Sketchup.active_model.active_view.animation = ViewSpinner.new(joint)
      end
      
      class ViewSpinner
      def initialize(j)
        @jointSU=j
        r=@jointSU.getParentComponents
        @c=r[2]
        t2=r[0].transformation
        @t=Geom;;Transformation.rotation(t2.origin,t2.xaxis,-PI/45.0)
      end
      
      def nextFrame(view)
        @c.transform!(@t)
        view.show_frame
        true
      end
      end # Class
      
      

      But I still prefer the first one - if it worked (must be missing something I can not see ...)

      Thanks
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • [HowTo] update view to make animation

      Hello - Happy 2009 for all of us.

      I'm just finishing a new version of a script (JointSU) but I can not show the "animation" of an instance in SU. I need help to find how to update the View for each step in a loop. For example, consider the code below:

      
      transf=Geom;;Transformation.rotation(pt,vector,angle)
      for i in 1..10
       instance.transform!(transf)
       sleep(1)
      end
      
      

      When I run this code, I just see the instance in the initial position, 10 seconds of nothing and the instance in the final position and not each intermediary steps.
      In a trial and error basis, I tried Sketchup.active_model.active_view.invalidate, Sketchup.active_model.active_view.show_frame, Sketchup.active_model.active_view.draw but no luck.

      Any help is much welcome.
      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: CALLING ALL MATRIX GURUS, HELP! , please :)

      2nd thought ... based on your data:

      target => 3Dpoint of [0.999938,0.001129,-0.011103]
      eye => 3Dpoint of [1.054297,1.571880,-8.966838]
      up => 3Dvector of [-0.011108,0.005189,-0.999925]

      Can not test because not have a working system here ...

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: CALLING ALL MATRIX GURUS, HELP! , please :)

      The 16-elements matrix you show up, have Origin, Axis, Scale data relative to a parent coordinate system (can be the Global system but can also be the coordinate system of it's parent component).

      The first line has the x,y,z projections (in the parent's coordinate system) of vector X of the axis. Then the scale in this direction.
      The same for the other 2 lines regard vector Y and Z of the axis.
      The last line has the axis' coordinates x,y,z (in the parent's coordinate system). And the last number is the overall scale.

      You can create a TRANSFORMATION directly with this 16-elements matrix and apply it to an object that accepts transformation method, BUT ... Camera does not accept transformation method.

      Instead, Camera has it's own "transformation" method that is called SET. The SET method is based on:

      • Target: a 3Dpoint where the Camera is looking for.
      • Eye: a 3Dpoint where the Camera is.
      • Top: a 3Dvector indicating the rotation of the camera regard the direction Eye-Target. Normally it's the Z-direction, to make the camera stand up.

      This is what the "on-line" manual says for Camera Class
      Please take a look in CameraOOT

      Regards
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • RE: [HowTo] Make SendKeys (WIN32OLE) works &quot;immediately&quot; ?

      😳 Just discovered I can Close components with "Sketchup.active_model.close_active"

      Thank you, but even with sleep(5) and bring the window to focus ... no success to trigger "Edit Component" shortcut ("Y").

      p Sketchup.active_model.active_path
      s=WIN32OLE.new("WScript.Shell")
      p s.AppActivate("SketchUp")
      sleep(5)
      p s.SendKeys("y")
      sleep(5)
      p Sketchup.active_model.active_path
      
      posted in Developers' Forum
      M
      MarcioAB
    • [HowTo] Make SendKeys (WIN32OLE) works &quot;immediately&quot; ?

      I'm trying to follow this topic from TIG to be able to Open/Close Components but it is not working as I was expecting. SendKeys only sends the key after all code finish and not immediately, example:

      Assume I have "x" as a shortcut to "Edit/Close Component", a child component Opened (Edit) and want to Close it. This is the code:

      def test
      p Sketchup.active_model.active_path
      WIN32OLE.new("WScript.Shell").SendKeys("x")
      p Sketchup.active_model.active_path
      end
      

      The first Active_path show
      [#Sketchup::ComponentInstance:0x4a79290, #Sketchup::ComponentInstance:0x4a79278]

      but the 2nd Active_path (still) show
      [#Sketchup::ComponentInstance:0x4a79290, #Sketchup::ComponentInstance:0x4a79278]

      Because ComponentInstance:0x4a79278 was Closed, it should show
      [#Sketchup::ComponentInstance:0x4a79290]

      When the above code finish in fact the Active_path is on [#Sketchup::ComponentInstance:0x4a79290], but not ("immediately") during the code execution. It's like SendKeys kept "x" buffered and just release it when SketchUp assume control.

      Am I missing something, Can SendKeys works immediately, or Is there a workaround ?

      Thank you
      Marcio

      posted in Developers' Forum
      M
      MarcioAB
    • 1 / 1