[Plugin] Perpendicular Face Tools (UPDATED 26-03-09)

[Plugin] Perpendicular Face Tools (UPDATED 26-03-09)

Postby Chris Fullmer » Wed Mar 11, 2009 10:23 am

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 over-ride 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.
9
Last edited by Chris Fullmer on Thu Mar 26, 2009 6:04 am, edited 4 times in total.
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby dylan » Wed Mar 11, 2009 11:19 am

Wow Chris, this is such a good script and I know it will be very well used.
Thanks :thumb:

ps, the videos you create are so helpful, nice work.
0

dylan 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Dave R » Wed Mar 11, 2009 11:54 am

Chris, 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
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby pilou » Wed Mar 11, 2009 11:54 am

You compete for the "A day, a Plug" ? :D
Amazing one :enlight:
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! :enlight:
0
Last edited by pilou on Wed Mar 11, 2009 1:35 pm, edited 2 times in total.
Frenchy Pilou
Is beautiful that please without concept!
My Little site :)
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby TIG » Wed Mar 11, 2009 12:25 pm

Very 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.

Custom-face - if the custom-face 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 line-end-aligned 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 custom-face if desired...

You currently take 'sp1' as the center of the face's bounding-box - 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...

.
0
Last edited by TIG on Wed Mar 11, 2009 3:31 pm, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Paul Russam » Wed Mar 11, 2009 1:09 pm

Holy discombobley thats cool :thumb: :thumb:
0
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.
User avatar
Paul Russam 
Premium Member
Premium Member
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby dtrarch » Wed Mar 11, 2009 3:51 pm

Chris

Just plain thank you.

dte
0

dtrarch 
Premium Member
Premium Member
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby boofredlay » Wed Mar 11, 2009 4:15 pm

Nice, thanks.
0
User avatar
boofredlay 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Wed Mar 11, 2009 4:56 pm

Hey 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 re-orient 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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby TIG » Wed Mar 11, 2009 6:49 pm

Rotate it after it's placed onto the vertex. You know the rotation axis as it's the line you are perpendicualr to...

.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby chango70 » Wed Mar 11, 2009 6:57 pm

Brilliant!
0

chango70 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Ben Ritter » Wed Mar 11, 2009 7:06 pm

Chris,

A big thank you again for your generosity. Nice work!

Ben
0

Ben Ritter 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Wed Mar 11, 2009 7:19 pm

Thanks 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 co-planar.

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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby free agent » Wed Mar 11, 2009 7:56 pm

awsome chris!! a time saver, the essence of ruby :)... now try some UV mapping scripts :).... my biggest current peeve in SU (there are so many)
0
User avatar
free agent 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby MALAISE » Wed Mar 11, 2009 8:49 pm

:thumb: :thumb:

MALAISE
0
La Connaissance n'a de valeur que partagée
User avatar
MALAISE 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Burkhard » Wed Mar 11, 2009 9:52 pm

seems somebody understands! great tool and more as I expected :thumb:
0
User avatar
Burkhard 
Premium Member
Premium Member
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Thu Mar 12, 2009 1:20 am

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,

rotationhelp.jpg


Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby xrok1 » Thu Mar 12, 2009 2:03 am

could you not just align one of the sides to vertical (z)?
0
“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!

xrok1 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Thu Mar 12, 2009 2:40 am

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.
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby putnik » Thu Mar 12, 2009 8:45 am

Thank you Chris :berserk: A very useful script, am using it right now
0

putnik 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby linea » Thu Mar 12, 2009 9:06 am

Thanks Chris.
0

linea 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby TIG » Thu Mar 12, 2009 10:10 am

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((Radius*Radius + Radius*Radius - AC*AC) / (2*Radius))

# Note: if Angle > 90 degrees (pi/2) then it's negative...
#
.
0
Last edited by TIG on Fri Mar 13, 2009 10:23 am, edited 3 times in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby erikB » Thu Mar 12, 2009 10:15 am

Chris,
Thanks for the usefull ruby !
erikB
0
User avatar
erikB 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Fri Mar 13, 2009 4:00 am

Your response hasn't gone un-noticed Tig. I thank you immensely for it. I'm still working on implementing it :oops: 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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby MALAISE » Sat Mar 14, 2009 4:03 pm

Hi Chris

Small feedback : using customer shape crashes SU ( under Windows XP 3)without any message.

MALAISE
0
La Connaissance n'a de valeur que partagée
User avatar
MALAISE 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Chris Fullmer » Sat Mar 14, 2009 11:36 pm

MALAISE wrote: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
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Dave R » Sat Mar 14, 2009 11:41 pm

Chris, I've done a couple of experiments with it. No crashes yet. I've got XP Pro SP3.

Dave
0
Etaoin Shrdlu


%

(THERE'S NO PLACE LIKE)

G28 X0.0 Y0.0 Z0.0

M30

%
User avatar
Dave R 
Global Moderator
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby MALAISE » Sun Mar 15, 2009 7:53 am

OK, let me see which plugin may be in conflict :thumb:

MALAISE
0
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
User avatar
MALAISE 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby Ecuadorian » Sun Mar 15, 2009 8:35 am

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. 8-)
0

Ecuadorian 
 

Re: [Plugin] Perpendicular Face Tools v0.1 beta

Postby MALAISE » Sun Mar 15, 2009 8:54 am

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 :?:
0
La Connaissance n'a de valeur que partagée
User avatar
MALAISE 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: mtyjr15, smb5823 and 18 guests