Re: [Plugin] Flatten to Plane v1.2 20101023

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Fri Oct 22, 2010 2:01 pm

(c) TIG 2010
Permission to use, copy, modify, and distribute this software for
any purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
___________________________________________________________________________
You need this file
#FlattenToPlane.rb >>> Plugins Folder
You must also have this file
#WorkPlane.rb >>> Plugins Folder http://forums.sketchucation.com/viewtop ... 45#p274345
___________________________________________________________________________
Usage:
Make or choose a 'WorkPlane' that is located on the 'plane' onto which
you want to project your 'flattened' Geometry.
Select the 'WorkPlane' and the required Geometry [Edges etc, note that
Faces etc will be ignored], and/or Groups, and/or Component_Instances.
Run this Tool from the menu 'Plugins' > 'Flatten to Plane'
or type 'flattentoplane' in the Ruby Console.
If there is no 'WorkPlane' and/or other objects in the Selection you get an
error message.
Assuming it runs...
All Edges in the Selection that are not 'hidden' or not on 'off layers' are
projected onto that 'plane'.
The new 'flattened' Edges are put into a new Group named 'FLAT_123456.789'
[it has a 'date/time' suffix].
Each new Edge takes the original Edge's layer.
If an Edge is in a Group it is put into a new Group made inside the new
'FLAT_123456.789' Group that is named after the original Group's name +
'_FLAT'. This nested Group takes the original Group's layer.
If an Edge is in a Component_Instance it is put into a new Group made
inside the new 'FLAT_123456.789' Group that is named after the original
Component Definition's name + '_FLAT'. This nested Group takes the
original Instance's layer.
On completion the new Group ['FLAT_123456.789'] is left highlighted.
___________________________________________________________________________
Donations:
by PayPal to info @ revitrev.org
___________________________________________________________________________
Version:
1.0 20101022 First release.
1.1 20101022 Nested groups/instances now included.
1.2 20101023 The correct Plane of a 'WorkPlane' is now used even if it has
been Transformed inside its own Group.
___________________________________________________________________________
#FlattenToPlane.rb
1
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane

Postby jsteacy » Fri Oct 22, 2010 3:04 pm

Cool Plugin, will definitely use this, thank you. I've got one request though, is there a way to make an option that the new geometry created becomes a plane with no interior lines. See the image below, the cylinder has a lot of lines but is not a plane. I feel more often than not if you are using this plugin you'll want to extrude the geometry afterwords but for complex shapes you'll end up with a lot of lines to delete. I could be wrong though. Maybe just make it so the new geometry has all the planes drawn in.
0

jsteacy 
Premium Member
Premium Member
 

Re: [Plugin] Flatten to Plane

Postby TIG » Fri Oct 22, 2010 3:13 pm

To add faces you can quickly over-drawn th whole thing with a giant circle which will 'face' and intersect with any edges that could 'face': then erase the outer giant circle.
To make a 'silhouette' is much more complex as we'd need to do the above programmatically AND then erase inner island faces and afterwards we need to tidy unfaced edges and any coplanar edges that are not needed...
I'll think about it...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane

Postby Ben Ritter » Fri Oct 22, 2010 4:12 pm

TIG, thank you, again :thumb: :thumb: :thumb:
0

Ben Ritter 
 

Re: [Plugin] Flatten to Plane v1.1

Postby TIG » Fri Oct 22, 2010 4:14 pm

Here's v1.1 viewtopic.php?p=281320#p281320
Nested groups/instances now included.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.1

Postby jsteacy » Fri Oct 22, 2010 4:55 pm

ThomThom's Cleanup script works pretty well to delete all the co-planar lines once the face exist. I tried creating the large circle around the geometry to get the faces but it doesn't always create all the necessary faces, so maybe you could look into just create the faces for the resultant geometry. But that's just a suggestion.
0

jsteacy 
Premium Member
Premium Member
 

Re: [Plugin] Flatten to Plane v1.1

Postby gude » Fri Oct 22, 2010 7:14 pm

I have no words to thank for your quick response. Your speed to make the solution is amazing.
I just got the script and was playing with it for a while. I created a work plane i selected my group and run it.
The result was the model got unfolded on the working plane. Or is it my problem I've attached the model.
And One more thing, If i have my section plane on, does it flatten only the visible geometry.
Again thank you so much. :thumb:
0

gude 
 

Re: [Plugin] Flatten to Plane v1.1

Postby Powerwall » Fri Oct 22, 2010 8:15 pm

