Outliner create slice group via API, somebody can help?

advice

#1

I am trying to create in the outliner, the slice group , I don’t find the API command to do it.
Can somebody help me? :frowning:


#2

I think the method you mean is …

But if you rather meant a section plane, then …


#3

Hello Dan, thanks for your reply

Sketchup::Entities#add_section_plane() is doing exactly as command add section

Sketchup::Entities#intersect_with() is calculating intersections, but doesn’t work with section plane, need create a geometry and after redirect all entities on section group…

As you know there isn’t the possibility to invoke directly the command to create the group under the section that represent the outliners?


#4

Sorry, I got confused with the word Outliner which is the object tree panel.

Okay, the “Create Group from Slice” command is an edit command, whose command ID will change from session to session depending upon what plugins are loaded. So there is no way to lock down a certain integer ID for it. And there does not appear to be a send_action string.

Looks like you should open a feature request in the tracker …


#5

We tried to use the command to make the section, but the Id is changing always, it i snot possible to use…

We are finalizing our render solution…
would be nice to have some collaboration, if you are interested


#6

Either you will need to determine the ID at the beginning of each session (or just before using it) …

… or you could use WIN32OLE and the SendKeys() method.

  WIN ||= Sketchup::platform == :platform_win rescue RUBY_PLATFORM !~ /darwin/i
  require 'win32ole' if WIN

  def group_from_slice
    if WIN
      WIN32OLE::new('WScript.Shell').SendKeys('{ESC}^%s')
    else
      puts "Feature is PC Only"
    end
  end

I send the ESC key to close the Ruby console window, so that the
main application window will receive the CTRL+ALT+S keystroke.