# Vector referred to screen reference system

**URL:** <https://forums.sketchup.com/t/vector-referred-to-screen-reference-system/253733>\
**Category:** Ruby API\
**Created:** [January 1, 2024, 5:02pm UTC](https://forums.sketchup.com/t/vector-referred-to-screen-reference-system/253733 "2024-01-01T17:02:49Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Alessandro\_pedretti](https://avatars.discourse-cdn.com/v4/letter/a/e95f7d/32.png) [@Alessandro\_pedretti](https://forums.sketchup.com/u/Alessandro_pedretti)\
**Post date:** [January 2, 2024, 3:06pm UTC](https://forums.sketchup.com/t/vector-referred-to-screen-reference-system/253733/6 "2024-01-02T15:06:00Z")

</div>

Thank you all Guys!!

@rtches it could be a chance to test! Actually I’m developing an extension that I want to run also on SK2020 and overlay method is not available!

@DanRathbun thank you for your clarification, it helps a lot as always!

@john_mcclenahan I will have a look to your extension, thank you indeed!

@curic4su you got it! I want to do what you have done in the video!! Just a few things: I don’t need to generate the 3D Text on mouse move while genereting the polyline, I want to generate the polyline and the 3D Text in the same time, just as in the video below:

Do you have some snipped code to refer at, just to replicate it? Actually I’m aligning the 3D Text group to the edges in a way that the X axis of the 3D Text is parallel to the edge and the Y axis is perpendicular to it (Z is created as a cross product), following the suggestion of @slbaumgartner to use a matrix transformation (you can refer to [Align Group based on vectors](https://forums.sketchup.com/t/align-group-based-on-vectors/252510) topic I recently open):

```auto

for i in 0...@vettore.length
  @grouptext = disgn.entities.add_group
  @grouptext.name = txt_display[i].to_s + " 3D Text"
  @grouptext.entities.add_3d_text(txt_display[i].to_s, TextAlignCenter, "Arial", false, false, 2.0, 0.0, 0.0, true, 0.0)

  @textx = txpoint[i].x
  @texty = txpoint[i].y
  @textz = txpoint[i].z
  @new_x = @vettore[i]
  @new_y = @v_off[i]
  @new_z = @vettore[i]*@v_off[i]

  @new_x.normalize!
  @new_y.normalize!
  @new_z.normalize!

   self.posiziona_3dText

```

Where _posiziona\_3dText_ recall the transformation matrix:

```auto
  def posiziona_3dText
    trans_array = []
    trans_array[0] = @new_x[0]
    trans_array[1] = @new_x[1]
    trans_array[2] = @new_x[2]
    trans_array[3] = 0.0
    trans_array[4] = @new_y[0]
    trans_array[5] = @new_y[1]
    trans_array[6] = @new_y[2]
    trans_array[7] = 0.0
    trans_array[8] = @new_z[0]
    trans_array[9] = @new_z[1]
    trans_array[10] = @new_z[2]
    trans_array[11] = 0.0
    trans_array[12] = @textx
    trans_array[13] = @texty
    trans_array[14] = @textz
    trans_array[15] = 1.0

    @grouptext.transform!(Geom::Transformation.new(trans_array))
  end

```

Again, thank you all!

---

_[View the full topic](https://forums.sketchup.com/t/vector-referred-to-screen-reference-system/253733)._
