I've updated the first post with a new version which will work with SketchUp 6.
Posts
-
RE: [Plugin] Recurve
-
RE: [Plugin] SurfaceGen (0.9.0b) β 28 April 2012
Thanks thomthom, but I've just used a rescue statement so it will fallback on the older version if the newer one fails. The first post has the updated version which works with v6.
-
RE: [Plugin] SurfaceGen (0.9.0b) β 28 April 2012
Thanks everyone who commented!
@d12dozr
I've no idea how to make such complicated structures as those ones you linked to, but you can get some interesting shapes by just mixing up a few of the built in functions:sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh, atan2, hypot, sqrt, cbrt, log, log2, log10, ln, exp
and constants:
e, pi
@unknownuser said:
When switching to "Equation", change the default settings to something that will work just by pressing "Generate"
I'll just make the default equation something that will work for both modes.
@unknownuser said:
Add a random equation/function generator, perhaps using preset equations
That could be interesting. Perhaps the user could choose a level of complexity and it would use that many operations.
@unknownuser said:
Add an error message when the equation is invalid, pointing out why its invalid if possible
Showing an error would be possible, but it might be difficult to point out where. It depends on how much information ruby gives me. For speed, the equation is converted into ruby code, so I can just eval it for each point instead of running my own interpretter.
@unknownuser said:
Here's a question for you...is there a way to make the SurfaceGen geometry look like the first Meshlab image?
I don't know exactly how Meshlab works internally, but it seems like the voxel size is equivalent to the range of values divided by the number of cells. ie:
voxelSize = (max-min)/cellsI'm surprised it should look so different though, just by changing the voxel size.
@Pilou
I've found the problem. It won't let me pass a hash to WebDialog.new. -
[Plugin] SurfaceGen (0.9.0b) β 28 April 2012
SurfaceGen v0.9 (Beta)
SurfaceGen is a plugin which allows you to create surfaces from mathematical formulae. There are two modes supported:
Function Mode
The Z coordinates of points in a heightmap are specified as a function of X and Y. There can therefore only be one Z value per X, Y coordinate.Equation Mode
An equation relating X, Y and Z is given. This mode can graph any 3D surface for which there is a formula, but may take slightly longer. The marching cubes algorithm (wow that one is a pain to implement!) is used to generate a surface around a 3D grid of data generated from the equation.Instructions
-
Select the SurfaceGen tool from its toolbar.
-
Click to set one corner of the graph.
-
Click again to set the opposite corner on the same level.
-
Click a third time to set the height of the graph.
-
You can transform the resulting group without causing problems.
-
After creating the graph and it becoming selected, the SurfaceGen Options window should appear.
-
Set the axis ranges, the SurfaceGen mode and enter an equation.
-
Choose if you want to show the graph boundary. This will make a semi-transparent box around the graph. The sides facing the camera will always be invisible as you rotate the camera allowing you to see the surface.
-
Choose if you want the graph to be smooth.
-
Click generate. This may take a few seconds, so be patient. It will happen asynchronously, so you should still be able to move the camera around.
-
You can set the surface material by using the paint bucket on the group. The surface will become the selected material.
-
Opening the group will cause the graph to turn into a normal group. The plugin will ask if you really want to do this before it actually happens.
Install
Download and extract the attached zip file to your plugins folder. Please remember this is still in beta! I want to hear about any problems you encounter!
Update 0.6
- Updated to work with SketchUp 6
Update 0.7
-
Updated to be more compatible with Macs
Now uses built in functions to locate resources and combine paths. Also uses WebDialog.show_modal on macs to get always-on-top behaviour. -
Added more functions
abs, min, max, clamp can now be used in an expression. -
Allowed expressions in axis ranges
You can now easily graph from -pi to pi etc. -
More error checking
You will be notified if an expression is invalid, and hopefully some useful information about why it was invalid will given.
Update 0.7b
- Added point validation to getExtents for the graph tool
The ruby console shouldn't show any errors when drawing a new graph.
Update 0.7c
- Fixed expression parsing bug
Previously, using the same function twice in a row didn't work: sqrt(sqrt(16)) due to the regex used. Now it does.
Update 0.8
-
Changed use of pt units to px units in WebDialog
The font should display at the same size in all browsers. -
Now works from any directory
Resources are looked for starting with the directory containing surfacegen.rb. -
Can more easily change WebDialog size
The width as well as the height are constants in surfacegen.rb
Update 0.9
- Increased speed
Previously "eval" was used to evaluate the expression at each sample point, now it uses "eval" once to create a proc object which is called multiple times.
-
-
RE: [Plugin] Recurve
I'm afraid I can't find out why it doesn't work in v6 because I only have versions 7 and 8 and google only host older downloads for sketchup pro.
It could be that the method it uses simply doesn't work in v6. You can test this by making a curve and copying it. Explode the copy and then make it into a group and position it exactly over the original curve. Then explode the group. If you are left with a curve, the method should work.
-
RE: [Plugin] Recurve
I've uploaded a new version. It behaves the same as the last version, but if you open it in notepad you can change the line:
RECURVE_ALL_UNDER_RECURVE_MENU = false
to:
RECURVE_ALL_UNDER_RECURVE_MENU = trueThat will put the Select Only menu under the Recurve menu.
-
RE: [Plugin] Recurve
Just updated the first post with update 1.3. It includes the changes suggested by Jeff.
-
RE: [Plugin][$] Tools On Surface - v2.6a - 01 Apr 24
This plugin is exceptionally useful!
A couple of minor bugs:
Sometimes, if you draw a circle or ellipse over a hard edge, the curve will be divided into more than two parts. The plugin needs to start and end the curve at one of the intersections with the hard edge to prevent it. Also, the drawing tools seem to make duplicate faces occasionally. Oddly this seems to happen often on flat surfaces. -
RE: [Plugin] Autoloader
Yes it will see new files as well as existing modified ones;)
-
[Plugin] Autoloader
This is mainly useful for when writing plugins. After making a change to a plugin, just click the update scripts button and it will automatically reload any scripts which have been modified since they were last reloaded. It should handle .rb and .rbs files, and will look for scripts in all the paths in the $: global variable.
The plugin will list the files which have been reloaded and the files for which reloading failed in the status bar.
Extract the attached file to your plugins folder to try it out.
-
RE: [Plugin] Recurve
That doesn't help solve the problem I mentioned though. The only way I know of to create an arc in sketchup is with Entities.add_arc, which is functionally equivalent to the arc tool. Arcs created by dividing another arc in two cannot be made this way. I would have to know the exact sequence of events which happened to create the arc in the first place to recreate it in the opposite direction.
-
RE: [Plugin] Recurve
Yes, currently it only makes curves not arcs. The reverse curve command basically explodes the curve and then calls recurve on it in the opposite direction, so the arc information is lost in the process. I could try changing recurve so that it detects if the sequence of edges makes a perfect arc.
The problem is, there are some arcs that are almost impossible to recreate. If you create an arc and then draw a line through it, you get two arcs, neither of which can be drawn with the arc tool. Even changing the number of segments in them will change their shape irreversibly.
Alternatively, if there are SketchUp features which you need to use and only work on arcs, I could make them work with all curves.
-
RE: [Plugin] Recurve
I've fixed the bug for large numbers of edges.
The algorithm used to use recursion to find a route through the edges and that cause a stack overflow. Now all the algorithms work using simple loops.
See the first post for v1.2
-
RE: [Plugin] Recurve
Just updated the plugin to v1.1. See the first post for details and download.
-
RE: [Plugin] Recurve
Thanks for the heads up about context menu handlers. I'll change it in the next update. I've added the ability to reverse curves but I'm still trying to fix some bugs. Somehow the curves are being split up which is weird...
-
[Plugin] Recurve
Recurve v1.5
This plugin converts a sequence of edges into a curve. Useful when performing an operation has exploded a curve which you want to stay as a curve. Also includes options to quickly select edges which could potentially form a curve, and filter the selection to only include specific types of edges, faces or groups.
Simply download the attached script to your plugins folder to try it out.
Instructions:
-
Quickly select edges to be recurved
Select a single edge from the edges to be made into a curve and choose "Recurve -> Select Curve" or "Recurve -> Select Curve (Planar)" from the context menu. If the curve exists in a single plane, "Select Curve (Planar)" is more likely to find the correct sequence of edges. The command works by following a sequence of edges which don't change direction sharply. -
Recurve a sequence of edges
Select all the edges which make up the curve and choose "Recurve -> Recurve Edges" from the context menu. The edges should be instantly replaced with a curve. -
Filter the current selection
From the context menu choose "Select Only -> " followed by your filter choice. The selection will be updated to only include those entities matching the filter. -
Reverse a curve
Select the curves you want to be reversed and choose "Recurve -> Reverse Curve" from the context menu. There will be no visible change, but the curves will be reversed.
Update v1.1
-
Improved curve selection
Curve selection now uses the directions of edges to help decide which edges should be selected. -
Simplified code
Refactored the code so that it's easier to maintain, and runs more efficiently. -
Improved context menu handler
For large selections, the context menu handler will run in constant time. -
Fixed divided curve bug
For curves which intersect hard edges, the old version had a bug which could cause the resulting curve to be divided up at other places. This same bug is present in Fredo6's Tools On Surface plugin when drawing a curved shape over a hard edge. -
Added reverse curve command
Does what it says on the tin!
Update v1.2
-
Removed recursion
None of the algorithms now use recursion so there is no danger of stack overflow. -
Selection saved
Reverse curve now updates the selection to include all of the new reversed curves.
Update v1.3
-
Moved recurve commands into submenu
All commands are now in either the "Select Only -> " or "Recurve -> " submenus. -
Can now recurve curves
Curves will be automatically exploded if recurve is run on them. -
Can now select curves including existing curves
The select curve menu item will show up when the selection is a curve. -
Added combo commands
There are commands to quickly select and recurve at the same time, in both normal and planar versions.
Update v1.4
- Now works with SketchUp 6
Update v1.5
- Fixed bug with faces touching the curve at only a corner
Some code needs to run for each face touching the curve. Previously it used the edges in the curve to find the faces. Now it uses the vertices to find the faces.
-