The SectionPlane class contains methods to get and set the plane for the
SectionPlane in a model. Note that there is no way to get a SectionPlane
object using Ruby. You must manually create a section plane with the Section
Plane Tool in SketchUp and then query the entities array to find the
SectionPlane object. This class was primarily added for compatibility with a
third-party software product.
One workaround that does work: you could create a SketchUp model that contains
nothing but a SectionPlane, then import that as a component into whatever
model you wish to add a SectionPlane to.
The get_plane method is used to retrieve the plane that the section plane is on.
Returns:
model = Sketchup.active_model
entities = model.active_entities
sp = nil
# This is to make sure we grab a section plane from the model.
entities.each do |ent|
if ent.typename == "SectionPlane"
sp = ent
end
end
plane = sp.get_plane
if (plane)
UI.messagebox plane
else
UI.messagebox "Failure"
endThe set_plane method is used to set the plane that the section plane is on.
Arguments:
Returns:
model = Sketchup.active_model
entities = model.active_entities
sp = nil
# This is to make sure we grab a section plane from the model.
entities.each do |ent|
if ent.typename == "SectionPlane"
sp = ent
end
end
sp = sp.set_plane my_plane_array