[Plugin] Perpendicular Face Tools (UPDATED 260309)[Plugin] Perpendicular Face Tools (UPDATED 260309)Perpendicular Face Tools
Description: Three Perpendicular Face tools to help create faces perpendicular to the end of lines. Usage: Activate it at Plugins>Chris Fullmer Tools>Perpendicular Line Tools. Change the size of squares by entering a new dimension into the measuerments box after the face has been created. Change the radius of circles by entering "12s" for 12 sides into the measurements box. To use the custom face tool, create your face flat on the groundplane. The script attempts to line up the x axis as the bottom edge of the face. New Video for v1.1 (outdated for 1.2. Doesn't show that you can hit the up arrow key to rotate). Chris v0.1 beta v1.0 Updates: * The original face now explodes upon exiting the custom face tool. * Added support so that faces will stay oriented with a flat edge on the horizontal plane. * Holding ctrl while creating a face will override the flat horizontal feature and revert back to the default SketchUp "Arbitrary Rotation". * Now faces can be added anywhere to a line  on the endpoint (existing feature), in the middle of a line, or on a vertex of 2 lines. The vertex of 3 lines is not supported. v1.1 * Attempted to fix some bugs with the custom face tool. It only was working once in a while. And only if the blue face was up. Now it is slightly better. But there are still times when it will need to be rotated 180degrees after it is placed. sorry * Added a Toolbar! v1.2 * Changed so that circles default to have their vertices on top and bottom, not edges. Odd segmented circles will have the vertex on the bottom and a flat edge on the top (I think). * The up arrow key rotates the faces after they have been placed. Squares will rotate 45 degrees. Circles will rotate the angle needed to alternate between having an edge or a vertex on the top. Custom faces rotate in 90 degree increments. Helpful for fixing faces that are oriented 180 off, or that were drawn on the wrong axis. Last edited by Chris Fullmer on Thu Mar 26, 2009 6:04 am, edited 4 times in total.
Re: [Plugin] Perpendicular Face Tools v0.1 betaWow Chris, this is such a good script and I know it will be very well used.
Thanks ps, the videos you create are so helpful, nice work. Re: [Plugin] Perpendicular Face Tools v0.1 betaChris, this is great! What a time saver.
Now, not to look the proverbial gift horse in the mouth but, is there a way to define the rotational orientation of the profile before it is created? I realize it can be rotated after it is placed and before FM. Thanks again. Dave %
(THERE'S NO PLACE LIKE) G28 X0.0 Y0.0 Z0.0 M30 %
Re: [Plugin] Perpendicular Face Tools v0.1 betaYou compete for the "A day, a Plug" ?
Amazing one Waiting updates Ps What append when your list of Sub menu plugins will be more big than the screen? Does exist scroll for this state? My little scrolling black triangles are come back! (for the normal Plugins menu) so no limitation of numerous plugins! Last edited by pilou on Wed Mar 11, 2009 1:35 pm, edited 2 times in total.
Re: [Plugin] Perpendicular Face Tools v0.1 betaVery good implementation.
To get the face to 'orient' consistently the following could be considered... Circle  not so important to get 'square', but if it has few segments it'd be best if a vertex were at the lowest point in Z ? If face is 'flat' in Z then make vertex minimal in Y. It's relatively easy to find locations of all of circle's vertices and pick one and rotate (transform) the circle face about its centre axis so its Z (or Y) is minimal OR make the edge 'horizontal'  both vertices have same Z (or Y). Square  it's best to make one edge 'horizontal' so both of its vertices [start & end points] have same Z. If it's 'flat' in Z then make an edge's vertices equal in their Y. Followme can still skew the square along 3D paths but at least it'll start right. Customface  if the customface is originally drawn 'flat' you can find its rotation around the Z axis  pick any edge and get its vertices' angle relative to say X axis. Then apply the equivalent rotation transformation to the lineendaligned copy. That way you can determine the starting rotation of the face by rotating the original before using your tool  that would also let you have a rotated square 9diamond) as the customface if desired... You currently take 'sp1' as the center of the face's boundingbox  which is the easiest, and probably the best way  having selectable 'sp1' on the original seems too awkward. You can always move the grouped face when it's perpendicular to the selected path end; you can also rotate it later too, before the Followme is done... . Last edited by TIG on Wed Mar 11, 2009 3:31 pm, edited 1 time in total.
TIG
Re: [Plugin] Perpendicular Face Tools v0.1 betaHoly discombobley thats cool
Paul Russam
English doesn't borrow from other languages. It follows them down dark allies, knocks them over, and goes through their pockets for loose grammar.
Re: [Plugin] Perpendicular Face Tools v0.1 betaHey thanks everyone! I'm glad you like it.
@Tig, I would love to implement all of that. I just need to make sure I understand it I think I can figure out how to make the circle work out so its lowest z is always a vertex. For the square, my code draws it always flat on the YZ axis and then rotates it once to be perpendicular. Would I just set another rotation transformation to then level the botom edge and top edge to be horizontal? Or does that have to be built into the original transformation? I could probably pull it off as a second transformation, but I am not sure how to make it be part of the first. I'll have to make a SketchUp model of how that should work. And the custom face I think I see what you mean to get orientation first, then use that after it is placed to reorient it so that the x axis on the original is horizontal in the copy. Again, I think I can do that, assuming I can apply two rotation transformations to a group. All right, no promises, but I will try to take on these changes and see if I can get a more predictable orientation system working. If its easy, it shouldn't take more than a day or two. If it gives me fits, then.......If you hven't noticed, moving,rotating, scaling are not my forte. They require some serious math thinking that I am not trained in. But I am trained in 3d. So as long as I can visualize it, I hopefully can figure out how to implment it. Thanks for the GREAT suggestions Tig!, Chris
Re: [Plugin] Perpendicular Face Tools v0.1 betaRotate it after it's placed onto the vertex. You know the rotation axis as it's the line you are perpendicualr to...
. TIG
Re: [Plugin] Perpendicular Face Tools v0.1 betaChris,
A big thank you again for your generosity. Nice work! Ben Re: [Plugin] Perpendicular Face Tools v0.1 betaThanks guys. Tig, that makes sense. For some reason I was imaging a transformation as something that erases previous transformations effects once applied. So apply one transformation and it does that. Apply another and it jumps back to the original state before the first transformation and then applies the new transformation. I see now that its not like that (thank goodness). Seems silly I was confused since on hte custom face part I apply a translation first and then a rotation. I should have realized that transformations do not erase the effects of the previous transformation. So yes, I like the methods you describe to always have an edge horizontal. That seems quite logical.
Would there be a demand to have the custom face option accept more than one face? I know some of my profiles I use often include 3 or different faces that I want to use. So perhaps I'll try and make it accept multiple faces as long as they are coplanar. Also I need to make it work when clicking on an edge, not just an end point. Some instances, like when the path makes a completed loop like a circle, there are no endpoints to use. So I'll get that into my next update. Maybe a toolbar too. I think I've got some extra time today during class Chris
Re: [Plugin] Perpendicular Face Tools v0.1 betaawsome chris!! a time saver, the essence of ruby ... now try some UV mapping scripts .... my biggest current peeve in SU (there are so many)
Re: [Plugin] Perpendicular Face Tools v0.1 betaseems somebody understands! great tool and more as I expected
Re: [Plugin] Perpendicular Face Tools v0.1 betaok, 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 zaxis. 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 mockup 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
Re: [Plugin] Perpendicular Face Tools v0.1 betacould you not just align one of the sides to vertical (z)?
“There are three classes of people: those who see. Those who see when they are shown. Those who do not see.”
http://www.Twilightrender.com try it! Re: [Plugin] Perpendicular Face Tools v0.1 betaNo, 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.
Re: [Plugin] Perpendicular Face Tools v0.1 betaThank you Chris A very useful script, am using it right now
Re: [Plugin] Perpendicular Face Tools v0.1 betaTo rotate the square you have more than enough info. You don't actually need pointD.
You want to rotate it about the centrepoint [let's call it pointO]  so you know that too. You know pointA and pointC 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 rotationtransformation about pointO 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((Radius*Radius + Radius*Radius  AC*AC) / (2*Radius)) # Note: if Angle > 90 degrees (pi/2) then it's negative... # . Last edited by TIG on Fri Mar 13, 2009 10:23 am, edited 3 times in total.
TIG
Re: [Plugin] Perpendicular Face Tools v0.1 betaYour response hasn't gone unnoticed 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
Re: [Plugin] Perpendicular Face Tools v0.1 betaHi Chris
Small feedback : using customer shape crashes SU ( under Windows XP 3)without any message. MALAISE La Connaissance n'a de valeur que partagée
Re: [Plugin] Perpendicular Face Tools v0.1 beta
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
Re: [Plugin] Perpendicular Face Tools v0.1 betaChris, I've done a couple of experiments with it. No crashes yet. I've got XP Pro SP3.
Dave %
(THERE'S NO PLACE LIKE) G28 X0.0 Y0.0 Z0.0 M30 %
Re: [Plugin] Perpendicular Face Tools v0.1 betaOK, let me see which plugin may be in conflict
MALAISE Last edited by MALAISE on Sun Mar 15, 2009 8:52 am, edited 2 times in total.
La Connaissance n'a de valeur que partagée
Re: [Plugin] Perpendicular Face Tools v0.1 betaAn 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. Miguel Lescano
Find 3D home plans at ARQUI3D.com Re: [Plugin] Perpendicular Face Tools v0.1 betaHi 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 La Connaissance n'a de valeur que partagée
