ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • ( [ 0,0,0 ].vector_to( [ 0,0,0 ] ) ).length.mm < 0.01.mm

    6
    0 Votes
    6 Posts
    119 Views
    D
    Very informative site in did. Thank you. I am a hardware engineer by training - so I know this problem from the other side and still it is a little strange
  • Rounding numbers

    7
    0 Votes
    7 Posts
    376 Views
    thomthomT
    @genma saotome said: Seems like updating the version of ruby used for Sketchup would he most helpful. Any reason for Trimble to do that as a routine step or is this one of those don't fix it if it ain't broke situations? They've tried earlier, but it was troublesome. However, from the talks at Basecamp it did appear they are again looking to update the Ruby core.
  • My first script

    3
    0 Votes
    3 Posts
    330 Views
    thomthomT
    To get input data from the mouse you got either InputPoint class or PickHelper. It depends what you are looking for. InputPoint gives you inferences is is similar to what for instance the Line tool uses. PickHelper is more for being abel to select Entities. Either way, You want to oolk into the Tool class. As for units which jolran mentioned, I got an overview of how to deal with units in SU here: http://www.thomthom.net/thoughts/2012/08/dealing-with-units-in-sketchup/ You basically should not do so much work with it. Keep everything in inches, the internal units, preferable in the Length class and let SU do the work of converting back and forth between internal units and model units.
  • Add items to submenu later on

    11
    0 Votes
    11 Posts
    786 Views
    Dan RathbunD
    The two main problems we have: (1) Menu object references on the C++ side are garbage collected quite quickly, and the references on the Ruby-side become invalid. We can live with having to recall UI.menu() to get new valid references to the 9 top level menus, but ... (2) the menu#add_submenu method should return a new valid reference to the submenu IF IT ALREADY EXISTS, or create the submenu if it does not. Currently it just creates a duplicate submenu. I am sure that this issue has already been logged. I so much hope that SketchUp v2013 will fix this (if no more updates to v8 will be released.) So.. for now... once the startup cycle is complete, we cannot add items to ANY of the previously created submenus.
  • One Submenu for many plugins

    4
    0 Votes
    4 Posts
    627 Views
    Dan RathbunD
    Although this should work.. because of current API bugs. It will not. See thread: http://sketchucation.com/forums/viewtopic.php?f=180&t=49912&p=449979#p449362
  • Get Point3D from place_component

    6
    0 Votes
    6 Posts
    188 Views
    F
    @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
  • Scale along custom axis

    10
    0 Votes
    10 Posts
    1k Views
    Dan RathbunD
    If that works (and likely it does 'cause it's Adam talking,) can it be moved to the first post, retitled as a snippet topic, and comments inserted explaining WHY it works ?
  • SketchUp Engine

    7
    0 Votes
    7 Posts
    843 Views
    AdamBA
    Yes. But on a Mac, use Activity Monitor and click "Sample" to see this.
  • Writing and reading Marshal data to attributes?

    9
    0 Votes
    9 Posts
    1k Views
    thomthomT
    That will be troublesome. Even if you create your own wrapper class that takes a Sketchup::Material into a class that does support marshalling you have the issue of the Ruby API not being able to set the Colourize property. And you'd have to figure out a way to handle the texture, as you say. You could write that Base64 encoded or something, but you cannot restore it to reference the original filename. Why do you need to store the whole Material object?
  • Ruby (eval):1: warning: Float out of range

    15
    0 Votes
    15 Posts
    2k Views
    D
    Dan, I made some progress making this importer a little more usable. Pleas see if you have more advice for me. P.S. I deleted all the old versions from this thread and updated the top thread's file. Thank you. David.
  • Make all selected unique script?

    7
    0 Votes
    7 Posts
    310 Views
    ApofisyA
    @tig said: ### Makes all selected instances unique and edits names... > ### Copy all of this text into a text-file called something like > ### makeallselectedunique.rb - in the Plugins folder... > ### type 'makeallselectedunique' in the Ruby console > ### it works on current selection > def makeallselectedunique() > ints=[];Sketchup.active_model.selection.each{|e| > if e.typename=="ComponentInstance" > e.make_unique ### make instance unique > ints.push(e) ### keep list of these instances > end#if > }#end each > ints.each{|e|name=e.definition.name > ### name with '#nn' on end, e.g. ABC#2 > prefix=(name.split("#")-[name.split("#").last]).to_s > prefix=name if prefix=="" > ### e.g. ABC > suffix=name.split("#").last.to_i ### e.g. 2 as integer > suffix=1 if suffix<1 > ### check all extg defs for possible new name > Sketchup.active_model.definitions.each{|d| > suffix=suffix+1 if d.name==prefix+suffix.to_s > ### e.g. ABC2 exists so try to make it ABC3 etc > } > newname=prefix+suffix.to_s > e.definition.name=newname ### renames definition > puts name+" >>> "+newname ### put a # in front of this line to stop console printout > }#end each > return nil > end#def Hello, i need a similar script but i don't know ruby i need to edit all names but not all definitions and just add a counter after the name like this: furniture.Floor.01,furniture.Floor.02,furniture.Floor.03,...,furniture.Floor.10,furniture.Floor.11,furniture.Floor.12,.... where name is the name of the object. Also if there are some object like furniture.Floor.01 and furniture.Floor.02 for example the script can start to add counter from 03. Can you edit your script with my requests please? I'm waiting for your reply, thank's.
  • No tabs possible in text?

    7
    0 Votes
    7 Posts
    125 Views
    liquid98L
    Thanks guys. It seems this is a PC only bug. So far no reason to buy a mac..
  • Find the position of a group in the active context

    6
    0 Votes
    6 Posts
    167 Views
    D
    I solved the problem, the key was to use "mod.edit_transform.origin" I leave the code in case anyone needs it one day mod = Sketchup.active_model sel = mod.selection parert_origin = mod.edit_transform.origin entity_origin = sel[0].transformation.origin distance = entity_origin-parert_origin tr = mod.edit_transform.inverse distance.transform tr
  • Web dialog and cookies on Mac

    7
    0 Votes
    7 Posts
    110 Views
    S
    @dan rathbun said: Would it easier to use the LocalStorage interface instead of cookies ? Dan, Thanks for the tip! I tried it, and it not only works more portably, it is cleaner code. Steve
  • [Code] Material.names to Webdialog.

    55
    0 Votes
    55 Posts
    686 Views
    jolranJ
    @unknownuser said: Isn't that just because the model in your screenshot are mainly thin edges? Yes, thats true. That the components that has faces and materials come out better. Increasing the contrast on those thumbs too much make things worse. So I have found an acceptable between value around + 45 contrast, that all thumbs can benifit from. How to apply it is a different story I can live with the bad aliasing... One can affect some color when saving the component, playing with styles. But havent found any settings that gives me what I want. At it only seems to affect face.materials. @unknownuser said: And is that thumbnail in 100% scale? Thumbs are 100% scale. They look the same in Photoshop. From PS: 80% increase in contrast look really good on edges. [image: eBKC_contrasts.jpg]
  • Rescue Exception

    15
    0 Votes
    15 Posts
    2k Views
    Dan RathbunD
    OK I understand ... Visual Basic: CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator
  • Will this work on Mac OS?

    4
    0 Votes
    4 Posts
    137 Views
    D
    hi, you may need a java version test, as mac no longer ships with it pre-installed, it does however recomend installing as part of the start-up sequence. so, from ruby console java_version=(`java -version 2>&1`).split("\n")[0].to_s.split[-1] "1.6.0_37" john
  • How to save dxf file with embedded thumbnail image?

    9
    0 Votes
    9 Posts
    3k Views
    Dan RathbunD
    Could be a job for ImageMajik ?? Embedding encoded thumbnails INTO the file, will bloat the filesize.
  • API Methods by SU Version - 2012 year end edition

    5
    0 Votes
    5 Posts
    114 Views
    Dan RathbunD
    FYI: two other threads on send_action() Sketchup.send_action() : Arguments to Sketchup.send_action arguments: Mac vs PC I have begun a reference spreadsheet (in ods format) on the many actions (many not documented elsewhere,) but it is not fully complete.
  • Easy way for offset of a face

    5
    0 Votes
    5 Posts
    132 Views
    N
    Thanks a lot Chris! Okay, no problem, then I start with my ideas! In my case, I have always faces with z = 0. So, I think, it should reduce the complexity of my project I will public my solution for other people...

Advertisement