I have insert a block on surface, and how cat I get brep of it?
Not sure if this is what you want:
import rhinoscriptsyntax as rs import scriptcontext as sc import Rhino bloc=rs.GetObject("Select block",4096,preselect=True) obj=sc.doc.Objects.Find(bloc) #get definition, transform idef=obj.InstanceDefinition xform=obj.Geometry.Xform #get objects that compose original definition, transform them same as block geo=idef.GetObjects() for g in geo: g.Geometry.Transform(xform) #geo should now contain the objects in the block instance #should work with any type of object, not just breps
Think you Helvetosaur, sorry for my English, my English is not good.
I means I wan to get brep from block which have inserted, and then draw brep shaded
I not how to draw it, but I do not kown how to get the brep.
Well, I think my example does that - the variable “geo” should be a list of objects that were in the block - if they are Breps and you know how to draw them, you should be able to.
If you add these two lines to the bottom of the script, if the block was composed of Breps, it should add them to the document.
for brep in geo: sc.doc.Objects.AddBrep(brep) sc.doc.Views.Redraw()
Think you Helvetosaur, it work and work good.