[Plugin] Perpendicular Face Tools (UPDATED 26-03-09)
-
seems somebody understands! great tool and more as I expected
-
ok, I'm struggling to get the rotations to work. I'm working on the square first. I can get it to rotate nicely around the z-axis. But I have not figured out a way to determine exactly how much to rotate it to get it where I want. I think this is just my lack of general mathematical knowledge. So can anyone offer some help with this? The image shows a mock-up of the problem. The square is what I am rotating on the labeled centerpoint. Chord AB needs to align with chord CD. But chord AB is not supplied. It is the vector made of 2 points where the y values are equal and its length is equal to AB.
I'm sure that explanation makes no sense. Hopefully someone out there can read between the lines and figure out what I'm actually asking. Thanks,
Chris
-
could you not just align one of the sides to vertical (z)?
-
No, it doesn't show it well, but the sides are often not vertical. The alignment needs to make the top and bottom lie on planes that are "flat", but the sides are not necessarily vertical.
-
Thank you Chris A very useful script, am using it right now
-
Thanks Chris.
-
Chris,
Thanks for the usefull ruby !
erikB -
Your response hasn't gone un-noticed Tig. I thank you immensely for it. I'm still working on implementing it I think there is a small flaw in that I don't point C either. I think I know how to get it, so thats good. In fact, it is essentially what you provided with the "cosine rule". Thanks for that! That is currently what I'm working at. I had one method, but it was rather convoluted and started to fall apart for some reason, so I think it must not have been sound. This new method feels much more mathematically correct. I'll let you know how it goes. Hopefully within a few hours. Thanks sooo much for your help and ideas,
Chris
-
To rotate the square you have more than enough info. You don't actually need point-D.
You want to rotate it about the centre-point [let's call it point-O] - so you know that too.
You know point-A and point-C as you have them initially or have just calculated them already.
Now find the angle between the two vectors O->A and O->C.***
Select all of the square's edges (face will go with them?) and make a rotation-transformation about point-O by that angle: using the normal to the square's face as the axis of rotation...Points A and C, and points B and D will then be coincident...
"new vector"
v = [x,y,z]
vector1 = Geom::Vector3d.new(v)Where v [x,y,z] is obtained from the sum of the two points v = (pointO - pointA) etc
you might also want to ".normalize" the vector(s)...
Find vector2 (O->C) the same way...
"angle_between vectors"
The angle_between method is used to compute the angle (in radians) between this vector and another vector.
Syntax
angle = vector1.angle_between(vector2)
Arguments
vector2 - a Vector3d object
Return Value
angle - an angle (in radians)
Example
vector1 = Geom::Vector3d.new(x,y,z)
vector2 = Geom::Vector3d.new(xx,yy,zz)angle = vector1.angle_between(vector2)
###########
A bit more complicated to my mind is doing it with the 'cosine rule',
here it is though - you can easily find the length 'AC'
you have the other two points and can use 'AC = pointA.distance(pointC)' method for that.
You also know the circle's Radius - or can easily get it from the square's side dim.
Angle = Math::acos((RadiusRadius + RadiusRadius - ACAC) / (2Radius))
Note: if Angle > 90 degrees (pi/2) then it's negative...
.
-
Hi Chris
Small feedback : using customer shape crashes SU ( under Windows XP 3)without any message.
MALAISE
-
@malaise said:
Hi Chris
Small feedback : using customer shape crashes SU ( under Windows XP 3)without any message.
MALAISE
Oh dear, thats not good. Can anyone else confirm? I don't have xp sp3 anywhere to test it on. Is it possible that it is a conflict with another script? That doesn't seem likely to me since I think I've written my code so that can not happen.
I do have xp sp2 I can test it on. Perhaps if I can duplicate it there, I can narrow down the problem. Thanks for the notice,
Chris
-
Chris, I've done a couple of experiments with it. No crashes yet. I've got XP Pro SP3.
Dave
-
An artist who is also a coder?
That's Chris Fullmer!Thank you very much for taking the time to code this; with a couple of tweaks, this will be perfect.
-
OK, let me see which plugin may be in conflict
MALAISE
-
Hi ALL
Filtering the last downloaded plugins, I've found a conflict with Jim's cd_power_n.rb ( mover2.rb) Has someone experienced that? several times tested.
( SU V7, Windows XP SP3 )
MALAISE
-
Very Interesting. I have that plugin installed with no conflicts. I'll dig around tomorrow and see what I can find. Sorry for the inconvenience,
Chris
-
Thanks for playing attention, no matter for inconvenience, don't worry
MALAISE -
@malaise said:
Hi ALL
Filtering the last downloaded plugins, I've found a conflict with Jim's cd_power_n.rb ( mover2.rb) Has someone experienced that? several times tested.
( SU V7, Windows XP SP3 )
MALAISE
Mover2 does not use a file or method named
cd_power_n.rb
. -
I know, its cad_fathers's SCF powertools toolbar plugin that wrapped mover2 into a file called cd_power_n.rb. If you open that file, its just your script. So I'm guessing it has something to do with how its being loaded from his main plugin loader maybe? I don't know. I know I've got my whole script wrapped in a class so I thought I should not have conflicts. But perhaps there is more to it than that.
Chris
-
I'm not getting bug-splats with custom-face, BUT it does inconveniently make a group of the selected face and not explode it at the end. It's easily fixed by adding a line of code after line #299, to explode the temporary group...
@group.explode
How's the orienting face rotation on end of line going ?
.
Advertisement