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

    Topics

    • G

      Plugin publishing questions.

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      298 Views
      G
      Sounds good. The draw step can be reversed or stopped by deleting the group the draw is writing to, but I don't have it enclosed in an operation. I can add that in. That's the only thing that really needs to be undone; I'm not really crazy about a single undo step rewriting the CNC environment variables and outputting the gcode to a file is a single step anyway that can't be reversed short of deleting the files from the filesystem.
    • G

      Can't regroup an exploded ComponentInstance

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      2k Views
      Chris FullmerC
      This snippet works for me, and I think its fairly safe? (We'll let one of the other Ruby folk weigh in on that if they feel they need to ). random_classes = [] ents_to_regroup = [] a = Sketchup.active_model.selection[0].explode a.each do |e| random_classes << e.class end random_classes.uniq! random_classes.each do |e| single_class_objects = a.grep(e) if single_class_objects[0].respond_to?(;bounds) then ents_to_regroup << single_class_objects end end ents_to_regroup.flatten! Sketchup.active_model.entities.add_group(ents_to_regroup) This will take the selected component and explode it. It then looks at the class of every object that was returned and decides if that class can be added to a group by testing to see if an object from that class responds to the bounds method, (which is in the Drawingelement class and inherited by all valid SU geometry entities). So if an object from the given class does respond to the bounds method, then it is safe to try to add those objects back into a group. If they do not respond to that method, then they get skipped. Hopefully the logic makes sense. That snippet worked fine for me. You do have to have an object selected to test that piece of code. Chris
    • G

      Can't draw subclasses of Sketchup::Edge

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      25
      0 Votes
      25 Posts
      672 Views
      thomthomT
      I hope we get to see your creation one day. It sounds interesting!
    • 1 / 1