I’m wondering what a quick way (in terms of script/macro writing and performance) would be to purge a file or export a model from a file(or a bunch of files, I do know how to do that…) that’s been purged of all curves, including ones inside blocks? Preferably I’d like to keep the blocks “blocks,” not just explode and sel all curves delete.
Problem is curves in block instances aren’t actually in the file as objects, they are just in the block definitions. So you can’t select and delete, you would need to go into each block definition and modify it by removing anything defined as a curve. I haven’t looked into if this can be done scriptwise.
Maybe just redefine the block defs using the same name and the same elements minus the curves.
Maybe like this:
import rhinoscriptsyntax as rs def RemCrvsFromBlocks(): blk_ids=rs.ObjectsByType(4096) if not blk_ids: return for blk_id in blk_ids: #need to get block def name and insertion point rhobj=rs.coercerhinoobject(blk_id) blk_name=rhobj.InstanceDefinition.Name base_pt=rhobj.InsertionPoint #get object ids that compose the block orig_obj_ids=rs.BlockObjects(blk_name) #remove curves sans_crvs= for obj_id in orig_obj_ids: if not rs.IsCurve(obj_id): sans_crvs.append(obj_id) #redefine the block, or delete it if it's all curves if sans_crvs: rs.AddBlock(sans_crvs,base_pt,blk_name,True) else: rs.DeleteObject(blk_id) RemCrvsFromBlocks()
That certainly seems to do it!