Ok, I must be doing something wrong. I am building a model wind turbine and want to cut out blades for the model. The blades wrap around a frame in a helical design. I want to flatten the helical shape so that I can get the 2d curve that best approximates the shape of the blade. So I download both plugins and select a plane and select my model. I run the flatten plugin and I now have a blue box around my model blade, but it is still in 3 dimensions. Any ideas as to what I am doing incorrectly? This looks like a great plugin and is just what I need to get my new business started if I can make it work! Thanks in advance for your help.
0

Powerwall 
 

Re: [Plugin] Flatten to Plane v1.1

Postby TIG » Fri Oct 22, 2010 9:17 pm

Gude

I can see the problem...
I can't see see what's causing it [yet] :roll:
I think perhaps you need Jim Foltz's 'unfold.rb'..............
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.1

Postby TIG » Fri Oct 22, 2010 9:22 pm

Powerwall wrote:Ok, I must be doing something wrong. I am building a model wind turbine and want to cut out blades for the model. The blades wrap around a frame in a helical design. I want to flatten the helical shape so that I can get the 2d curve that best approximates the shape of the blade. So I download both plugins and select a plane and select my model. I run the flatten plugin and I now have a blue box around my model blade, but it is still in 3 dimensions. Any ideas as to what I am doing incorrectly? This looks like a great plugin and is just what I need to get my new business started if I can make it work! Thanks in advance for your help.

