cut_mesh
cut_mesh copied to clipboard
The example in the youtube video
Hey Patmo,
The example you showed in the youtube video https://www.youtube.com/watch?v=nrGNMm3I2Eg is not working. Sorry to be so bland and I understand the frustration when users just complain about not working. :-)
I am using Blender 2.76b. Since there is no mention of the blender version to be used I assumed it to be 2.76 as bvhtree is now a package of blender 2.76b.
Providing certain details like Blender and other supporting module versions might really help. Also for the example of geodesic_walk I see that you are using a different method signature in the video from the original code. Any clues? Have you updated it?
Finally, is there a way I can be of some help?
Regards,
0K
Hi, no worries about complaining I'm happy to have big reports. Will test when I get home. Best, P. Yes 2.76 is the correct version
So, here is how you make the "it's not working" more effective. 1. What did you try to do? 2. What error messages did you get in the console? 3. Can you upload a file you tried?
The code I tried to execute (as per your youtube video, sorry if it was outdated)
import bpy
import bmesh
from cut_mesh.geodesic import geodesic_walk, gradient_descent
from mathtoolbox import getBMMesh, ensurelookuptable
import time
seed_index = 0
bpy.app.debug = True
context = bpy.context
bm = getBMMesh(context, context.object)
ensurelookuptable(bm)
v_targets = [v for v in bm.verts if v.select and not v.hide]
if not len(v_targets) :
v_targets = [bm.verts[0]]
print("TARGETS ::: " , v_targets)
v_seed = bm.verts[seed_index]
start = time.time()
geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, v_targets[0], v_targets[0].co, subset=None, max_iterations=10000)
finish = time.time()
The getBMMesh
and ensurelookuptable
are my wrapper functions which does exactly the same for getting the instance of bmesh module of an object. The error I received
Traceback (most recent call last): File "/home/ashok/PhD/PythonBlender_TestFiles/MarkerCreator/RemeshMarkers.blend/Text", line 22, in <module> TypeError: geodesic_walk() got multiple values for argument 'subset' Error: Python script fail, look in the console for now...
After I remove the subset
and max_iterations
parameters as they have default values assuming it will not be a problem, the error I get is:
Code Before:
geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, v_targets[0], v_targets[0].co, subset=None, max_iterations=10000)
Code After:
geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, v_targets[0], v_targets[0].co);
Produces the following error:
Traceback (most recent call last):
File "/home/ashok/PhD/PythonBlender_TestFiles/MarkerCreator/RemeshMarkers.blend/Text", line 22, in <module>
File "/home/ashok/.config/blender/2.76/scripts/addons/cut_mesh/geodesic.py", line 366, in geodesic_walk
far.remove(seed);
KeyError: <BMVert(0x7f7a5c4ed010), index=0>
Error: Python script fail, look in the console for now...
Hope you are not offended but I tried adding a try, catch exception to the code inside geodesic_walk at line 366
(I use netbeans editor), to suppress the above error, the particular place where the code has been changed is highlighted below
Code before in def geodesic_walk
:
far.remove(seed);
Was changed to
try:
far.remove(seed);
except:
print("ERROR REMOVING THE SEED FROM FAR ", seed);
This ensured to except the faulty case and as it proceeds to create the stop_targets set
the following error was raised:
TARGETS ::: <BMVert(0x7f1c124ed010), index=0> Traceback (most recent call last): File "/home/ashok/PhD/PythonBlender_TestFiles/MarkerCreator/RemeshMarkers.blend/Text", line 22, in <module> File "/home/ashok/.config/blender/2.76/scripts/addons/cut_mesh/geodesic.py", line 433, in geodesic_walk for ele in targets: TypeError: 'BMVert' object is not iterable Error: Python script fail, look in the console for now...
Then I decided it was time to notify the Jedi knight (you) about this issue. Also my sincere apologies for the irregular format in the code pasted here. I am fairly new to usage of issues section of github despite the irony that I have my own projects hosted here (ROFLOL).
Please let me know if you have any clarifications and I would be glad to be of some help. Lastly, and also Importantly your contribution is greatly appreciated (atleast in the scientific graphics community). Thanks for your time Mr Jedi.
Regards, #0K
Perfect, that gives me a lot to go on. I have no problems with you (or anyone) editing code. If you make changes which improve things I accept pull requests
That shows your humbleness. I was doing it only to test where the real error lies. It would be unfair and erroneous of me to edit the code without understand the complete picture behind it. But thanks for your attention and your contribution is sincerely appreciated.
Let me know if I can be helpful somewhere.
Regards,
#0K
One error is syntax which may have changed a little. You have geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, v_targets[0], v_targets[0].co)
v_targets is now a list, and no locations are necessary. It should now be'geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, [v_targets[0]])
Hello Jedi Knight,
Firstly, thanks for your prompt-ly fixes. Let me begin with a compliment, the library is amazingly fast.
Also there is one another thing with the geodesic_walk
, you mentioned in your earlier comment that it should be
geos, fixed_vs, close_vs = geodesic_walk(bm, v_seed, v_seed.co, [v_targets[0]])
but I guess it should be
geos, fixed_vs, close_vs, far = geodesic_walk(bm, v_seed, v_seed.co, max_iters=len(bm.verts));
I found it when the python started complaining about too many values to unpack. Then digging a bit in your method signature revealed that you return 4
values instead of 3
values. Wow, I am loving your library and also github's coding markup. Cheers.
Will try to test the library in a more robust fashion and bother you more. Maybe one day we should have a drink somewhere. LOL
Regards,
#0K
The speed belongs completely to the original paper. I just hacked it together. So it is working for you! That is excellent.
I can now confirm that the method for gradient_descent
is also working. But there is a tiny change in the code from the original video.
**
Video code contains:
**
path_eles, path_coords = gradient_descent(bm, geos, v);
**
What actually works now:
**
path_eles, path_coords = gradient_descent(bm, geos, v, v_seed.co);
Also there are other discussions I want with you, of course in your limited time. Do you want to continue in this thread?
Hey, I would be happy to do the wiki documentation based on my understanding of your methods.
Regards,
#0K
Let's continue regular discussions here. http://blenderartists.org/forum/showthread.php?393477-Geodesics-on-Surfaces
Any documentation you would like to update I am all for it!
Hey Patmo,
I have finished my paper am currently working for my research. Since I am using your blender plugin for a geodesic path, it would make me happy to have your real name for the acknowledgement section of the paper. Spoke to my supervisor about the same and am sure he will be glad to agree. So when things are in place I would like to quote your name in my paper's acknowledgement. Are you fine with this?
Regards,
#0K