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

    Posts

    Recent Best Controversial
    • RE: Erase! gives an error: can't find parent

      Thanks Guys.

      Yes, I can see now why it's happening, and also why it happens on this model and not others. Most of my models are components only.

      But if I add the entities to my own array, and then erase them all, won't I run into a similar problem? If I erase an edge before I get to the face, I'll still try to erase the face, but it will be gone from the model.

      The reason I'm using the selection is that it's easy to add all the entities to it. There's a sel.add that doesn't care what kind of thing I'm adding. If I make my own entities array, I have to know what each thing is and call the right add, as there's no generic add. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Erase! gives an error: can't find parent

      Brad:

      Yes, that's exactly the same error message I'm getting. But in my case, I'm not trying to erase a definition - I'm trying to erase entities. Your suggestion gave me an idea, though. I typed this in the console:

      Sketchup.active_model.entities.each {|e| e.erase!}

      This gave an odd behavior: some of my model gets erased, but not all. If I then execute the same line again, more disappears. After about 8 times, it's finally all gone. Is the list somehow getting rearranged out from under me as I erase things (thus hosing up the "each" method)?

      posted in Developers' Forum
      daikuD
      daiku
    • Erase! gives an error: can't find parent

      Has anyone ever gotten an error like this:

      Error: #<TypeError: Cannot determine parent of entity>

      Here's the line of code:

      sel.each {|e| e.erase! }

      Even if sel is empty, I shouldn't get an error. As it happens, it's got the whole model in it, except for a few component instances.

      Here's a larger code snippet:

      sel.clear
      model.entities.each {|e| sel.add(e)}
      shop_dwg.each {|dwg| sel.remove(dwg)}
      sel.each {|e| e.erase! }

      I'm trying to erase everything but the shop_dwg comps. This code normally runs fine, but I've got a model that usually (but not always?) give me this error. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Force Thumbnail to update?

      Am Not. I thought Model.save_thumbnail was just to save a thumbnail to it's own jpg file. I'm talking about the one you see in the preview box when you do a File | Open, or if you turn on thumbnails in an explorer window.

      I think I may have found what I was looking for. There's an option under "Model Info | File" called "Redefine thumbnail on save". From what I can tell, the thumbnail only gets generated when you close the file, not when you save without closing, unless this option is turned on. I assume this is to improve performance on autosave, etc. Anyway, if I enable this option (manually), I get the behavior I want. Not sure if that option is available from within ruby. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • Force Thumbnail to update?

      My ruby script makes some drastic changes to the user's drawing (erasing most of it), then saves it to a file, then restores all the changes. The issue is that the thumbnail that's stored with the saved file does not reflect the changes made by the script. Any idea how to force the thumbnail to update before I save?

      I'm talking about the thumbnails that show up in folder listings, and preview images when using Sketchup's File | Open menu. Thanks, CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Most used scripts.

      TIG's AddVertex+.rb
      Always seems to know right where I want a cpoint.

      posted in Plugins
      daikuD
      daiku
    • RE: TextTag

      This is really useful, Tig. I love that the tags follow the face around when you move it, but it's not part of the face, or the compI that contains the face. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: So what's in 6.4.112?

      My computer is no speed demon, and the performance of the new version is noticeably slower. Consider me disappointed. CB.

      posted in SketchUp Discussions
      daikuD
      daiku
    • RE: Wall &quot;cutter&quot; for windows

      Doors also! CB.

      posted in Developers' Forum
      daikuD
      daiku
    • Problem with camera perspecitve

      At the start of my script, I save a copy of the current camera, then assign a new one with different parameters. At the end of the script, I restore the saved camera. But if I turn off perspective for the new camera, the perspective does not revert back when I restore the saved camera. I boiled down my script to the bare bones to illustrate the problem. If you change the false in line 20 to true, or to old_cam.perspective?, it works fine. Anyone know what's going on here? CB.

      http://www.sketchucation.com/forums/scf/sas/Ruby/ptest2.rb

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Add to existing sub-menu

      Thanks anyway, Todd. I'll just add an "about" to my own submenu. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Add to existing sub-menu

      I'm assuming the intent of the "help | about plugins" menu was so that plugin developers could list their versions, etc, all in a common location. So it seems odd that we can't get at it. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Add to existing sub-menu

      Hmmmm. Undocumented feature... Sounds like a job for Todd Burch!

      posted in Developers' Forum
      daikuD
      daiku
    • Add to existing sub-menu

      I want to add a "version" dialog to the existing "Help | About Plugins" submenu. I know how to add a submenu to an existing top-level menu, but how about to an existing sub-menu? I've tried what I think are the obviuos things, like to add the submenu, but it just makes a duplicate. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Blank Method in &quot;Face&quot; Class

      This is good stuff, guys - thanks to both of you for the research. I've already simplified some awkward code in my scripts using this new knowledge. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Current time of animation?

      Can't you just grab the current time and save it as the "start time" when you start the animation, and then when you want to know how long it's been, grab the current time again, and take the difference? CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Axis Alignment Script

      I just thought of something else. The axes alignment will be part of the component definition, not the individual instance. When you change the axes for one instance, you change them all. Even if the other instances are not oriented in the same direction.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Axis Alignment Script

      Dave:

      Do you want the new axes to be parallel to the global axes, or actually superimposed on top of the global axes, so that the origin of the comp is the same as the origin of the model? If it's the former, if you exlode then re-combine (either group or compo), do you get the desired behavior? I'm not necessariy suggesting this as a workaround - I'm just making sure that I understand what you are asking for. CB.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Material with coloured or distorted texture

      gourp.entites will give you the array of entities in the group. Then run through all the items in the array, and look for your face.

      posted in Developers' Forum
      daikuD
      daiku
    • RE: Ruby Challenge!

      OBFUSCATORS! You should be trying to make it MORE readable, not less! (switch to high, crackly voice) You young punks don't know how good you've got it! Why, back in my day, all we had was ones and zeros. And sometimes we didn't even have zeros, and we had to use the letter O!

      πŸ˜‰ πŸ˜‰ πŸ˜‰

      posted in Developers' Forum
      daikuD
      daiku
    • 1
    • 2
    • 7
    • 8
    • 9
    • 10
    • 11
    • 10 / 11