Jump to content

kalugin

Registered Member
  • Posts

    361
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by kalugin

  1. performance updates address something that has been an issue for years. Otherwise 2024 feels like nothing to write home about, but a good stepping stone nonetheless. You can hype it all that you like, but it's quite a bland update. I've watched the "What's new" videos and they all feel the same. Even Chris was trying to fill in for content, but it just wasn't there. Improvements - cool. New features - None. I do realize that it was a lot effort to unify the simulation systems and all, good job doing that MAXON, but still...
  2. Yeah, that's where I encountered this. I was writing a point cloud voxelizer and when I was setting the axis to the center of the object via (all_positions)/points_count and comparing that to the "axis center" command there was a "wait a minute, something's not right..." moment 🙂
  3. that's not a bug. Without the "Points center" checked you are actually using the center of the bounding box of the object. When using "Points center", it sums the positions of every point in the object and divides the result by the number of points. The two results can be veeeery different. It depends on the object. Even more extreme example can be observed in a very simple triangle. The grey rectangle is the bounding box. At least this is how I understand it. Correct me if I'm wrong 🙂
  4. I had the impression that you are reading some external data. Like .csv or something. "PDFs / other external sources". 🙂 my bad.
  5. can you share an example of your source files? At least a small part of the data. I'm curious if it can be made even more automated 🙂
  6. it doesn't work on the new versions of C4D, I'll try to dig out the source code and adapt it.
  7. Here is a python solution. Enjoy 🙂 It also works with multiple polygons selected with different normals. It will select all the polygons that match any of the normals in the initial selection. import c4d def getNormal(poly, points): a = poly.a b = poly.b c = poly.c d = poly.d a_pos = points[a] b_pos = points[b] c_pos = points[c] vector1 = a_pos-b_pos vector2 = b_pos-c_pos normal = vector1.Cross(vector2) normal.Normalize() return str(normal) def main(): doc.StartUndo() obj = doc.GetActiveObject() polys = obj.GetAllPolygons() points = obj.GetAllPoints() poly_sel = obj.GetPolygonS() indices = poly_sel.GetAll(len(polys)) selected = [i for i, selected in enumerate(indices) if selected] selected_normals = {getNormal(polys[index], points) for index in selected} for i, poly in enumerate(polys): normal = getNormal(poly, points) if normal in selected_normals: doc.AddUndo(c4d.UNDOTYPE_CHANGE_SELECTION, obj) poly_sel.Select(i) doc.EndUndo() c4d.EventAdd() if __name__ == '__main__': main() select_similar_normals.py
  8. what you are trying to achieve is doable via these: BaseDocument.GetPickSession(self) BaseDocument.StartPickSession(self, callback, multi) BaseDocument.StopPickSession(self, cancel) read the SDK https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.documents/BaseDocument/index.html?highlight=pick#BaseDocument.StartPickSession
  9. @MighT sorry, man. I had no idea what an Apollonian Gasket is 🙂
  10. @MighTLooks almost fractal 🙂
  11. Are you printing the actual number of generated circles? I guess a lot of them should hit the minimum radius or the max attempts. My approach does not generate all the 750 for sure 😃
  12. if I cap the tries to 250k it's pretty consistent result. Edit: Sorry, I've noticed that i had increased the step for subtracting the radius of the new circles. Your algorithm is definitely faster. I guess my brute force approach could be optimized by using a hashed grid. I'll check it out.
  13. here is another way of achieving the same result 🙂 put this code in a python generator: import c4d from random import uniform rect_x_size = 200 rect_y_size = 200 circle_min_rad = 1.0 circle_max_rad = 50.0 max_circles = 100 def getRadius(circles): free = False rad = uniform(circle_min_rad, circle_max_rad) half_x = rect_x_size/2 half_y = rect_y_size/2 while not free: min_x = -half_x+rad max_x = half_x-rad min_y = -half_y+rad max_y = half_y-rad pos = c4d.Vector(uniform(min_x, max_x), uniform(min_y, max_y), 0) overlaps = False for circle in circles: c_rad = circle[0] c_pos = circle[1] dist = c4d.Vector.GetDistance(pos, c_pos) if (rad + c_rad) > dist: rad -= 0.05 overlaps = True break if not overlaps: free = True return rad, pos def main(): group = c4d.BaseObject(c4d.Onull) rect = c4d.BaseObject(c4d.Osplinerectangle) rect[c4d.PRIM_RECTANGLE_WIDTH] = rect_x_size rect[c4d.PRIM_RECTANGLE_HEIGHT] = rect_y_size rect.InsertUnder(group) circles = [] for i in range(max_circles): c4d.StatusSetSpin() txt = "generating circle {} of {}".format(i, max_circles) c4d.StatusSetText(txt) circle = c4d.BaseObject(c4d.Osplinecircle) rad, pos = getRadius(circles) circles.append([rad, pos]) m = circle.GetMg() m.off = pos circle.SetMg(m) circle[c4d.PRIM_CIRCLE_RADIUS] = rad circle.InsertUnder(group) c4d.StatusClear() return group circles in rect.c4d
  14. Has any of this been ever confirmed? Sounds like popcorn time, cause Voldemort will not like it 😄
  15. Yeah, I have no issues with the name. It's not only a C4D forum now so... I miss the regular challenges though. Even if I almost never participated, I enjoyed watching the threads. Maybe you guys can introduce some nodes/coding/something else challenges? Not only modeling/rendering 😉 There used to be a challenge every month. (I once won a second place in a "cartoon whale" challenge 😅)
  16. Yes. On both questions, but it's not something that can be explained in a couple of lines. There are just too many "ifs" 😁 There are a lot of details that are missing on your question and I don't know how exactly to help you. Don't get me wrong – I can make you a python template or a command line template, but I just don't know what can you do yourself and what are you expecting as an "advice/solution" 😉
  17. there is, but you will still need to have some listener running in the background to detect the new files and run c4d via command line. Basically: 1. run a listener in the background that will monitor the source folder for new files. 2. new files are put in that folder, the listener catches that and runs c4d from command line with some parameters depending on the workflow that you need. 3. c4d renders the scene in the background and puts the result in the target folder. After that it auto-closes. question - How do you replace the background in the project scene without using scripting? You would need to replace the the file that is associated in the background texture, but that will work only if it's a single video file. If it's a sequence of images it gets more complicated. check this link for reference to the command line arguments for c4d: https://www.cineversity.com/wiki/Command_Line_Parameters/
  18. hm, C4D is acting weird. It appears that you need the Connect object after all. I tried removing it and it still appeared that it's working without it, but actually c4d didn't refresh for some reason.
  19. just use a Splinemask instead of a Connect 🙂 Splinewrap doesn't like Connect objects.
  20. I would do it with via python message plugin that will check the source folder for new content and use that as a trigger to render the new scene and export the results. This will require for c4d to be running all the time.
  21. here is a simple xpresso setup. You need a spline with 4 points. the second and the third points of the spline are offset on the Y axis of objA and objB to get the smooth result that you are aiming for. cable.c4d
×
×
  • Create New...

Copyright Core 4D © 2024 Powered by Invision Community