Hi there,
What is the best way to organize code?
-
Organize by topic categories to be readable and follow logic:
Add user texts: includes a loop for usertext asignment
Add objects to group: includes another loop
# Add user texts: rs.SetUserText(obj, "wallSurface", "Base", attach_to_geometry=False) rs.SetUserText(obj, "SurfaceType", "Planar", attach_to_geometry=False) for i in loft: rs.SetUserText(i, "wallSurface", "Edge_surface", attach_to_geometry=False) # Add objects to group group = rs.AddGroup() rs.AddObjectsToGroup([obj,surfaceOffset[0]], group) loft = rs.ExplodePolysurfaces (loft, True) for i in loft: rs.AddObjectToGroup(i,group)
-
Organize that efficient in terms of memory handling.
Add user texts:
Add objects to group: contains one loop (with user text asignment)
# Add user texts: rs.SetUserText(obj, "wallSurface", "Base", attach_to_geometry=False) rs.SetUserText(obj, "SurfaceType", "Planar", attach_to_geometry=False) # Add objects to group group = rs.AddGroup() rs.AddObjectsToGroup([obj,surfaceOffset[0]], group) loft = rs.ExplodePolysurfaces (loft, True) for i in loft: rs.AddObjectToGroup(i,group) rs.SetUserText(i, "wallSurface", "Edge_surface", attach_to_geometry=False)