This tool only 'projects' a form onto a plane [when it's working!] - if you want to 'unfold' a form use Jim Foltz's 'unfold.rb'..........
There is is also 'flatten.rb' from Smustard ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.1

Postby TIG » Fri Oct 22, 2010 10:59 pm

Here's an alternative 'Silhouette to Plane' Tool viewtopic.php?p=281445#p281445
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.1

Postby Powerwall » Sat Oct 23, 2010 1:51 am

Thanks so much for the info on the unfold tool. This is exactly what I need to convert the 3d curve to a 2d shape that I can have manufactured. I have my first customer for my wind turbine design but the blade design has been a hangup as my manufacturer was unable to determine the curves to cut for the blades. Not knowing CAD, I was at a loss. I can't put into words how great it is to have a solution. Thanks a million!

Keith Tully
Power Wall Systems
www.powerwallsystems.net
0

Powerwall 
 

Re: [Plugin] Flatten to Plane v1.1

Postby gilles » Sat Oct 23, 2010 12:42 pm

flatten-test.skp
Hello,

first I must thank you for your marvelous plugins.

so I try this one and exept for the workplane coplanar to the ground the result is not coplanar with is workplane but seems to be perpendicular.

SU 8 on mac 10.6

see attatchment.
0
" c'est curieux chez les marins ce besoin de faire des phrases "
User avatar
gilles 
Top SketchUcator
 

Re: [Plugin] Flatten to Plane v1.1

Postby TIG » Sat Oct 23, 2010 12:58 pm

I think the problem lies with the transformations of the WorkPlanes...
If you simply move / rotate the WorkPlane group then the tool will use its 'plane' correctly - as the WorkPlane is effectively 2D and its bounds are not orthogonal to the main axes.
You seem to have unlocked and edited the internal contents of the WorkPlane group so that they are then angled within the group and therefore whilst the group is 'orthogonal' to the axes the plane's face is not: because the tool takes the WorkPlanes group's transformation to place the 'flattened' version it appears 'orthogonal' matching the WorkPlane group's alignment and not the internal 'face'...

I can probably trap for this too... :?:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Sat Oct 23, 2010 1:45 pm

Here's v1.2 viewtopic.php?p=281320#p281320
The correct Plane of a 'WorkPlane' is now used even if it has been Transformed inside its own Group.
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby manamana » Sun Oct 24, 2010 4:51 am

sorry for the stupid question, but I can't test this at the moment.

does this script take geometry and lay it flat, or does it create a projection onto the work plane?

I'm looking for a script that will take a bunch of randomly oriented faces and lay them out nice and flat on the ground plane. For lasercutting, so I don't want them projected/distorted.

Thanks,
C
0

manamana 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Sun Oct 24, 2010 12:01 pm

manamana wrote:sorry for the stupid question, but I can't test this at the moment.

does this script take geometry and lay it flat, or does it create a projection onto the work plane?

I'm looking for a script that will take a bunch of randomly oriented faces and lay them out nice and flat on the ground plane. For laser-cutting, so I don't want them projected/distorted.

Thanks,
C

This tool makes a 'projection' of the vertices in a shape to the nearest points on a plane.
Therefore if the object is skewed relative to the plane its projection will be distorted compared to its 'parent'.
This tool and its sibling 'SilhouetteToPlane' are very similar - this one projects vertices into new lines and keeps grouping etc whilst the other makes a cardboard-cutout silhouette of the 'profile' and faces it.
To lay the faces in objects flat onto the ground I suggest you try Jim Foltz's 'unfold.rb' - it's not 'automatic' but it's easy enough to use...
Are your faces individually grouped?
If so it might be easy enough to script a tool to transform them all 'flat' [normal=[0,0,1]] and all moved to be on the ground - z=0 - you might need to do some tidying if they overlapped etc... but another algorithm to shift them around once they were 'flat' so their bounds didn't intersect would also be feasible...
Adding text-tags to the grouped faces and their 'flattened' counterparts would also be helpful to keep track of them?
:geek:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby watkins » Sun Oct 24, 2010 2:19 pm

Could someone provide a few worked examples where this tool, and Silouette to plane, prove useful? I am still not clear on function.

Thanks!
Bob
0

watkins 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Sun Oct 24, 2010 3:55 pm

See this...
Capture.PNG
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby watkins » Sun Oct 24, 2010 4:28 pm

Dear TIG,

Many thanks for the illustration. So, am I right in thinking that this tool could be used to create third angle projects? Presumably, after using the flattening to plane/keep all edges tool, one could then delete unwanted lines and/or change lines to construction lines to show hidden detail?

Kind regards,
Bob
0

watkins 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Sun Oct 24, 2010 4:42 pm

watkins wrote:Dear TIG,
Many thanks for the illustration. So, am I right in thinking that this tool could be used to create third angle projects? Presumably, after using the flattening to plane/keep all edges tool, one could then delete unwanted lines and/or change lines to construction lines to show hidden detail?
Kind regards,
Bob

That's the idea ;)
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby gilles » Mon Oct 25, 2010 9:05 am

works great now.

:thumb: :thumb:
thanks a lot
0
" c'est curieux chez les marins ce besoin de faire des phrases "
User avatar
gilles 
Top SketchUcator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby gude » Tue Oct 26, 2010 9:12 am

Dear TIG.

I'm using this script to project elevations from a model. Its working flawless. Now I wanted to project a 2d of the model that is just visible from a plane And this requires me to select faces with visibility criteria from a given view.

I am doing this with a the following method but I hope there will be a better of doing it.

** Give a colour to my elevations for different views. For example faces that qualify to project on front be coloured red, side views colored yellow etc. then select by similar material and project selection to the working plane.
Faces that are visible on more than one elevation will be given another color and included in selection. **

As faces that are perpendicular to my working plane do not need to project these may be selected and hidden on projection just to refine the criteria.

Is there any criteria that evaluates faces in the model according to their visibility from the working plane?

Assuming that our model is opaque and rays from my working plane get reflected to the projection plane.

I.e for Not projecting rear side view on the front one etc ...

Thanks lot again.
0

gude 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Tue Oct 26, 2010 3:58 pm

It projects all selected faces - so to not include the rear don't select it ?
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby dem » Fri Mar 25, 2011 3:26 pm

got some strange trouble :cry:
01.png
0
User avatar
dem 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby TIG » Fri Mar 25, 2011 4:15 pm

Dem

What's the problem ?
Are you saying that the new 'flat' lines cross each other and they don't 'break' ?
If so, then that is how it should be - the 3D edges are projected flat onto the plane.
If you want the new lines to intersect, then select all of the geometry inside its group and 'Intersect with Context', so that they all split themselves where they cross... It's a quick fix if you are looking to erase some bits later...
Like this
Capture.PNG
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby dem » Fri Mar 25, 2011 5:06 pm

oh thanks!!! :thumb:
0
User avatar
dem 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby Bob James » Fri Mar 25, 2011 6:40 pm

@gude
Have you checked out cubicpanout.rb?
0
i7-4930K 3.4Ghz, 2x GTX780 6GB, 32GB DDR3-1600 ECC, OCZ Vertex 4 500GB, WD Black 3TB, 32TB NAS, 4x 27" Monitors, SpaceMouse Pro, X-keys XK-60
User avatar
Bob James 
Premium Member
Premium Member
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby Soundtracker » Wed Apr 06, 2011 12:30 am

TIG, is there a way to combine this with your Axo + Iso View plugin to export a 2D isometric view?
I thought of Work Plane but I can't seem to get it right :roll:
0

Soundtracker 
 

Re: [Plugin] Flatten to Plane v1.2 20101023

Postby Soundtracker » Wed Apr 06, 2011 12:54 am

how stupid...I just need to export a 2d graphic of course :oops:
0

Soundtracker 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: coconm and 11 guests

Visit our sponsors: