cristobalvila Posted January 15, 2015 Share Posted January 15, 2015 (edited) Hi guys! This is my first post here! Doing my first steps with Houdini Apprentice (love it!), thanks to Ari Danesh tutorials. And I have a couple of questions: QUESTION 1 — Say I'm drawing a NURBS curve with 16 CVs in perspective view… — And I need to translate various (6-8) of these points… — …or in the middle of edition, I change to TOP view and discover that I want to re-orient my curve, like rotating all 90º in Y — Using the “Curve Point Translator Handle” I can only move points one by one and is not possible to use a lasso to select and modify various at a time, AFAIK — Of course, I can change to Select Tool (White Arrow) to select various or all CVs, using lasso, to translate or move all at a time, BUT then this adds a new Edit Node… Is there some way to translate (or rotate, or scale) various CVs at a time, not one by one, WITHOUT adding a new Edit Node? -------------- QUESTION 2 — Once I draw my NURBS at “floor” (Y=0) I decide that I need to elevate all points from Y=0.0 to Y=8.5 — Again, move each 16 CVs one by one using the “Curve Point Translator Handle” is something tedious… — And using the Select Lasso + Translate creates a new Edit Node (and I don't want that here) Is there some quick way to change all coordinates for that 16 CVs from Y=0.0 to Y=8.5? I see that all coords are available to edit in the Node Coordinates Field in the form of: -5.88943,0,-4.53718 -2.55728,0,-5.74685 -0.019098,0,-4.35751 2.68056,0,-0.789587 0.164164,0,2.45453 -2.47971,0,2.05491 -4.41809,0,0.407587 -7.34409,0,1.07099 -7.21616,0,3.55875 -4.44833,0,6.02655 -0.512206,0,5.01098 3.61948,0,5.01341 6.90084,0,3.8506 7.40246,0,1.13527 7.4175,0,-1.95664 6.55921,0,-5.94921 But looking for each "0" there to change by "8.5" is not exactly the quickest procedure… Using RMB buton in the Curve node I can access to the "Spreadsheet", but this seems a thing only for checking (and not for edition purposes). I can change each value there, one by one, but then this creates a “soft lock” in node (which destroys edition once you unlock that…) Any help on these basic questions will be really appreciate! THANKS in advance :-) Edited February 9, 2015 by cristobalvila Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 (edited) Question 1: No, you cannot change a bunch of them at the same time. You have to use an edit node to do this. I guess the reason is that you would require a rotation handle and scaling handle as well. This would make the interface less elegant of the curve node. Question 2: Is basically the same problem as question 1: But you can break it up in various steps You can add a curve after the edit node with the following python expression in the coordinates field. points = hou.pwd().inputs()[0].geometry().points() field = "" for a in range(len(points)): field+="P"+str(a)+" " return field You do this by doing the following steps. Change the node to python (top right of the node's parameters field) Right click the coordinates field and change it into edit expression mode "Expression/toggle expression" While hovering over that field you can press Alt-e to open the expression editor. Paste the code. And you can store this as a node's preset going to the gear symbol on the top right of the parameters field. Like this you can reuse the extended functionality over again. You have this curve being placed after the edit node and you can continue from there on with manually editing or changing the point values. If you want to make sure you have all coordinates and not the point references you need to adjust the python script a bit. This would be needed if you want to remove the above nodes later on. (original curve and edit node(s)) but this is the method I use to overcome this issue. Edited January 15, 2015 by kgoossens 1 Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 Thank you so much for your detailed answer, Kim! Your suggestion on Python expression will be of great help also, not only for this specific issue but also for much other situations. Being this my first question and having a so detailed and fast answer, I can only say: this forum rocks! I will make lot of other questions, for sure, on next months, since this Houdini learning will be a long path (sorry to bother you with so basic doubts…) but I'm really loving the process. Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 (edited) Hmm, sorry to bother you, Kim, but I receive this error in my Expression Editor once I press the Apply button. Error: Unable to evaluate expression ( SyntaxError: ('invalid syntax', ('<stdin>', 2, 59, ' points = hou.pwd().inputs()[0].geometry().points()field = ""\n')) (/obj/curve_object1/curve2/coords)). This is what I have done: — Create a NURBS curve on floor — Select all points and move up (an 'edit1' node is added) — Add a 'curve2' node — Follow your steps, pasting your code on Expression Editor… Some clue? (maybe I'm completely misunderstanding some basic thing…) Edited January 15, 2015 by cristobalvila Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 Did you paste the code using the expression editor? It is a separate window that pops up. Because the code needs the new lines that you will not have if you paste it in directly. Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 Yes, Kim, I paste the code into the Expression Editor, getting the error once I press "Apply" button: Attached is my test scene, just in case I have done something completely stupid… :-/ Big thanks for your help! curveFromCurve.hipnc.zip Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 press return after "....points()" in the first line so that field = "" is on the second line Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 I see that it was my mistake in the post. I've changed it. Sorry for that. Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 (edited) A-HA! That works like a charm! Just a final question, after re-reading your first post, exactly these two lines: If you want to make sure you have all coordinates and not the point references you need to adjust the python script a bit. This would be needed if you want to remove the above nodes later on. (original curve and edit node(s)) That is exactly what I was looking for. By this way I would get a NURBS not dependent from previous stuff. How would be that python adjustment? Thank you so much, again, Kim :-) --- EDIT: please, don't worry at all for that small mistake. Your help is extremely welcome!!! Edited January 15, 2015 by cristobalvila Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 (edited) Hi you can use this instead import re points = hou.pwd().inputs()[0].geometry().points() positions=[] for point in points: value = str(point.position()) positions.append(value) joinedlist = " ".join(positions) cleanstring = re.sub(r"[\[\]\"]","", joinedlist) return cleanstring Edited January 15, 2015 by kgoossens 1 Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 YES! That is exactly what I was looking for. It works like silk. Once I paste and apply your code using Expression Editor, I just need: — Expression > Toggle Expression on Curve2 Coordinates — Copy all coords — Delete original Curve1 and Edit1 (this will make that Curve2 dissappears temporarily) — Paste (“flat”) coordinates on Curve2 — And voilà, my modified curve appears, without other external inputs. Not sure if these steps are the regular procedure or probably I'm ignoring some more simple operation. Thanks again for your help, Kim. I will save your code as a gem! :-) Quote Link to comment Share on other sites More sharing options...
kgoossens Posted January 15, 2015 Share Posted January 15, 2015 Make sure that you store it as a preset. (the little gearbox icon on the parameters pane) then you never have to add the script again, you can just select it from a list in the gearbox. Read about adding presets. You don't have to copy all the coords, just Ctrl+Shift+LMB to remove the expression. (doing this will keep the values calculated by the expression) Remove the nodes above 1 Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 15, 2015 Author Share Posted January 15, 2015 YES! I saved it as a preset, of course (my first preset, and I will use it a lot, for sure). Thanks for the Ctrl+Shift+LMB trick! So many new things to learn, I'm a complete novice! You make my day, Kim! Really appreciate. 1 Quote Link to comment Share on other sites More sharing options...
7ofDiamonds Posted January 15, 2015 Share Posted January 15, 2015 For question 2, you can also drop a Point node in the SOP level, and change the Y position value to 8.5. This is also a great way to align points! 1 Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 16, 2015 Author Share Posted January 16, 2015 For question 2, you can also drop a Point node in the SOP level, and change the Y position value to 8.5. This is also a great way to align points! Oh, yes, that is a really good trick! And also can to attach a new curve to extracting coords with Kim's script! Thanks for your suggestion, 7ofDiamons Quote Link to comment Share on other sites More sharing options...
Netvudu Posted January 17, 2015 Share Posted January 17, 2015 (edited) that´s what I was going to suggest as well. Kim´s is big on procedural modelling, but sincerely, a Point SOP would be my first call as it takes like 3 seconds. Besides, with a Point SOP you can keep it on the procedural level as long as you use a group created by expression (as opposed to the Edit SOP, which is obviously destructive and would break most procedural tools). PS: and don´t worry about beginners questions...that´s one of the reasons to have this forum. To solve doubts. Edited January 17, 2015 by Netvudu 1 Quote Link to comment Share on other sites More sharing options...
cristobalvila Posted January 19, 2015 Author Share Posted January 19, 2015 Thanks for you input, Netvudu. Yes, Point SOP is perfect, not only because I can to “align” all my points to a specific coord but I can also use a simple expression like $TY+8 to simply move my NURBS 8 units up, maintaining original form. This learning process will be a long path (my goal is to dedicate all 2015 to learn Houdini, a bit each day, around 1 hour) and then try to implement it for future projects, thanks to that Indie License that is really affordable. In the mean time I am really enjoying this great application! Thanks again for your help, guys! :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.