🏒 PlaceMaker | 25% off for February including new Google Earth data imports! Learn more
  • Groups, Instances and Entities...

    4
    0 Votes
    4 Posts
    116 Views
    N
    Sorry for rehashing old problems. I did look around the forums. Guess I just wasn't looking properly. Your reply was clear and concise TIG. I tried your code out and it worked a charm. Cheers!
  • [Code] FAQ: Detect if plugin is running on the Mac vs PC ?

    6
    0 Votes
    6 Posts
    2k Views
    Dan RathbunD
    Neither do I, as I had said in the OP.
  • [??] How to pass a variable from main.rb to a boxtool

    11
    0 Votes
    11 Posts
    166 Views
    R
    Finally it works!!... BUT I had to move the rs_main.rb from the "\Plugins\as_plugins\as_rubyeditor\snippets"-folder to the "\Plugins"-folder, and then restart SU. At start up it showed the Alertbox "Helle World". BUT It won't work if I use the playbutton in AS-code editor. It seems like, when using modules, it has to be loaded into SU at startup. I wonder if there is a way to come around this? EDITED 1: It can be run directly from the snippet folder with ruby console (then SU requires no restart): load 'c:\path to the program\Google SketchUp 7\Plugins\as_plugins\as_rubyeditor\snippets\rs_main.rb' EDITED 2: in rs_main.rb require is changed to load. Then it updates the variables when its changed. So far so good! Thank you...
  • Limit on number or size of images to import

    8
    0 Votes
    8 Posts
    193 Views
    Dan RathbunD
    Oh OK.. I see ... "paper dolls" I think the Watermark feature is too rudimentary. Match Photo would be more the thing to use. Too bad the images are a bit blurry. You could also import the elevations as a series of DWG views and they would be at scale, and actual edges.
  • Sketchup Plugin Debugger

    6
    0 Votes
    6 Posts
    2k Views
    Dan RathbunD
    It is for Smustard Menu Organizer
  • My Shadows Settings Panel can't be displayed

    3
    0 Votes
    3 Posts
    105 Views
    JClementsJ
    Only way the problem could be resolved was by reinstalling SU over the existing installaton. Thank you for trying to help out.
  • <=> to determine version newer or older?

    9
    0 Votes
    9 Posts
    128 Views
    thomthomT
    Oh, that works as well... And I've been comparing each value by itself when putting it all in an array works just as easy...
  • Face or line or vertex inside a solid

    4
    0 Votes
    4 Posts
    136 Views
    voljankoV
    Hello Tig, I have also thought about rays. What do you think about this solution: If the tested object and a solid are not intersecting. If a ray from a tested object hits faces of a solid odd number of times ,the tested object is inside the solid. If the ray hits an edge or a vertex,repeat the ray test in other direction. David
  • What? No Menu?

    15
    0 Votes
    15 Posts
    485 Views
    snicoloS
    @cjthompson said: That's because the code is executed all during one frame, which also explains why the one-liner works. My guess is that Sketchup creates a new menu , adds the items, and does the validation each frame, instead of just using one menu. This is exactly right. It depends on the context available when commands are executed. Another way to specify multi-line commands in Ruby is to use '' You could do: x = UI.menu('Plugins') \ x.add_item('Hello') { puts "World" } \ x.add_item('Hello2') { puts "World2" } and it would work and be all executed as a single command.
  • Create new layer with an RGB colour

    5
    0 Votes
    5 Posts
    255 Views
    Dan RathbunD
    If you are starting with a fresh new model.. ie, Sketchup.active_model.modified? == false && Sketchup.active_model.title.empty? == true && Sketchup.active_model.path.empty? == true .. then you could open a new file from a template, that had the layers already set up. Otherwise... ... you can create a component definition, that has nothing but cpoints on your preset layers (names and colors and visibility,) and then save the component to your local component library. Then anytime you wish to use those layers, either manually open the component library and click on that component (you do not actually need to insert it into the model.) Here's a little SKP that has EIA colors assigned to Layer1 thru Layer9. (These are the colors you see on resistors or capacitors, that indicate their value. Sometimes also used by rainbow ribbon cables, to indicate pin number.) EIA_Color_Layers.skp Or.. via Ruby, you can load that component (say from a plugin sub-folder.) module Author module CustomLayers class << self def add_landscape_layers() plugs = Sketchup.find_support_file("Plugins") path = File.join(plugs,"Author/CustomLayers/LandscapeLayers.skp") mdl = Sketchup.active_model() defnset = mdl.definitions() landscape_layers_defn = defnset.load( path ) trans = Geom;;Transformation.new() # default identity transform inst = mdl.entities.add_instance(landscape_layers_defn,trans) inst.erase! end # def add_landscape_layers() end # proxy class end # submodule end # Author's toplevel module One drawback is that the color for the default layer ("Layer0",) must be set in the template files.
  • Length conversion problems

    3
    0 Votes
    3 Posts
    116 Views
    T
    Thanks very much, TIG
  • Observers work differently depending on how Sketchup starts?

    9
    0 Votes
    9 Posts
    1k Views
    P
    @dan rathbun said: The API docs say this won't work... because the file is already open (on PC,) by the time the AppObserver gets loaded. Dan, In my script: When double-click on SU file opening the model in SU execute PRODUCE.sceneobserver (automatically) A Appobserver is also created (which fires PRODUCE.sceneobserver again, but since there already is an observer there is no new one created) When a model is then opened from the file menu the Appobserver is called Logically and after testing this seems to work ok. My code here is not complete though, since in my code there is another check to see if the framobserver must be created or not (depending if the opened model has some specific settings)
  • Model.raytest broken in SU8!

    58
    0 Votes
    58 Posts
    5k Views
    thomthomT
    hmm - would be nice with a C++ Hello world of a Ruby Extension.
  • Boolean: how do I 'outershell' multiple groups/components?

    12
    0 Votes
    12 Posts
    947 Views
    Dan RathbunD
    @liquid98 said: good guess! that's the plan indeed. I did not guess ... I can read your mind (scary music: [Oooo ooOOooo ooooo]) No actually, I read your sample code in the post of 17 MAR ... the first two lines you are opening a skp file, within the code. In that post, you wrote: @liquid98 said: But the script I'm writing is for internal use. Is this to be used within a commercial setting (for commercial work.) ??
  • Create Texture via Ruby or/and win32-api

    3
    0 Votes
    3 Posts
    277 Views
    A
    @dan rathbun said: FYI... SketchUp uses PaintLib internally. It's openSource... see: http://www.paintlib.de/paintlib/ and the source here: http://sourceforge.net/projects/paintlib/ Thanks, converting textures to the other formats, sounds good. Is there is a reference on how to create a bmp(a simple file mode) file, set the width/height of the image and set the color of the each pixel?
  • New URL for SketchUp's API documentation

    21
    0 Votes
    21 Posts
    5k Views
    P
    For me it's simple: For registered users give the opportunity to comment on incorrect information/give more explanation and give possibility to add code examples. I always like the way PHP does it: http://php.net/manual/en/function.include.php If you give us the tools, we help you with the content...
  • Rubber Duck Debugging

    2
    0 Votes
    2 Posts
    289 Views
    P
    'explains code to an inanimate object' I'd prefer this: [image: beer.jpg] Downside is that after a while you'll need to debug what you are saying
  • Material names changed by SketchUp

    4
    0 Votes
    4 Posts
    509 Views
    TIGT
    Recent versions of the API allow you to change a material's name in code. If you have a tool that's using a file of data that is material-name specific then clearly you need to know which of the possible materials with similar names it is to be applied to. There are several possibilities. You manually add a material from a library with the name 'Stonewall', there is NO preexisting material with that name, and therefore the new material gets called 'Stonewall'. You have a material already in the model named 'Stonewall' and you manually add a material from a library with the same name, and therefore the new material gets called 'Stonewall1'. You have a material already in the model named 'Stonewall' and you manually add a material from a library with the same name, and therefore because there's also a material in the model named 'Stonewall1' the new material gets called 'Stonewall2' [this will go on until 'Stonewall999' and beyond!]. You have a material already in the model named 'Stonewall1' and you manually add one from a library with the name 'Stonewall', and because there's NO material in the model named exactly 'Stonewall' so the new material gets called 'Stonewall'. So how do you decide which is the real 'Stonewall' material you want? It's likely that the model.materials collection is in the order they are created [at least in a session]. Therefore to find the 'true' 'Stonewall' material try this: name='Stonewall' ### or any other material name to be found... mat=Sketchup.active_model.materials.to_a.find_all{|m|m.name=~/^#{name}/}[-1] Thus the last match in the matches list is the material last added, so logically is the one you want? To get that material's name use mat.name...
  • [observer issue] onEraseEntities not working?

    4
    0 Votes
    4 Posts
    232 Views
    Dan RathbunD
    That's interesting.. I did not realize we could make code blocks have smaller text.
  • [Question]how to load a tool from an external .rb file

    4
    0 Votes
    4 Posts
    89 Views
    R
    Thank you Dan. It worked I have started to go through the Ruby Resource as you suggested. And I also found the answer for my own question in there.

Advertisement