Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

**First time visiting? Here are some places to start:**

- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

# Implementing Snell's Law in a sketch

mac_frolic077
Member Posts:

**2**✭
Hi

I wonder if there is a way to define a constraint between lines that represent the law of refraction?

i.e. I have a line with a point that represents the border of two mediums (air and glass). I want to draw a line that represents a ray of light that hits the surface in a certain angle. and I want to draw a line that represents the ray refracted inside the medium.

something like this:

https://www.geogebra.org/m/WnaEUHzW

I also want to be able to extend it to see how the refraction of a prism would influence the path of a ray.

in terms of the above example (after the link) angle phi is a function of angle alpha and the refraction-index of the two materials.

so what I am looking for is a constraint that can be defined by a function.

I know there is featurescript, but I have no experience with it. if this scripting language can help me with this problem, I would be glad if somebody can point me in the right direction, i.e. a script that can do something similar.

cheers

martin

I wonder if there is a way to define a constraint between lines that represent the law of refraction?

i.e. I have a line with a point that represents the border of two mediums (air and glass). I want to draw a line that represents a ray of light that hits the surface in a certain angle. and I want to draw a line that represents the ray refracted inside the medium.

something like this:

https://www.geogebra.org/m/WnaEUHzW

I also want to be able to extend it to see how the refraction of a prism would influence the path of a ray.

in terms of the above example (after the link) angle phi is a function of angle alpha and the refraction-index of the two materials.

so what I am looking for is a constraint that can be defined by a function.

I know there is featurescript, but I have no experience with it. if this scripting language can help me with this problem, I would be glad if somebody can point me in the right direction, i.e. a script that can do something similar.

cheers

martin

0

## Comments

116https://cad.onshape.com/documents/258a19506c555f400614c944/w/74e657ae2800105e2874589a/e/71d75b30fc9a22f4a9b82a08

857✭✭✭✭1,305https://cad.onshape.com/documents/109847f3ca92fbe0b164942e/w/07c893ecde8849e9ad780149/e/62ff57faac476c02966bed8f