ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • Select component with ruby?

    8
    0 Votes
    8 Posts
    1k Views
    Dan RathbunD
    ruby will allow spanning lines with a \ (in some cases.)
  • Ruby plugin - Export from skp to Quake .map file

    4
    0 Votes
    4 Posts
    920 Views
    TIGT
    Sketchup's UI API UI.open_panel(), and save_panel() etc Then folder=File.dirname(model.path) etc Read both the API, AND the general Ruby File/Dir stuff together... You don't need to use Dir.chdir() if you give File.new(fpath, 'w') the full-path to the file... which you can of course pre-assemble from the model's directory path and the new file's name, thus fpath=File.join(File.dirname(model.path), 'my.map') Of course you can check that the model has been saved and therefore not model.path.empty? before proceeding etc...
  • Best practices for working with cummulative transformations

    8
    0 Votes
    8 Posts
    167 Views
    N
    @Thomthom: Great thread! All this OOP and geometry, I can't help but feel it verges on mental masturbation . It's almost metaphysical. I'll be using a bit of code from that thread. Thanks @TIG: The short answer is I'm trying to find the transformation of a lot of things. I'll give you some background. I'm trying to create a kind of project space for CNC manufacturing. The hiearchy looks something like this. ->MODEL --->ASSEMLY (Group/Component) ----->WORKPIECE (Component) ------->DESIGN (Group) --------->TOOLPATH (Group/Component) ----------->HOLE (Group/Component) Some things are forbidden. A toolpath can't contain any other groups or instances, a workpiece can't contain another workpiece. But I want to allow the user to further nest whatever they want. This means a workpiece can have a group of toolpaths or an assembly can have workpieces that are nested in other groups. At the risk of rambling on, I'll leave it at that. Let me know if I'm not clear (which is often the case when I try to explain anything related to OOP )
  • Best way to return a value from a tool ?

    6
    0 Votes
    6 Posts
    129 Views
    Didier BurD
    Thanks Dan, I still had an attr_accessor :distance in that class
  • Face.position_material and uvh.get_front_UVQ

    6
    0 Votes
    6 Posts
    444 Views
    A
    I absolutely agree about the missing method to get/set the projected property. Fredo, as for the problem with tapered textures, I think this is a question of bilinear texture mapping versus projective (http://www.cs.cmu.edu/~ph/texfund/texfund.pdf p. 14 & p.17), but isn't projective mapping default in most other applications? I can't think of any better solution than splitting the face into smaller quads.
  • Groups, Instances and Entities...

    4
    0 Votes
    4 Posts
    120 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
    170 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
    109 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
    142 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
    488 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
    262 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
    120 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
    952 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
    279 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?

Advertisement