# Moving a section plane using ruby

**URL:** <https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701>\
**Category:** Ruby API\
**Created:** [April 24, 2025, 12:29pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701 "2025-04-24T12:29:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![glro](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@glro](https://forums.sketchup.com/u/glro)\
**Post date:** [April 24, 2025, 12:29pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/1 "2025-04-24T12:29:34Z")

</div>

is it possible?

copilot says yes:  
"# Sélectionner le plan de section  
model = Sketchup.active\_model  
entities = model.active\_entities  
section\_planes = entities.grep(Sketchup::SectionPlane)

if section\_planes.any?  
section\_plane = section\_planes.first

# Définir une nouvelle transformation pour déplacer le plan

translation = Geom::Transformation.new([10, 0, 0]) # Déplace de 10 unités sur l’axe X  
section\_plane.transform!(translation)

puts “Le plan de section a été déplacé.”  
else  
puts “Aucun plan de section trouvé dans le modèle.”  
end  
"  
but it is AI hallucination

sketchup documentation says transform! is only for groups and components

so is there another way?

---

<div class="post-metadata">

**Author:** ![slbaumgartner](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/slbaumgartner/32/7302_2.png) [@slbaumgartner](https://forums.sketchup.com/u/slbaumgartner)\
**Post date:** [April 24, 2025, 12:38pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/2 "2025-04-24T12:38:56Z")

</div>

I haven’t tried it, but maybe [SectionPlane#set\_plane](https://ruby.sketchup.com/Sketchup/SectionPlane.html#set_plane-instance_method) is what you want.

---

<div class="post-metadata">

**Author:** ![glro](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@glro](https://forums.sketchup.com/u/glro)\
**Post date:** [April 24, 2025, 1:05pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/3 "2025-04-24T13:05:43Z")

</div>

i tried: the example in sketchup documentation:

"model = Sketchup.active\_model  
entities = model.active\_entities

# Grab the first section plane from the model.

sp = entities.grep(Sketchup::SectionPlane).first  
sp = sp.set\_plane my\_plane\_array"

gives an error…

"“Wrong number of arguments for plane”

---

<div class="post-metadata">

**Author:** ![slbaumgartner](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/slbaumgartner/32/7302_2.png) [@slbaumgartner](https://forums.sketchup.com/u/slbaumgartner)\
**Post date:** [April 24, 2025, 1:19pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/4 "2025-04-24T13:19:41Z")

</div>

That sounds like you didn’t create plane array correctly. What did my\_plane\_array have in it? It should be an Array of one Geom::Point3d and one Geom::Vector3d, or an Array of four numbers that “give the coefficients of a plane equation”.

Edit: in case that vague API doc statement isn’t clear:

- if you pass an Array of [Geom::Point3d, Geom::Vector3d] the point is any point on the plane, and the vector is the normal vector to the plane.
- if you pass an Array of four numbers, they are the coefficients [a,b,c,d] of the 3d plane equation ax+by+cz = d

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [April 24, 2025, 3:17pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/5 "2025-04-24T15:17:40Z")

</div>

> [@glro](#):
>
> ```ruby
> section_plane.transform!(translation)
> 
> ```
> 
> … but it is AI hallucination

Yes, the AIs often “invent” methods and functions that do **not** exist.

They also think that anything posted to a public forum is gospel truth, instead of checking official sources like API documentation.

* * *

Also, @glro please post code correctly in the forum:

- [[How to] Post correctly formatted and colorized code on the forum?](https://forums.sketchup.com/t/how-to-post-correctly-formatted-and-colorized-code-on-the-forum/46189/1)

---

<div class="post-metadata">

**Author:** ![glro](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@glro](https://forums.sketchup.com/u/glro)\
**Post date:** [April 24, 2025, 3:29pm UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/6 "2025-04-24T15:29:09Z")

</div>

i have tried this:

```model
entities = model.active_entities

pt1 = Geom::Point3d.new
pt2 = Geom::Point3d.new(0,0,10)

vec = pt1 - pt2
my_plane_array = Array.new

my_plane_array.push pt1
my_plane_array.push vec

if entities.grep(Sketchup::SectionPlane).length >=1
	# Grab the first section plane from the model.
	sp = entities.grep(Sketchup::SectionPlane).first
	sp = sp.set_plane my_plane_array
	else
	UI.messagebox "no section plane in the model"
end

```

it works:  
from this

 ![2025-04-24 17_20_41-Sans titre - SketchUp Make 2017](https://global.discourse-cdn.com/sketchup/original/3X/1/f/1fdeccfbc687459c641683c55919297b1fcd47a6.png)  
to this  
 ![2025-04-24 17_20_52-Sans titre - SketchUp Make 2017](https://global.discourse-cdn.com/sketchup/original/3X/5/f/5f1874832d0b8837b5b3afd0b5cd2ecf97607c32.png)

the section plane is moved to the origin

by changing pt1 coordinates, it would be possible to move the section plane; i would never have understood that alone, thank you

---

<div class="post-metadata">

**Author:** ![glro](https://avatars.discourse-cdn.com/v4/letter/g/c0e974/32.png) [@glro](https://forums.sketchup.com/u/glro)\
**Post date:** [April 26, 2025, 8:48am UTC](https://forums.sketchup.com/t/moving-a-section-plane-using-ruby/324701/7 "2025-04-26T08:48:12Z")

</div>

I found another way to move a section plane, n this case along a points cloud.

create a scene with the points cloud, add a section plane on the other side of the points cloud, inactivate it and save the scene.

 ![2025-04-26 10_31_19-PDP_0.5dm reduit#glro20250424_ - SketchUp 2025](https://global.discourse-cdn.com/sketchup/original/3X/a/7/a7640a2c6189bb82a5a3241d080c0a2ec964e807.png)

create a second scene, activate the section plane and save the scene.

 ![2025-04-26 10_32_45-PDP_0.5dm reduit#glro20250424_ - SketchUp 2025](https://global.discourse-cdn.com/sketchup/original/3X/d/f/df4c2a83515d40caac9b8a22edf648bf0cdcabc1.png)

make sure the animation parameters are set with a transition between scenes

 ![2025-04-26 10_34_53-PDP_0.5dm reduit#glro20250424_ - SketchUp 2025](https://global.discourse-cdn.com/sketchup/original/3X/0/c/0c9a5a13d337fd6c09d5367be25958d3c4d5b4ed.png)  
 ![2025-04-26 10_35_25-Infos sur le modèle - PDP_0.5dm reduit#glro20250424](https://global.discourse-cdn.com/sketchup/original/3X/d/2/d2cce4346edbb31266630b25fd1c7042925bff07.png)

also make sure that, in ‘scan essentials’ points cloud manager window , show a box of points around section plane, is on.

 ![2025-04-26 10_37_16-Gestionnaire de nuages de points](https://global.discourse-cdn.com/sketchup/original/3X/0/e/0e5f50674ac5b858cc766a55436362cd339a2d6e.png)

Now when you switch scenes, a slice of points is shown, moving from trom one side to the other

[https://vimeo.com/1078904633?share=copy](https://vimeo.com/1078904633?share=copy)
