ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Tube or pipe that changes sizes?

    3
    0 Votes
    3 Posts
    236 Views
    mitcorbM
    Other tools you could use: Lines to Tubes. Pipe on Path Tube on Path Fredo Scale step by step, ring by ring with orientation of scaling to orientation of rings. Curviloft, also, in a series of sections.
  • InputPoint and snapping

    13
    0 Votes
    13 Posts
    532 Views
    TIGT
    If you are trying to get a picked_point onto a 'plane' you use point.project_to_plane. If you are mimicking the 'Rotate Tool' then before you get to that step you will pick a center_point [which is by definition on that plane]. You will next set the axis/normal for the rotation [which is a vector needed to define the plane]... You define a plane as plane=[center_point, normal_vector]... So now you have everything you need to project the next picked_point onto that plane... When you take a mouse_click event the returned view inputpoint can be used to return a Point3d [ip.position] AND with a view pick_helper an entity type [or even types using several pick_helpers] - e.g. an edge or a face. If your code somehow destroys the inputpoint [?] then clone it with a 'copy' before hand and use the copy in your second bit of code... So you can click and return a point in the model and object(s) at that point. A bit of simple math will transform that point onto a predetermined 'plane' as explained above...
  • SketchUp Sunday Social (SUSS)

    3
    0 Votes
    3 Posts
    215 Views
    RichMorinR
    @khai said: open only to programmers or to all? Open to anyone, but be prepared for a programming focus to any substantive discussions. If demand warrants, I'm sure we could have events aimed at a modelers and others, but my own background and interests lie in programming.
  • [APIBug] Applying current material might cause bugsplat

    11
    0 Votes
    11 Posts
    530 Views
    TIGT
    Here's a short code snippet <span class="syntaxdefault"></span><span class="syntaxkeyword">=</span><span class="syntaxdefault">begin<br /></span><span class="syntaxkeyword">(</span><span class="syntaxdefault">c</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> TIG 2011<br /></span><span class="syntaxkeyword">=</span><span class="syntaxdefault">end<br />require </span><span class="syntaxstring">'sketchup.rb'<br /></span><span class="syntaxdefault">require </span><span class="syntaxstring">'SKMtools/material_class.rb'<br /></span><span class="syntaxcomment">###<br /></span><span class="syntaxdefault">def material_from_limbo</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault">    mats </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">materials<br />    cmat </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mats</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">current </span><span class="syntaxcomment">### the limbo one<br /></span><span class="syntaxdefault">    cname </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> cmat</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">display_name<br />    cmat</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> cname</span><span class="syntaxkeyword">+</span><span class="syntaxstring">"x"<br /></span><span class="syntaxdefault">    cmat </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mats</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">current<br />    cmat</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">name </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> cname<br />    cmat </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> mats</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">current<br />    return cmat </span><span class="syntaxcomment">### now safely added to model<br /></span><span class="syntaxdefault">end<br /></span><span class="syntaxcomment">### usage; cmat = material_from_limbo<br /></span><span class="syntaxdefault"> </span> If you select a material from the library and then immediately run the 'usage' example you will have a reference to the new current material that is added to the model [but currently unused]. The active tool will stay as the paintbucket unless you code an alternative 'tool' change...
  • Definition.instances upset

    3
    0 Votes
    3 Posts
    229 Views
    chrisglasierC
    Takk! Now you have said it I feel somewhat foolish ... oh well ... time to go to the pub. Maybe next year I can do better. Happy New Year to you and all the other members. Chris
  • Inpupoint pick problem

    2
    0 Votes
    2 Posts
    198 Views
    thomthomT
    Initialize your variable in the correct scope. <span class="syntaxdefault"><br />class My_Tool<br />   def initialize<br />     </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">ip1 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">InputPoint</span><span class="syntaxkeyword">.new<br /></span><span class="syntaxdefault">     </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">ip2 </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">InputPoint</span><span class="syntaxkeyword">.new<br /></span><span class="syntaxdefault">     </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">point_flag </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 1<br />   end<br /><br />   def activate<br />      puts </span><span class="syntaxstring">"Activate"<br /></span><span class="syntaxdefault">   end<br /></span> Explanation: http://sporkmonger.com/2007/2/19/instance-variables-class-variables-and-inheritance-in-ruby http://railstips.org/blog/archives/2006/11/18/class-and-instance-variables-in-ruby/
  • How is this possible ?

    12
    0 Votes
    12 Posts
    566 Views
    TIGT
    @didier bur said: Partial answer here: http://www.postal-code.com/mrhappy/blog/2007/02/01/ruby-comparing-an-objects-class-in-a-case-statement/ and here http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/3d83faf049160e58 This works: case Sketchup.active_model.selection[0] > when 'Sketchup;;Face' > puts "face" > ... The simplest the best ! So in your case def test() case Sketchup.active_model.selection[0] when Sketchup;;Face puts "face" when Sketchup;;ComponentInstance puts "instance" when Sketchup;;Group puts "group" when Sketchup;;Image puts "image" when Sketchup;;Edge puts "edge" else puts "something else" end end should work ??? Avoiding the .to_s step
  • [prototype] Doublecut (0.1.0a) - Need help debugging

    39
    0 Votes
    39 Posts
    26k Views
    TIGT
    Thomthom One week later... Here's v1.4 http://forums.sketchucation.com/viewtopic.php?p=271170#p271170 Which now supports copying/arraying punching-components etc... It has a plethora of convoluted observers and linked attributes BUT it now works...
  • Help with opening additional instance of SketchUp.

    17
    0 Votes
    17 Posts
    916 Views
    Dan RathbunD
    @honoluludesktop said: I see that your version of DOS is 6.1. Is this its original release, or the one that came with your WinOS? Which machine were you on at the time? I have a copy of DOS 6.1 (left over from the good old days) installed in a VPC. FYI ... DOS 6.22 came out at the same time as Win 3.11 for Workgroups (I still have my disks and manuals as well.) DOS 7 was distroed with Win98 (not sure about Win95.) Win 2000 & up are NTFS not DOS. BUT ... you misread the image. It is the Windows ver that is displayed, not DOS. Win 5.0 = Windows 2000 Win 5.1 = Windows XP Win 6.0 = Windows Vista Win 6.1 = Windows 7
  • Lathe Tool

    10
    0 Votes
    10 Posts
    658 Views
    B
    The reason I ask is because I'm very new to sketchup-ruby scripting. I enjoyed making pipe sculptures, so I got the free version of 3SKENG when it was avalable. (it's not available for a free download anymore :evil: ) So I said why not give myself a challenge and try to make 3SKENG myself. I just wanted the plugin to create the geometry, without any mouse gestures or vcb. I allready knew how to use UI.inputbox, so I decided to just use that. (does anyone know how to redefine the defaults to match the last usage?) I was hoping someone knew a simple lathe tool. So far I'v got it to make all the circles in the curve, but I don't know how to connect them. PS. Sorry I yelled. :ashamed:
  • Help with acess to registry from observer

    10
    0 Votes
    10 Posts
    333 Views
    Dan RathbunD
    There'a a major drawback to using the API "default" methods. That is they did not give us a "remove_default" method. This means the Win Registry or Mac plist can become cluttered with old 'orphaned' settings for plugins that are no longer used. Many authors (TIG is one I think,) that instead write out their own settings file in the plugin subfolder. I think he has posted code snippets in other topic threads. Basically you write out a string report of your settings Hash to a text file, using the inspect method. To reload it, you read the file into a String object, and then eval() the string inside the context of your module, assigning it to a var, which should become type Hash after evaluation.
  • How to close Sketchup

    13
    0 Votes
    13 Posts
    1k Views
    honoluludesktopH
    @dan rathbun said: ...........refers to the module namespace that you are defining the method within......... OK, I get that. Thanks.
  • Exit/Shutdown SU 7 ??

    14
    0 Votes
    14 Posts
    3k Views
    Dan RathbunD
    @alexmozg said: > def Sketchup;;exit > model = Sketchup.active_model > model.save "temp_model.tmp" if model.modified? > Sketchup.send_action 57602 > end#def > Model doezn't realy save. Do NOT use exit as a method name !!! It is already defined as a global method by the Kernel module (and so is inherited by ALL classes and modules.) exit() Initiates the termination of the Ruby script by raising the SystemExit exception. Also runs any at_exit block methods before termination.
  • Sizing SketchUp window

    7
    0 Votes
    7 Posts
    2k Views
    honoluludesktopH
    Great, Thanks I can experiment.
  • X-Mouse Window Focus for Mac OSX ??

    17
    0 Votes
    17 Posts
    5k Views
    thomthomT
    @dan rathbun said: @thomthom said: Will have to look into this. OK good.. get with John (driven) directly. Since I don't have a Mac, I cannot recreate his situation. Your in a better position to help him (he wants to use Jim's Mover plugin with 1 click.) I'm wondering if one of those shell commands (in the forum topics would work,) like ?? %(#4000BF)[defaults write com.apple.Safari FocusFollowsMouse -string YES] OR %(#4000BF)[defaults write com.google.Sketchup FocusFollowsMouse -string YES] OR whatever... Found this: http://mactips.dwhoard.com/mactips/x11-and-terminal/x11-click-through Doesn't modify the focus follow mouse behaviour, but allows clicks to go through at first click. But I'd prefer to find a per-window setting instead of a per-application setting.
  • Help inserting a skp into a model.

    6
    0 Votes
    6 Posts
    243 Views
    honoluludesktopH
    Thanks guys.
  • Display Section Cuts

    6
    0 Votes
    6 Posts
    285 Views
    thomthomT
    @unknownuser said: I agree. What we need is that everything what you can do with SU is also supported in the API. I don't know why there are some parts that aren't supported (sectionplanes, Export 2D graphic (dxf), ...) Dimensions, several Material & Layer methods ... the list goes on...
  • Can sketchup do this

    7
    0 Votes
    7 Posts
    5k Views
    D
    The pushpullbar project linked to was actually developed in Rhino with Rhino-specific scripts so while some of the info will be useful, you will have to look elsewhere for your answer...
  • Ruby C extension load issue in SketchUp

    3
    0 Votes
    3 Posts
    695 Views
    K
    Thank you. Now It works fine.
  • Face Dimensions

    5
    0 Votes
    5 Posts
    346 Views
    thomthomT
    As requested per PM: <span class="syntaxdefault"><br /></span><span class="syntaxcomment">#&nbsp;Returns&nbsp;nil&nbsp;if&nbsp;the&nbsp;face&nbsp;is&nbsp;not&nbsp;a&nbsp;circle.<br />#&nbsp;Returns&nbsp;the&nbsp;radius&nbsp;on&nbsp;success.<br /></span><span class="syntaxdefault">def&nbsp;self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_circle_radius</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">edges&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">outer_loop</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">edges<br />&nbsp;&nbsp;edge&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">edges</span><span class="syntaxkeyword">[</span><span class="syntaxdefault">0</span><span class="syntaxkeyword">]<br />&nbsp;&nbsp;return&nbsp;</span><span class="syntaxdefault">nil&nbsp;unless&nbsp;edge</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">curve</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(&nbsp;</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ArcCurve&nbsp;</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">edge</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">curve</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">radius<br />end<br /></span> <span class="syntaxdefault"><br /></span><span class="syntaxcomment">#&nbsp;Returns&nbsp;nil&nbsp;if&nbsp;the&nbsp;face&nbsp;is&nbsp;not&nbsp;a&nbsp;semi&nbsp;circle.<br />#&nbsp;(ArcCurve&nbsp;and&nbsp;one&nbsp;edge&nbsp;connecting&nbsp;each&nbsp;curve&nbsp;end)<br />#&nbsp;Returns&nbsp;the&nbsp;radius&nbsp;on&nbsp;success.<br /></span><span class="syntaxdefault">def&nbsp;self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">get_semicircle_radius</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">)<br />&nbsp;&nbsp;</span><span class="syntaxdefault">edges&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">outer_loop</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">edges<br />&nbsp;&nbsp;curve_edges&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">edges</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">select&nbsp;</span><span class="syntaxkeyword">{&nbsp;|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|&nbsp;</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">curve</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(&nbsp;</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">ArcCurve&nbsp;</span><span class="syntaxkeyword">)&nbsp;}<br />&nbsp;&nbsp;</span><span class="syntaxdefault">curve&nbsp;</span><span class="syntaxkeyword">=&nbsp;</span><span class="syntaxdefault">curve_edges</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">first</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">curve<br />&nbsp;&nbsp;</span><span class="syntaxkeyword">return&nbsp;</span><span class="syntaxdefault">nil&nbsp;unless&nbsp;curve_edges</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">all</span><span class="syntaxkeyword">?&nbsp;{&nbsp;|</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">|&nbsp;</span><span class="syntaxdefault">e</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">curve&nbsp;</span><span class="syntaxkeyword">==&nbsp;</span><span class="syntaxdefault">curve&nbsp;</span><span class="syntaxkeyword">}<br />&nbsp;&nbsp;</span><span class="syntaxdefault">edge&nbsp;</span><span class="syntaxkeyword">=&nbsp;(</span><span class="syntaxdefault">edges&nbsp;</span><span class="syntaxkeyword">-&nbsp;</span><span class="syntaxdefault">curve_edges</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">first<br />&nbsp;&nbsp;</span><span class="syntaxcomment">#&nbsp;At&nbsp;this&nbsp;point&nbsp;you&nbsp;have&nbsp;all&nbsp;the&nbsp;data;<br />&nbsp;&nbsp;#&nbsp;curve&nbsp;refers&nbsp;to&nbsp;the&nbsp;ArcCurve&nbsp;of&nbsp;the&nbsp;semicircle<br />&nbsp;&nbsp;#&nbsp;edge&nbsp;refers&nbsp;to&nbsp;the&nbsp;Edge&nbsp;connecting&nbsp;the&nbsp;ArcCurve's&nbsp;ends<br /></span><span class="syntaxdefault">end<br /></span>

Advertisement